libtool-patches
[Top][All Lists]
Advanced

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

FYI: Fix LT_WITH_LTDL: AU_ALIAS bug


From: Ralf Wildenhues
Subject: FYI: Fix LT_WITH_LTDL: AU_ALIAS bug
Date: Mon, 12 Sep 2005 13:21:46 +0200
User-agent: Mutt/1.4.1i

Hi Gary,

* Gary V. Vaughan wrote on Sat, Sep 10, 2005 at 05:17:52PM CEST:
> Ralf Wildenhues wrote:
> > Hunting down bugs in m4 macros sucks.  Using $# in macros sucks, too.
> 
> :-(  Can you document in HACKING that because of our use of AU_ALIAS to
> maintain backwards compatibility with earlier libtool interfaces we must
> not use $# in m4.

Done.  Strictly speaking, we should only avoid it in public macros, but
it may be a good idea to avoid it completely.

> Also, we could do with an m4.test to catch violations of our m4 style
> guidelines -- much as we have sh.test to catch shell style violations.
> Can you add a TODO item for that too please?

Done.

> > First: LT_WITH_LTDL needs to be documented correctly.  Its predecessor
> > AC_WITH_LTDL needed documentation as well.  I accept patches.  :)
> 
> I've been working on this for almost 2 weeks now.  The whole thing is
> almost hopelessly broken.  Now that I've started using quilt I'll start
> posting the patches in small bits as soon as I have the damn thing
> working.

Hmm.  If you can elaborate about the issues, maybe we can help..

> > so I would like to apply this patch, which uses
> > m4_default instead.  OK for HEAD?
> 
> Okay.

Thanks.  Applied both proposed patches and your proposed changes as
shown below.

Cheers,
Ralf

        * libltdl/m4/ltdl.m4 (LT_WITH_LTDL, LTDL_CONVENIENCE)
        (LTDL_INSTALLABLE): Use less quoting for expanded LIBLTDL,
        LTDLINCL.  Use m4_default instead of m4_if, to work
        around AU_ALIAS bug with empty macro arguments.
        (LTDL_INIT): Likewise.
        * libltdl/m4/ltoptions.m4 (_LT_WITH_PIC): Likewise.
        * TODO, HACKING: Updated.

Index: HACKING
===================================================================
RCS file: /cvsroot/libtool/libtool/HACKING,v
retrieving revision 1.18
diff -u -r1.18 HACKING
--- HACKING     8 Aug 2005 06:47:42 -0000       1.18
+++ HACKING     12 Sep 2005 10:20:40 -0000
@@ -241,6 +241,9 @@
    $ECHO ".."          for strings without leading hyphen,
    $ECHO "X.." | $Xsed otherwise.
 
+* Do not use the number of macro arguments `$#' in public macros;
+  AU_ALIAS may change it.
+
 
 9. Abstraction layers in libltdl
 ================================
Index: TODO
===================================================================
RCS file: /cvsroot/libtool/libtool/TODO,v
retrieving revision 1.69
diff -u -r1.69 TODO
--- TODO        18 Aug 2005 09:51:57 -0000      1.69
+++ TODO        12 Sep 2005 10:20:41 -0000
@@ -76,6 +76,9 @@
 * Look at better -no-undefined support, maybe along the idea of
   [support #103719] for CC.
 
+* Check dangerous use of the number of macro arguments `$#' in public macros
+  (because of AU_ALIAS).
+
 
 1.2. libtldl
 ------------
Index: libltdl/m4/ltdl.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/ltdl.m4,v
retrieving revision 1.6
diff -u -r1.6 ltdl.m4
--- libltdl/m4/ltdl.m4  29 Aug 2005 10:47:41 -0000      1.6
+++ libltdl/m4/ltdl.m4  12 Sep 2005 10:20:41 -0000
@@ -33,7 +33,7 @@
 if test "x$enable_ltdl_install" != xyes; then
   # If the user did not specify an installable libltdl, then default
   # to a convenience lib.
-  LTDL_CONVENIENCE([$1])
+  LTDL_CONVENIENCE(m4_default([$1], [libltdl]))
 fi
 
 if test "x$with_included_ltdl" = xno; then
@@ -48,7 +48,7 @@
 AC_MSG_CHECKING([whether to use included libltdl])
 AC_MSG_RESULT([$with_included_ltdl])
 
-AC_CONFIG_SUBDIRS(m4_if($#, 1, [$1], [libltdl]))
+AC_CONFIG_SUBDIRS(m4_default([$1], [libltdl]))
 ])# LT_WITH_LTDL
 
 # Old name:
@@ -74,8 +74,8 @@
   "") enable_ltdl_convenience=yes
       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
   esac
-LIBLTDL='${top_builddir}/'m4_if($#, 1, [$1], ['libltdl'])/libltdlc.la
-LTDLINCL='-I${top_srcdir}/'m4_if($#, 1, [$1], ['libltdl'])
+LIBLTDL='${top_builddir}/'m4_default([$1], [libltdl])/libltdlc.la
+LTDLINCL='-I${top_srcdir}/'m4_default([$1], [libltdl])
 
 AC_SUBST([LIBLTDL])
 AC_SUBST([LTDLINCL])
@@ -114,8 +114,8 @@
   ])
 if test x"$enable_ltdl_install" = x"yes"; then
   ac_configure_args="$ac_configure_args --enable-ltdl-install"
-  LIBLTDL='${top_builddir}/'m4_if($#, 1, [$1], ['libltdl'])/libltdl.la
-  LTDLINCL='-I${top_srcdir}/'m4_if($#, 1, [$1], ['libltdl'])
+  LIBLTDL='${top_builddir}/'m4_default([$1], [libltdl])/libltdl.la
+  LTDLINCL='-I${top_srcdir}/'m4_default([$1], [libltdl])
 else
   ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
   LIBLTDL="-lltdl"
@@ -141,7 +141,7 @@
 # Perform all the checks necessary for compilation of the ltdl objects
 #  -- including compiler checks and header checks.
 AC_DEFUN([LTDL_INIT],
-[m4_if([$#], 1, [m4_divert_push([DEFAULTS])dnl
+[m4_ifval([$1], [m4_divert_push([DEFAULTS])dnl
 # libltdl will be built in the named DIRECTORY, relative to $top_builddir.
 lt_ltdl_dir='$1'
 m4_divert_pop([DEFAULTS])])dnl
Index: libltdl/m4/ltoptions.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/ltoptions.m4,v
retrieving revision 1.4
diff -u -r1.4 ltoptions.m4
--- libltdl/m4/ltoptions.m4     1 Sep 2005 11:41:26 -0000       1.4
+++ libltdl/m4/ltoptions.m4     12 Sep 2005 10:20:41 -0000
@@ -360,7 +360,7 @@
     [pic_mode="$withval"],
     [pic_mode=default])
 
-test -z "$pic_mode" && pic_mode=m4_if($#, 1, $1, default)
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
 
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC




reply via email to

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