libtool-patches
[Top][All Lists]
Advanced

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

304-gary-add-libtool-macro-file-serial-tags.diff


From: Gary V. Vaughan
Subject: 304-gary-add-libtool-macro-file-serial-tags.diff
Date: Thu, 27 Oct 2005 14:37:35 +0100
User-agent: quilt/0.42-1

I believe this to be the correct fix for the bug uncovered by your
test with openMPI.  I've also added a new test batch to save us from
regressing later.

Okay to commit?  (This is now at the front of my queue btw)

 libltdl/m4/argz.m4      |    2 
 libltdl/m4/ltoptions.m4 |    2 
 libltdl/m4/ltsugar.m4   |    2 
 libltdl/m4/ltversion.in |    2 
 libtoolize.m4sh         |   39 +++++++++++---
 tests/libtoolize.at     |  131 +++++++++++++++++++++++++++++++++++++++++++-----
 6 files changed, 155 insertions(+), 23 deletions(-)

Index: libtool--devo--1.0/ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * libltdl/m4/argz.m4, libltdl/m4/ltoptions.m4, libltdl/ltsugar.m4,
        libltdl/m4/ltversion.in: Add serial number tags, and bump serial
        number.
        * libtoolize.m4sh: Use the tags to locate the correct serial
        numbers when deciding whether to update.
        * tests/libtoolize.at: More tests for old-style verbatim copying
        of macros into aclocal.m4.
        (func_serial): Allow for macro_regex argument to be originating
        file name.
        (func_serial_update): Use NL2SP to flatten list of extracted
        m4_include files.
        (func_check_macros): In test mode ($_lt_pkgdatadir is set), output
        a hardcoded string that the testsuite can match regardless of the
        location of the build tree.
        (#Main#): Handle argz.m4 specially like ltdl.m4, so that it isn't
        copied unless libltdl is being used.  Copy other macro files
        according to their tagged serial numbers.
Index: libtool--devo--1.0/libltdl/m4/argz.m4
===================================================================
--- libtool--devo--1.0.orig/libltdl/m4/argz.m4
+++ libtool--devo--1.0/libltdl/m4/argz.m4
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3 argz.m4
 
 AC_DEFUN([gl_FUNC_ARGZ],
 [gl_PREREQ_ARGZ
Index: libtool--devo--1.0/libltdl/m4/ltoptions.m4
===================================================================
--- libtool--devo--1.0.orig/libltdl/m4/ltoptions.m4
+++ libtool--devo--1.0/libltdl/m4/ltoptions.m4
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
Index: libtool--devo--1.0/libltdl/m4/ltsugar.m4
===================================================================
--- libtool--devo--1.0.orig/libltdl/m4/ltsugar.m4
+++ libtool--devo--1.0/libltdl/m4/ltsugar.m4
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
Index: libtool--devo--1.0/libltdl/m4/ltversion.in
===================================================================
--- libtool--devo--1.0.orig/libltdl/m4/ltversion.in
+++ libtool--devo--1.0/libltdl/m4/ltversion.in
@@ -9,7 +9,7 @@
 
 # @configure_input@
 
-# serial @MACRO_SERIAL@
+# serial @MACRO_SERIAL@ ltversion.m4
 # This file is part of GNU Libtool
 
 m4_define([LT_PACKAGE_VERSION], address@hidden@])
Index: libtool--devo--1.0/libtoolize.m4sh
===================================================================
--- libtool--devo--1.0.orig/libtoolize.m4sh
+++ libtool--devo--1.0/libtoolize.m4sh
@@ -566,6 +566,8 @@ func_serial ()
     my_serial=
     for my_file in `func_included_files "$my_filename"`; do
       if test -z "$my_macro_regex" ||
+         test "$my_filename" = aclocal.m4 ||
+         test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
          func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
       then
         my_serial=`$SED -e "$my_sed_serial" "$my_file"`
@@ -716,8 +718,15 @@ func_serial_update ()
     # it has `m4_include([DESTFILE])', so the copy effectively already
     # updated `aclocal.m4'.
     my_included_files=`func_included_files aclocal.m4`
-    case `echo " "$my_included_files" "` in
+    case `echo " "$my_included_files" " | $NL2SP` in
+
+      # Skip included files:
       *" $my_destfile "*) ;;
+
+      # Otherwise compare to aclocal.m4 serial number (func_serial
+      # returns 0 for older macro serial numbers before we provided
+      # serial tags, so the update message will be correctly given
+      # if aclocal.m4 contains an untagged --i.e older-- macro file):
       *)
         if test -f aclocal.m4; then
           func_serial_max \
@@ -851,7 +860,9 @@ func_check_macros ()
        func_echo "and rerunning libtoolize."
       fi
     elif test -z "$m4dir"; then
-      if test "$ltdldir/m4" != "$m4dir"; then
+      if test -n "$_lt_pkgdatadir"; then
+       acmacrodir="\$_lt_pkgdatadir"
+      elif $opt_ltdl && test "$ltdldir/m4" != "$m4dir"; then
        acmacrodir="$ltdldir/m4"
       else
        acmacrodir="$aclocaldir"
@@ -1040,8 +1051,8 @@ func_nonemptydir_p ()
   func_massage_pkgltdl_files "$glob_exclude_pkgltdl_files"
   func_massage_pkgconfig_files
 
-  # libtool.m4 and ltdl.m4 are handled specially below
-  func_massage_aclocal_DATA 'libtool.m4|ltdl.m4'
+  # argz.m4, libtool.m4 and ltdl.m4 are handled specially below
+  func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
 
   glob_exclude_pkgaux_files='config.guess|config.sub|install-sh|ltmain.sh'
 
@@ -1060,7 +1071,7 @@ func_nonemptydir_p ()
     # Unless we share CONFIG_MACRO_DIR with our parent project,
     # copy macros here.
     if test "$ltdldir/m4" != "$m4dir"; then
-      func_copy_some_files "$pkgmacro_files:libtool.m4:ltdl.m4" \
+      func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
         "$aclocaldir" "$ltdldir/m4"
     fi
 
@@ -1088,10 +1099,17 @@ func_nonemptydir_p ()
     func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool 
auxilliary files."
   fi
 
-  # Copy libtool's m4 macros to the macro directory, if they are newer.
+  # Copy libtool's m4 macros to the macro directory, if they are newer
+  # (keep these in alphabetical order to maintain sanity in testsuite):
   if test -n "$m4dir"; then
     $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
 
+    if $seen_ltdl; then
+      func_serial_update argz.m4 "$aclocaldir" "$m4dir" argz.m4
+    else
+      func_verbose "Not copying \`$m4dir/argz.m4', libltdl not used."
+    fi
+
     func_serial_update  libtool.m4 "$aclocaldir" "$m4dir" \
       LT_INIT 'A[[CM]]_PROG_LIBTOOL'
 
@@ -1101,8 +1119,13 @@ func_nonemptydir_p ()
       func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
     fi
 
-    func_copy_some_files "$pkgmacro_files" "$aclocaldir" \
-      "$m4dir" func_serial_update
+    my_save_IFS="$IFS"
+    IFS=:
+    for file in $pkgmacro_files; do
+      IFS="$my_save_IFS"
+      func_serial_update $file "$aclocaldir" "$m4dir" "$file"
+    done
+    IFS="$my_save_IFS"
   fi
 
   $opt_quiet || func_check_macros
Index: libtool--devo--1.0/tests/libtoolize.at
===================================================================
--- libtool--devo--1.0.orig/tests/libtoolize.at
+++ libtool--devo--1.0/tests/libtoolize.at
@@ -46,7 +46,7 @@ AT_DATA([m4/libtool.m4], [[
 # This file has a very high serial number, and should be left unchanged
 # until --force is passed.
 AT_DATA([m4/ltoptions.m4], [[
-# serial 99999
+# serial 99999 ltoptions.m4
 ]])
 
 test -d config || { rm -f config && mkdir config; }
@@ -77,7 +77,6 @@ AT_DATA(expout,
 libtoolize: copying file `config/ltmain.sh'
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: copying file `m4/libtool.m4'
-libtoolize: copying file `m4/argz.m4'
 libtoolize: copying file `m4/ltoptions.m4'
 libtoolize: copying file `m4/ltsugar.m4'
 libtoolize: copying file `m4/ltversion.m4'
@@ -106,7 +105,6 @@ AT_DATA(expout,
 [[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: copying file `m4/libtool.m4'
-libtoolize: copying file `m4/argz.m4'
 libtoolize: copying file `m4/ltsugar.m4'
 libtoolize: copying file `m4/ltversion.m4'
 ]])
@@ -127,7 +125,6 @@ AT_DATA(expout,
 [[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/argz.m4' is already up to date.
 libtoolize: `m4/ltsugar.m4' is already up to date.
 libtoolize: `m4/ltversion.m4' is already up to date.
 ]])
@@ -149,7 +146,6 @@ AT_DATA(expout,
 libtoolize: copying file `config/ltmain.sh'
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: copying file `m4/libtool.m4'
-libtoolize: copying file `m4/argz.m4'
 libtoolize: copying file `m4/ltoptions.m4'
 libtoolize: copying file `m4/ltsugar.m4'
 libtoolize: copying file `m4/ltversion.m4'
@@ -167,7 +163,6 @@ AT_DATA(expout,
 libtoolize: `config/ltmain.sh' is already up to date.
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/argz.m4' is already up to date.
 libtoolize: `m4/ltoptions.m4' is already up to date.
 libtoolize: `m4/ltsugar.m4' is already up to date.
 libtoolize: `m4/ltversion.m4' is already up to date.
@@ -200,7 +195,6 @@ libtoolize: copying file `config/config.
 libtoolize: copying file `config/install-sh'
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: copying file `m4/libtool.m4'
-libtoolize: copying file `m4/argz.m4'
 libtoolize: copying file `m4/ltsugar.m4'
 libtoolize: copying file `m4/ltversion.m4'
 ]])
@@ -224,7 +218,6 @@ libtoolize: `config/config.sub' is alrea
 libtoolize: `config/install-sh' is already up to date.
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/argz.m4' is already up to date.
 libtoolize: `m4/ltsugar.m4' is already up to date.
 libtoolize: `m4/ltversion.m4' is already up to date.
 ]])
@@ -249,7 +242,6 @@ libtoolize: copying file `config/install
 libtoolize: copying file `config/ltmain.sh'
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: copying file `m4/libtool.m4'
-libtoolize: copying file `m4/argz.m4'
 libtoolize: copying file `m4/ltoptions.m4'
 libtoolize: copying file `m4/ltsugar.m4'
 libtoolize: copying file `m4/ltversion.m4'
@@ -270,7 +262,6 @@ libtoolize: `config/install-sh' is alrea
 libtoolize: `config/ltmain.sh' is already up to date.
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
 libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/argz.m4' is already up to date.
 libtoolize: `m4/ltoptions.m4' is already up to date.
 libtoolize: `m4/ltsugar.m4' is already up to date.
 libtoolize: `m4/ltversion.m4' is already up to date.
@@ -339,9 +330,9 @@ libtoolize: linking file `ltdl/config/in
 libtoolize: linking file `ltdl/config/missing'
 libtoolize: linking file `ltdl/config/ltmain.sh'
 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
+libtoolize: linking file `ltdl/m4/argz.m4'
 libtoolize: linking file `ltdl/m4/libtool.m4'
 libtoolize: linking file `ltdl/m4/ltdl.m4'
-libtoolize: linking file `ltdl/m4/argz.m4'
 libtoolize: linking file `ltdl/m4/ltoptions.m4'
 libtoolize: linking file `ltdl/m4/ltsugar.m4'
 libtoolize: linking file `ltdl/m4/ltversion.m4'
@@ -350,3 +341,121 @@ libtoolize: linking file `ltdl/m4/ltvers
 LT_AT_CHECK_LIBTOOLIZE([--ltdl], 0, expout)
 
 AT_CLEANUP
+
+
+## ------------------------------------------------------ ##
+## Creating an aclocal.m4 without in-tree libtool macros. ##
+## ------------------------------------------------------ ##
+
+AT_SETUP([upgrading verbatim style aclocal.m4])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([config])
+LT_INIT
+AC_OUTPUT
+]])
+
+AT_DATA([expout],
+[[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
+libtoolize: copying file `config/ltmain.sh'
+libtoolize: You should add the contents of the following files to `aclocal.m4':
+libtoolize:   `$_lt_pkgdatadir/libtool.m4'
+libtoolize:   `$_lt_pkgdatadir/ltoptions.m4'
+libtoolize:   `$_lt_pkgdatadir/ltversion.m4'
+libtoolize:   `$_lt_pkgdatadir/ltsugar.m4'
+libtoolize: or else add `AC_CONFIG_MACRO_DIR([$_lt_pkgdatadir])' to 
configure.ac.
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
+
+
+## --------------------------------------- ##
+## Upgrading a hand maintained aclocal.m4. ##
+## --------------------------------------- ##
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_MACRO_DIR([m4])
+LT_INIT
+AC_OUTPUT
+]])
+
+AT_DATA([aclocal.m4],
+[[# This should need upgrading:
+# serial 25 LT_INIT
+AC_DEFUN([LT_INIT],
+[blah])
+
+# This is newer than the upgrade version:
+# serial 99999 ltoptions.m4
+
+# This is older than the upgrade version:
+# serial 1 ltversion.m4
+]])
+
+AT_DATA([expout],
+[[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
+libtoolize: `config/ltmain.sh' is already up to date.
+libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+libtoolize: copying file `m4/libtool.m4'
+libtoolize: copying file `m4/ltoptions.m4'
+libtoolize: copying file `m4/ltsugar.m4'
+libtoolize: You should add the contents of `m4/ltsugar.m4' to `aclocal.m4'.
+libtoolize: copying file `m4/ltversion.m4'
+libtoolize: You should add the contents of `m4/ltversion.m4' to `aclocal.m4'.
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
+
+
+## ------------------------------------------- ##
+## Upgrading an aclocal maintained aclocal.m4. ##
+## ------------------------------------------- ##
+
+LT_AT_ACLOCAL([-I m4])
+
+# This file should be upgraded.
+AT_DATA([m4/libtool.m4], [[
+# serial 25 LT_INIT
+AC_DEFUN([LT_INIT])
+]])
+
+# This file has a very high serial number, and should be left unchanged.
+AT_DATA([m4/ltoptions.m4], [[
+# serial 99999 ltoptions.m4
+]])
+
+AT_DATA([expout],
+[[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
+libtoolize: `config/ltmain.sh' is already up to date.
+libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+libtoolize: copying file `m4/libtool.m4'
+libtoolize: `m4/ltsugar.m4' is already up to date.
+libtoolize: `m4/ltversion.m4' is already up to date.
+]])
+
+AT_DATA([experr],
+[[libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout, experr)
+
+## ----------------------------------------------------------- ##
+## Now, a forced update to downgrade files with newer serials. ##
+## ----------------------------------------------------------- ##
+
+AT_DATA(expout,
+[[libtoolize: putting files in AC_CONFIG_AUX_DIR, `config'.
+libtoolize: copying file `config/ltmain.sh'
+libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+libtoolize: copying file `m4/libtool.m4'
+libtoolize: copying file `m4/ltoptions.m4'
+libtoolize: copying file `m4/ltsugar.m4'
+libtoolize: copying file `m4/ltversion.m4'
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
+
+AT_CLEANUP

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




reply via email to

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