libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: allow running libtool tests at configure time [libtool--gary--1


From: Ralf Wildenhues
Subject: Re: FYI: allow running libtool tests at configure time [libtool--gary--1.0--patch-26]
Date: Thu, 18 Aug 2005 13:56:31 +0200
User-agent: Mutt/1.4.1i

Hi Gary, others,

* Ralf Wildenhues wrote on Fri, May 13, 2005 at 03:47:32PM CEST:
> * Gary V. Vaughan wrote on Mon, May 02, 2005 at 09:56:23PM CEST:

[ old patch, see here:
http://lists.gnu.org/archive/html/libtool-patches/2005-05/msg00114.html
]

> Here is my review for that patch.  I believe it is ok after the nits are
> addressed.

I have re-diffed this against current CVS HEAD, including changes for my
complaints.  Unless anybody complains, I will apply this soon and
backport to branch-2-0, killing yet another impediment to 2.0.  :)

Cheers,
Ralf

        * libltdl/m4/libtool.m4 (LT_OUTPUT): New macro to generate
        libtool before config.status.
        (_LT_CONFIG_COMMANDS): If LT_OUTPUT has been invoked, then
        generate code in config.status to call config.lt instead of
        generating libtool directly.
        * doc/libtool.texi (LT_INIT): Document LT_OUTPUT.
        * tests/early-libtool.at: New test.
        * Makefile.am (TESTSUITE_AT): Updated.
        * tests/testsuite.at: Updated.  Define defaults for
        $ACLOCAL, $AUTOCONF.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.155
diff -u -r1.155 Makefile.am
--- Makefile.am 8 Aug 2005 09:23:57 -0000       1.155
+++ Makefile.am 18 Aug 2005 09:44:31 -0000
@@ -301,6 +285,7 @@
                  tests/stresstest.at \
                  tests/link-order.at \
                  tests/convenience.at \
+                 tests/early-libtool.at \
                  tests/template.at
 
 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4
Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.193
diff -u -r1.193 libtool.texi
--- doc/libtool.texi    12 Aug 2005 22:52:30 -0000      1.193
+++ doc/libtool.texi    18 Aug 2005 09:44:32 -0000
@@ -24,7 +24,7 @@
 @ifnottex
 This file documents GNU Libtool @value{VERSION}
 
-Copyright (C) 1996-2004 Free Software Foundation, Inc.
+Copyright (C) 1996-2005 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1
@@ -51,7 +51,7 @@
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2004 Free Software Foundation, Inc.
+Copyright @copyright{} 2005 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the @sc{gnu} Free Documentation License, Version 1.1
@@ -2116,6 +2116,23 @@
 tests before being passed to @file{config.status} for inclusion in the
 generated libtool script.
 
address@hidden LT_OUTPUT
+By default, the configured @file{libtool} script is generated by the
+call to @code{AC_OUTPUT} command, and there is rarely any need to use
address@hidden from @file{configure}.  However, sometimes it is
+necessary to run configure time compile and link tests using
address@hidden  You can add @code{LT_OUTPUT} to your
address@hidden any time after @code{LT_INIT} and any
address@hidden calls; that done, @file{libtool} will be created by a
+specially generated @file{config.lt} file, and available for use in
+later tests.
+
+Also, when @code{LT_OUTPUT} is used, for backwards compatibility with
+Automake regeneration rules, @file{config.status} will call
address@hidden to regenerate @file{libtool}, rather than generating
+the file itself.
address@hidden defmac
+
 @pindex aclocal
 When you invoke the @command{libtoolize} program (@pxref{Invoking
 libtoolize}), it will tell you where to find a definition of
@@ -5401,7 +5418,7 @@
 trick$ libtool --version
 ltmain.sh (GNU @@PACKAGE@@@@TIMESTAMP@@) @@VERSION@@
 
-Copyright (C) 2004  Free Software Foundation, Inc.
+Copyright (C) 2005 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 trick$
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.211
diff -u -r1.211 libtool.m4
--- m4/libtool.m4       18 Aug 2005 06:55:40 -0000      1.211
+++ m4/libtool.m4       18 Aug 2005 09:44:32 -0000
@@ -189,8 +189,7 @@
 RM="rm -f"
 
 # Global variables:
-default_ofile=libtool
-ofile="$default_ofile"
+ofile=libtool
 can_build_shared=yes
 
 # All known linkers require a `.a' archive for static linking (except MSVC,
@@ -461,7 +460,23 @@
 # for loops in `config.status'.  Finally, any additional code accumulated
 # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
 m4_defun([_LT_CONFIG_COMMANDS],
-[AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+       dnl If the libtool generation code has been placed in $CONFIG_LT,
+       dnl instead of duplicating it all over again into config.status,
+       dnl then we will have config.status run $CONFIG_LT later, so it
+       dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
@@ -510,11 +525,118 @@
 
 _LT_OUTPUT_LIBTOOL_INIT
 ])
-])#_LT_CONFIG_COMMANDS
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[dnl This macro can only work once all the language testing is completed
+AC_BEFORE([LT_INIT], [LT_OUTPUT])
+AC_BEFORE([LT_LANG], [LT_OUTPUT])
+
+: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <address@hidden>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2005 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try `$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognised argument: $[1]
+Try `$[0] --help for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
 
 
 # _LT_CONFIG(TAG)
-# ----------------------------
+# ---------------
 # If TAG is the built-in tag, create an initial libtool script with a
 # default configuration from the untagged config vars.  Otherwise add code
 # to config.status for appending the configuration named by TAG from the
@@ -537,7 +659,7 @@
 #! $SHELL
 
 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building 
support services.
-# Generated automatically by config.status (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.15
diff -u -r1.15 testsuite.at
--- tests/testsuite.at  30 Apr 2005 09:30:14 -0000      1.15
+++ tests/testsuite.at  18 Aug 2005 09:44:32 -0000
@@ -21,7 +21,9 @@
 m4_divert_push([PREPARE_TESTS])dnl
 : ${LIBTOOLIZE="${abs_top_builddir}/libtoolize"}
 : ${LIBTOOL="${abs_top_builddir}/libtool"}
-export LIBTOOLIZE LIBTOOL
+: ${ACLOCAL=aclocal}
+: ${AUTOCONF=autoconf}
+export LIBTOOLIZE LIBTOOL ACLOCAL AUTOCONF
 eval `$LIBTOOL --config | grep ^EGREP=`
 eval `$LIBTOOL --config | $EGREP '(host|build)='`
 m4_divert_pop([PREPARE_TESTS])dnl
@@ -97,5 +99,7 @@
 m4_include([am-subdir.at])
 # C++ templates tests
 m4_include([template.at])
+# Behaviour of LT_OUTPUT
+m4_include([early-libtool.at])
 # stress test
 m4_include([stresstest.at])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]