]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtoolize.m4sh: Use serial tags to locate the correct serial
authorGary V. Vaughan <gary@gnu.org>
Tue, 1 Nov 2005 14:28:20 +0000 (14:28 +0000)
committerGary V. Vaughan <gary@gnu.org>
Tue, 1 Nov 2005 14:28:20 +0000 (14:28 +0000)
numbers when deciding whether to update.
(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.
* tests/libtoolize.at: More tests for old-style verbatim copying
of macros into aclocal.m4.

ChangeLog
libtoolize.m4sh
tests/libtoolize.at

index 746e613a070e2a20031977d685c235f48ff0b76d..999721f9e7b4f3ebeab66d1d28978d5fe9373145 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-11-01  Gary V. Vaughan  <gary@gnu.org>
 
+       * libtoolize.m4sh: Use serial tags to locate the correct serial
+       numbers when deciding whether to update.
+       (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.
+       * tests/libtoolize.at: More tests for old-style verbatim copying
+       of macros into aclocal.m4.
+
        * libltdl/m4/argz.m4, libltdl/m4/ltoptions.m4, libltdl/ltsugar.m4,
        libltdl/m4/ltversion.in: Add serial number tags, and bump serial
        number.
index d8405ee452df5592101b4c7701203846b9c03f7e..fd0d7682c6e9d606fca0582b3f9ce8f979868172 100644 (file)
@@ -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,7 @@ func_check_macros ()
        func_echo "and rerunning libtoolize."
       fi
     elif test -z "$m4dir"; then
-      if test "$ltdldir/m4" != "$m4dir"; then
+      if $opt_ltdl && test "$ltdldir/m4" != "$m4dir"; then
        acmacrodir="$ltdldir/m4"
       else
        acmacrodir="$aclocaldir"
@@ -1101,8 +1110,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 9969c125670081754f4df2fd259507df9225d0e2..db0c3df790e9c294bddb6068c0e0225925d5f331 100644 (file)
@@ -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; }
@@ -350,3 +350,126 @@ libtoolize: linking file `ltdl/m4/ltversion.m4'
 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
+]])
+
+[cat >expout <<EOF
+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/libltdl/m4/libtool.m4'
+libtoolize:   \`$_lt_pkgdatadir/libltdl/m4/ltoptions.m4'
+libtoolize:   \`$_lt_pkgdatadir/libltdl/m4/ltversion.m4'
+libtoolize:   \`$_lt_pkgdatadir/libltdl/m4/ltsugar.m4'
+EOF]
+
+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/argz.m4'
+libtoolize: You should add the contents of `m4/argz.m4' to `aclocal.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/argz.m4' is already up to date.
+libtoolize: You should add the contents of `m4/argz.m4' to `aclocal.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/argz.m4'
+libtoolize: You should add the contents of `m4/argz.m4' to `aclocal.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