libtool-patches
[Top][All Lists]
Advanced

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

[patch 2/3] 305-gary-diagnose-hand-maintained-aclocal-updates.diff


From: Gary V. Vaughan
Subject: [patch 2/3] 305-gary-diagnose-hand-maintained-aclocal-updates.diff
Date: Tue, 01 Nov 2005 12:00:00 +0000
User-agent: quilt/0.42-1

Redone against HEAD, and split into 3 for ease of review :-)
Okay to commit?

Cheers,
        Gary.

 libtoolize.m4sh     |   22 +++++++--
 tests/libtoolize.at |  125 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 142 insertions(+), 5 deletions(-)

Index: libtool--devo--1.0/ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * 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.

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,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: 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; }
@@ -350,3 +350,126 @@ 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
+]])
+
+[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
-- 
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]