libtool-patches
[Top][All Lists]
Advanced

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

Re: FYI: 333-gary-refactor-LTDL_INIT.patch


From: Ralf Wildenhues
Subject: Re: FYI: 333-gary-refactor-LTDL_INIT.patch
Date: Wed, 16 Jan 2008 20:37:56 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

When the user copies the libtool macros into aclocal.m4 (which is
discouraged but something we support), the 333 patch causes a nice
failure in a third-party package:

> [Running] /tmp/libtool/install/libtool-2.1/bin/libtoolize --automake --copy
> /tmp/libtool/install/libtool-2.1/bin/libtoolize: eval: line 991: syntax error 
> near unexpected token `[$0],'
> /tmp/libtool/install/libtool-2.1/bin/libtoolize: eval: line 991: 
> `AC_BEFORE([$0], [LTDL_INIT])dnl seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> seen_libtool=: seen_libtool=: seen_libtool=: seen_libtool=: 
> LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], LT_OPTION_DEFINE([LTDL_INIT], 
> [recursive], LT_OPTION_DEFINE([LTDL_INIT], [subproject], 
> LT_OPTION_DEFINE([LTDL_INIT], [installable], LT_OPTION_DEFINE([LTDL_INIT], 
> [convenience], auxdir=confdb seen_libtool=:'

because libtoolize wrongly recognizes code from libtool macro files,
such as
  [_LT_SET_OPTION([LT_INIT], [shared])

or
  LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],

as being user calls to setup libtool.  OK to apply this patch to fix it
and some other cases?  I realize that this is still a bit fragile when
Libtool evolves (really only m4 can parse m4), which is why I'm adding a
testcase, too.

Cheers,
Ralf

2008-01-16  Ralf Wildenhues  <address@hidden>

        * libtoolize.m4sh (func_scan_files): Avoid matching our own
        macro code when scanning configure.ac and aclocal.m4.
        Don't produce spurious output if AC_PROG_RANLIB is found.
        * tests/old-m4-iface.at (AM_PROG_LIBTOOL): Add a (weak) check
        that we don't match our own macro code when searching for user
        code calling us.

Index: libtoolize.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.m4sh,v
retrieving revision 1.64
diff -u -r1.64 libtoolize.m4sh
--- libtoolize.m4sh     6 Jan 2008 16:33:30 -0000       1.64
+++ libtoolize.m4sh     16 Jan 2008 19:28:21 -0000
@@ -418,14 +418,18 @@
            s,^.*LT_CONFIG_LTDL_DIR([[   ]*\([^])]*\).*$,ac_ltdldir=\1,
            p
        }
+       /\@<:@A[CM]_PROG_LIBTOOL/d
        /A[CM]_PROG_LIBTOOL/ {
            s,^.*$,seen_libtool=:,
            p
        }
+       /the.*option into.*LT_INIT.*parameter/d
+       /\@<:@LT_INIT/d
        /LT_INIT/                {
            s,^.*$,seen_libtool=:,
            p
        }
+       /\@<:@LTDL_INIT/d
        /LTDL_INIT/          {
            s,^.*LTDL_INIT([[   ]*\([^])]*\).*$,ltdl_options="\1",
            s,^.*LTDL_INIT[     ]*$,seen_ltdl=:,
@@ -960,7 +964,7 @@
     else
       # Don't trace for this, we're just checking the user didn't invoke it
       # directly from configure.ac.
-      $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB &&
+      $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB 
>/dev/null &&
         func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'"
     fi
 
Index: tests/old-m4-iface.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/old-m4-iface.at,v
retrieving revision 1.14
diff -u -r1.14 old-m4-iface.at
--- tests/old-m4-iface.at       12 Jan 2008 14:07:02 -0000      1.14
+++ tests/old-m4-iface.at       16 Jan 2008 19:34:28 -0000
@@ -86,6 +86,17 @@
 
 LT_AT_EXEC_CHECK([./old], 0, [Hello, World!])
 
+# Now, test that libtoolize doesn't mistakenly think the user called
+# any libtool macros if in fact she didn't.
+sed '/AM_PROG_LIBTOOL/d' configure.in >configure.int
+mv -f configure.int configure.in
+AT_CHECK([$LIBTOOLIZE -n], [0], [stdout], [stderr])
+# ensure no shell errors:
+AT_CHECK([grep -v "^libtoolize: " stderr], [1])
+AT_CHECK([grep "Remember to add.*LT_INIT.*to configure.in" stdout], [0], 
[ignore])
+AT_CHECK([grep "Consider adding.*LT_WITH_LTDL" stdout], [1])
+AT_CHECK([grep "Remember to add.*LT_CONFIG_LTDL_DIR" stdout], [1])
+
 AT_CLEANUP
 
 




reply via email to

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