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: Gary V. Vaughan
Subject: Re: FYI: allow running libtool tests at configure time [libtool--gary--1.0--patch-26]
Date: Mon, 02 May 2005 20:56:23 +0100
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Hallo Ralf!

Ralf Wildenhues wrote:
> * Gary V. Vaughan wrote on Sat, Apr 30, 2005 at 04:06:19PM CEST:
>
>>This may not apply cleanly to HEAD, as I developed it on my own branch
>>which still has the pending standalone libtool patch awaiting.
>
> Does that mean branch-2-0 will need Automake 1.10?  Which patch are you
> talking about here?

(lists.gnu.org isn't back up yet, so I can't give you links :-( Sorry!)

libtool--gary--1.0--patch-23 (support standalone libtool) is blocked by
2quater-gary-libobj-dir-support.patch against automake HEAD, and by
1quater-gary-honour-libobj-dir.patch against autoconf HEAD.

In my patch-23 thread on libtool-patches, I said:

  I think it is fine for HEAD to rely on CVS autoconf/automake, although
  I don't want to commit until the above patches are in too.

  That done, a backport to branch-2-0 will require reverting to running
  libltdl/configure as a subconfigure, otherwise we can't release it
  bootstrapped with autoconf-2.59 and automake-1.9.5.

  ...[[crt2.o bug in autoconf-2.59 discussion]]...

So, the question is whether we want to:

i) do a straight backport of patch-23 to branch-2-0, and bootstrap with
   autoconf-HEAD and automake-HEAD

ii) do a straight backport of patch-23 to branch-2-0, and bootstrap with
   a patched autoconf-HEAD and automake-HEAD (patching for crt2.o bug;
   libobj-dir patches above; Sun Studio Fortran bug you mention in the
   patch-23 thread).

iii) do a partial backport, but libtool branch-2-0 will have to
   subconfigure libltdl to get libltdl/configure and libltdl/Makefile
   in time for make install.

My vote is for (ii):  (i) might expose us to unfixed bugs in CVS
autotools; (iii) will make patch merging after 2.0 much more difficult.

> I promise to test it after I get back.
> Slight nits from reading are below.

Okay, thanks!  We also need -patch-23, and your forward ports from
branch-1-5 before we are good to roll the next 2.0 alpha...

> Please show early-libtool.at.

I wonder why that didn't attach?  Full patch attached including
early-libtool.at, with your nits addressed.


>>  +# 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.
>
>
> Nice!

Not my work... inspiration from config.status generation code in CVS
autoconf.

Cheers,
        Gary.
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
  * looking for address@hidden/libtool--gary--1.0--patch-25 to compare with
  * comparing to address@hidden/libtool--gary--1.0--patch-25
  M  Makefile.am
  M  doc/libtool.texi
  M  libltdl/m4/libtool.m4
  M  ChangeLog
  M  tests/testsuite.at
  A  tests/early-libtool.at
  A  
{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-26
  A  
{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-27

  * modified files

  Index: Changelog
  from  Gary V. Vaughan  <address@hidden>

        * tests/early-libtool.at: Forgot to add this file.
        * libltdl/m4/libtool.m4 (CONFIG_LT): Shell quoted.
        (LT_OUTPUT): tabified.

        * 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.
        * tests/early-libtool.at: New test.
        * Makefile.am (TESTSUITE_AT): Add tests/early-libtool.at.
        * doc/libtool.texi (LT_INIT): Document LT_OUTPUT.

--- orig/doc/libtool.texi
+++ mod/doc/libtool.texi
@@ -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
@@ -2096,6 +2096,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
@@ -5381,7 +5398,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$
--- orig/libltdl/m4/libtool.m4
+++ mod/libltdl/m4/libtool.m4
@@ -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 M$VC,
@@ -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.
@@ -508,11 +523,124 @@

 _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
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+
+lt_cl_usage="\
+\`$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."
+
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+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
@@ -535,7 +663,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.
 #
@@ -1204,7 +1332,7 @@
     # nice to cause kernel panics so lets avoid the loop below.
     # First set a reasonable default.
     lt_cv_sys_max_cmd_len=16384
-    #
+    #
     if test -x /sbin/sysconfig; then
       case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
         *1*) lt_cv_sys_max_cmd_len=-1 ;;
@@ -3616,7 +3744,7 @@
   if test "$with_gnu_ld" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
-
+
     # Set some defaults for GNU ld with shared library support. These
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
--- orig/Makefile.am
+++ mod/Makefile.am
@@ -443,13 +443,14 @@
 TESTSUITE      = tests/testsuite
 TESTSUITE_AT   = tests/testsuite.at \
                  tests/am-subdir.at \
+                 tests/convenience.at \
                  tests/duplicate_members.at \
+                 tests/early-libtool.at \
                  tests/inherited_flags.at \
                  tests/libtoolize.at \
+                 tests/link-order.at \
                  tests/standalone.at \
                  tests/stresstest.at \
-                 tests/link-order.at \
-                 tests/convenience.at \
                  tests/template.at

 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4
--- orig/tests/testsuite.at
+++ mod/tests/testsuite.at
@@ -99,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])
--- /dev/null   2005-05-02 20:50:19.000000000 +0100
+++ tests/early-libtool.at      2005-05-02 20:45:06.000000000 +0100
@@ -0,0 +1,213 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+
+AT_BANNER([libtool script generation.])
+
+
+## --------------------------------------------- ##
+## Building libtool normally from config.status. ##
+## --------------------------------------------- ##
+
+AT_SETUP([config.status])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[prefix = @prefix@
+libdir = @libdir@
+top_builddir = .
+DEFAULT_INCLUDES = -I. address@hidden@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+
+COMPILE = $(CC) $(DEFAULT_INCLUDES)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFAULT_INCLUDES)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@
+
+all: hell
+
+libhello.la: hello.lo
+       $(LINK) -rpath $(libdir) hello.lo
+hell$(EXEEXT): main.o libhello.la
+       $(LINK) main.o libhello.la
+
+.SUFFIXES:
+.SUFFIXES: .c .o .lo
+
+.c.o:
+       $(COMPILE) -c -o $@ $<
+.c.lo:
+       $(LTCOMPILE) -c -o $@ $<
+]])
+
+AT_DATA([hello.c],
+[[#include <stdio.h>
+
+void
+hello (void)
+{
+  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
+}
+]])
+
+AT_DATA([main.c],
+[[#include <stdio.h>
+
+extern void hello (void);
+
+int
+main (int argc, char *argv[])
+{
+  printf ("Welcome to GNU Hell!\n");
+
+  hello ();
+
+  return 0;
+}
+]])
+
+AT_DATA(expout,
+[[Welcome to GNU Hell!
+** This is not GNU Hello.  There is no built-in mail reader. **
+]])
+
+cat > missing <<_EOF
+#! /bin/sh
+exit 0
+_EOF
+chmod a+x missing
+
+test -f ltmain.sh  || LT_AT_LIBTOOLIZE([--copy --verbose --install])
+test -f aclocal.m4 || aclocal -I m4              || exit 1
+test -f configure  || autoconf --force           || exit 1
+test -f Makefile   || ./configure                || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./hell], [0], [expout])
+
+AT_CLEANUP
+
+
+## ------------------------------------------ ##
+## Building and using libtool from config.lt. ##
+## ------------------------------------------ ##
+
+AT_SETUP([config.lt])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+LT_OUTPUT
+
+cat >hello.c <<\_LTEOF
+#include <stdio.h>
+
+void
+hello (void)
+{
+  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
+}
+_LTEOF
+
+# Prove that we can run libtool from inside configure:
+$SHELL ./libtool --mode=compile --tag=CC "$CC" -I. -I$srcdir \
+    -c -o hello.lo hello.c  || exit 1
+$SHELL ./libtool --mode=link --tag=CC "$CC" -o libhello.la \
+    -rpath "$prefix/lib" hello.lo || exit 1
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[prefix = @prefix@
+libdir = @libdir@
+top_builddir = .
+DEFAULT_INCLUDES = -I. address@hidden@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+
+COMPILE = $(CC) $(DEFAULT_INCLUDES)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@
+
+hell$(EXEEXT): main.o libhello.la
+       $(LINK) main.o libhello.la
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+.c.o:
+       $(COMPILE) -c -o $@ $<
+]])
+
+AT_DATA([hello.c],
+[[#include <stdio.h>
+
+void
+hello (void)
+{
+  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
+}
+]])
+
+AT_DATA([main.c],
+[[#include <stdio.h>
+
+extern void hello (void);
+
+int
+main (int argc, char *argv[])
+{
+  printf ("Welcome to GNU Hell!\n");
+
+  hello ();
+
+  return 0;
+}
+]])
+
+AT_DATA(expout,
+[[Welcome to GNU Hell!
+** This is not GNU Hello.  There is no built-in mail reader. **
+]])
+
+cat > missing <<_EOF
+#! /bin/sh
+exit 0
+_EOF
+chmod a+x missing
+
+test -f ltmain.sh  || LT_AT_LIBTOOLIZE([--copy --verbose --install])
+test -f aclocal.m4 || aclocal -I m4              || exit 1
+test -f configure  || autoconf --force           || exit 1
+test -f Makefile   || ./configure                || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./hell], [0], [expout])
+
+AT_CLEANUP
--- /dev/null   2005-05-02 20:50:19.000000000 +0100
+++ 
{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-26
   2005-05-02 20:45:06.000000000 +0100
@@ -0,0 +1,19 @@
+Revision: libtool--gary--1.0--patch-26
+Archive: address@hidden
+Creator: Gary V. Vaughan <address@hidden>
+Date: Sat Apr 30 14:59:28 BST 2005
+Standard-date: 2005-04-30 13:59:28 GMT
+Modified-files: ChangeLog Makefile.am doc/libtool.texi
+    libltdl/m4/libtool.m4 tests/testsuite.at
+New-patches: address@hidden/libtool--gary--1.0--patch-26
+Summary: allow running libtool tests at configure time
+Keywords:
+
+* 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.
+* tests/early-libtool.at: New test.
+* Makefile.am (TESTSUITE_AT): Add tests/early-libtool.at.
+* doc/libtool.texi (LT_INIT): Document LT_OUTPUT.
--- /dev/null   2005-05-02 20:50:19.000000000 +0100
+++ 
{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-27
   2005-05-02 20:45:06.000000000 +0100
@@ -0,0 +1,15 @@
+Revision: libtool--gary--1.0--patch-27
+Archive: address@hidden
+Creator: Gary V. Vaughan <address@hidden>
+Date: Mon May  2 20:43:48 BST 2005
+Standard-date: 2005-05-02 19:43:48 GMT
+New-files: tests/.arch-ids/early-libtool.at.id
+    tests/early-libtool.at
+Modified-files: ChangeLog libltdl/m4/libtool.m4
+New-patches: address@hidden/libtool--gary--1.0--patch-27
+Summary: fix Ralf's nits for patch-26
+Keywords:
+
+* tests/early-libtool.at: Forgot to add this file.
+* libltdl/m4/libtool.m4 (CONFIG_LT): Shell quoted.
+(LT_OUTPUT): tabified.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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