libtool-patches
[Top][All Lists]
Advanced

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

Re: FYI: 68-gary-libtoolize-copy-all-macro-files.patch


From: Gary V. Vaughan
Subject: Re: FYI: 68-gary-libtoolize-copy-all-macro-files.patch
Date: Wed, 07 Jan 2004 15:44:49 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This patch (which I actually attached this time :-b) supercedes
66-gary-libtool-macros-in-share-libtool.patch.

Okay to apply?

Cheers,
~    Gary.
- --
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://www.oranda.demon.co.uk
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE//ClxFRMICSmD1gYRApbQAJ9xJjCUxy3kEs2XWse14M497iauLQCgg236
loiysKV3tke2s4m5mg3V8CM=
=N//G
-----END PGP SIGNATURE-----
Index: ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * Makefile.am (aclocal_macros, aclocal_DATA): Removed.
        (EXTRA_DIST): Remove m4 macro files; they are automatically
        added by automake.
        (pkgmacrodir): Where to install libtool macro files.
        (pkgmacro_DATA): List installable libtool macro files.
        (install-data-local): Remove previous versions of ltdl.m4 and
        libtool.m4 from their old location.
        * libtoolize.in: Use new pkgmacrodir installed macros when
        libtoolizing a project.  Treat libtool.m4 and ltdl.m4 specially,
        and func_serial_update() any other files from pkgmacrodir.
        (pkgmacrodir): Where to find installed libtool macro files.
        (aclocaldir): Removed.
        (func_copy_all_files): Add an optional callback parameter to
        control how files are copied.  If the callback is passed, don't
        tell it whether it can copy or not.
        (func_serial): Exchange parameters and make macro_regex optional,
        so that this function can be used to extract serial numbers from
        files with the traditional /^# serial [1-9][0-9]*$/ syntax.
        Changed all callers.
        (func_serial_update): Make macro_regex optional last parameter, so
        that this function can be used as a callback for
        func_copy_all_files().  Changed all callers.

2004-01-07  Gary V. Vaughan  <address@hidden>

Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.92
diff -u -p -u -r1.92 Makefile.am
--- Makefile.am 7 Jan 2004 12:26:24 -0000 1.92
+++ Makefile.am 7 Jan 2004 15:25:25 -0000
@@ -23,20 +23,18 @@ BUILD_SUBDIRS = . libltdl doc tests
 SUBDIRS = $(BUILD_SUBDIRS)
 DIST_SUBDIRS = $(BUILD_SUBDIRS)
 
-aclocal_macros = m4/ltsugar.m4 m4/libtool.m4 m4/ltdl.m4
-
-EXTRA_DIST = $(aclocal_macros) bootstrap libtoolize.in ltmain.in \
-       config/mkstamp stamp-vcl ChangeLog.1996 ChangeLog.1997 \
-       ChangeLog.1998 ChangeLog.1999 ChangeLog.2000 ChangeLog.2001 \
-       ChangeLog.2002
+EXTRA_DIST = bootstrap libtoolize.in ltmain.in config/mkstamp stamp-vcl \
+       ChangeLog.1996 ChangeLog.1997 ChangeLog.1998 ChangeLog.1999 \
+       ChangeLog.2000 ChangeLog.2001 ChangeLog.2002 ChangeLog.2003
 CLEANFILES = libtool libtoolize ltmain.shT
 
 # These are required by libtoolize.
 pkgdata_SCRIPTS = config/config.guess config/config.sub
 pkgdata_DATA = config/ltmain.sh
 
-# This macro file should be visible to Automake's aclocal.
-aclocal_DATA = $(aclocal_macros)
+# Me maintain our own macros to provent problems with ancient definitions.
+pkgmacrodir = $(pkgdatadir)/m4
+pkgmacro_DATA = m4/libtool.m4 m4/ltdl.m4 m4/ltsugar.m4
 
 # The standalone libtool script, and the libtool distributor.
 bin_SCRIPTS = libtool libtoolize
@@ -75,9 +73,12 @@ configure-subdirs distdir: $(DIST_MAKEFI
        abs_srcdir=`cd $(top_srcdir) && pwd`; \
        (cd $$dir && $$abs_srcdir/$$dir/configure) || exit 1
 
-# Don't install over the top of an old pkgdatadir
 install-data-local:
+## Don't install over the top of an old pkgdatadir
        -rm -rf $(DESTDIR)$(pkgdatadir)
+## Remove old macro definitions
+       -rm -rf $(DESTDIR)$(aclocaldir)/ltdl.m4
+       -rm -rf $(DESTDIR)$(aclocaldir)/libtool.m4
 
 # Create and install libltdl
 install-data-hook:
Index: libtoolize.in
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.in,v
retrieving revision 1.33
diff -u -p -u -r1.33 libtoolize.in
--- libtoolize.in 7 Jan 2004 03:50:33 -0000 1.33
+++ libtoolize.in 7 Jan 2004 15:25:25 -0000
@@ -2,7 +2,7 @@
 # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
 # Written by Gary V. Vaughan <address@hidden>
 
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -76,12 +76,10 @@ exit_status=0
 address@hidden@
 address@hidden@
 address@hidden@
address@hidden@
+pkgmacrodir="$pkgdatadir/m4"
 auxdir=
 m4dir=
 configure_ac=configure.in
-libtool_m4="$aclocaldir/libtool.m4"
-ltdl_m4="$aclocaldir/ltdl.m4"
 
 sed_dirname='s,/[^/]*$,,'
 
@@ -226,15 +224,19 @@ func_copy ()
     return $my_return_status
 }
 
-# func_copy_all_files srcdir destdir [glob_exclude]
-# For each file in SRCDIR, if option `--copy' was specified, or soft-linking
-# the file to DESTDIR fails, then try to copy the file to DESTDIR.  If
-# GLOB_EXCLUDE is given, exclude any matching filenames from the copy.
+# func_copy_all_files srcdir destdir [glob_exclude] [copy_cb=func_copy]
+# For each file in SRCDIR, then try to copy the file to DESTDIR by calling
+# COPY_CB with the src and dest files.  If GLOB_EXCLUDE is given, exclude
+# any matching filenames from the copy.  If COPY_CB is passed, then the
+# check for overwriting without force_opt is the callbacks responsibility:
+# This allows using callbacks like func_serial_update, which perform their
+# own checks to decide whether to overwrite the dest file.
 func_copy_all_files ()
 {
     my_srcdir="$1"
     my_destdir="$2"
     my_glob_exclude="$3"
+    my_copy_cb=${4-func_copy}
 
     for my_filename in `cd "$my_srcdir" && ls`; do
 
@@ -244,17 +246,19 @@ func_copy_all_files ()
       fi
 
       if test -f "$my_srcdir/$my_filename"; then
-       $force_opt || if test -f "$my_destdir/$my_filename"; then
-          $quiet_opt \
-           || func_error "\`$my_destdir/$my_filename' exists: use \`--force' 
to overwrite"
-         continue
+        if test "x$my_copy_cb" = xfunc_copy; then
+         $force_opt || if test -f "$my_destdir/$my_filename"; then
+           $quiet_opt \
+             || func_error "\`$my_destdir/$my_filename' exists: use \`--force' 
to overwrite"
+           continue
+         fi
         fi
       else
         # Not a regular file
         continue
       fi
 
-      func_copy "$my_srcdir/$my_filename" "$my_destdir/$my_filename"
+      $my_copy_cb "$my_srcdir/$my_filename" "$my_destdir/$my_filename"
     done
 }
 
@@ -391,15 +395,15 @@ func_included_files ()
     done
 }
 
-# func_serial macro_regex filename
+# func_serial filename [macro_regex]
 # Output the value of the serial number comment in FILENAME, where the
-# comment line must also match MACRO_REGEX.
+# comment line must also match MACRO_REGEX, if given.
 func_serial ()
 {
-    my_macro_regex="$1"
-    my_filename="$2"
-    my_sed_serial='/^# serial [1-9][0-9]* '"$my_macro_regex"'[         ]*$/ {
-         s,^# serial \([1-9][0-9]*\) .*$,\1,; q;
+    my_filename="$1"
+    my_macro_regex="$2"
+    my_sed_serial='/^# serial [1-9][0-9]*[     ]*'"$my_macro_regex"'[  ]*$/ {
+         s,^# serial \([1-9][0-9]*\).*$,\1,; q;
        }; d'
 
     # Search FILENAME and all the files it m4_includes for a serial number
@@ -418,21 +422,22 @@ func_serial ()
     echo $my_serial
 }
 
-# func_serial_update macro_regex srcfile destfile
+# func_serial_update srcfile destfile [macro_regex]
 # Copy SRCFILE to DESTFILE provided SRCFILE has a newer serial number, or
-# DESTFILE does not yet exist, or the user specified `--force'.
+# DESTFILE does not yet exist, or the user specified `--force'.  If given,
+# MACRO_REGEX must match any text after "# serial N" in the both files.
 func_serial_update ()
 {
-    my_macro_regex="$1"
-    my_srcfile="$2"
-    my_destfile="$3"
+    my_srcfile="$1"
+    my_destfile="$2"
+    my_macro_regex="$3"
 
     my_return_status=1
     my_update_p=:
 
     if test -f "$my_destfile"; then
-      my_src_serial=`func_serial "$my_macro_regex" "$my_srcfile"`
-      my_dest_serial=`func_serial "$my_macro_regex" "$my_destfile"`
+      my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
+      my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
 
       test "$my_src_serial" -eq 0 && {
         func_error "warning: no serial number on \`$my_srcfile', not copying."
@@ -464,7 +469,7 @@ func_serial_update ()
     # it has `m4_include([DESTFILE])', so the copy effectively already
     # updated `aclocal.m4'.
     $use_aclocal || if test -f aclocal.m4; then
-      test "$my_src_serial" -gt `func_serial "$my_macro_regex" aclocal.m4` \
+      test "$my_src_serial" -gt `func_serial aclocal.m4 "$my_macro_regex"` \
          && func_echo "You should add the contents of \'$my_destfile' to 
\`aclocal.m4'."
     fi
 
@@ -548,6 +553,9 @@ func_config_update ()
 {
   rerun_aclocal=false
 
+  re_pkgaux_files='config\.guess|config\.sub|ltmain\.sh'
+  re_pkgmacro_files='libtool\.m4|ltdl\.m4'
+
   func_scan_files
   $quiet_opt || func_check_macros
 
@@ -576,7 +584,7 @@ func_config_update ()
     func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
   fi
   if $install_opt || $force_opt; then
-    func_copy_all_files "$pkgdatadir" "$auxdir" 
'config.guess|config.sub|ltmain.sh'
+    func_copy_all_files "$pkgdatadir" "$auxdir" "$re_pkgaux_files"
     func_config_update "$pkgdatadir/config.guess" "$auxdir/config.guess"
     test -f "$pkgdatadir/config.sub" \
       && func_config_update "$pkgdatadir/config.sub" "$auxdir/config.sub"
@@ -587,12 +595,18 @@ func_config_update ()
   $quiet_opt || if test "$m4dir" != .; then
     func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
   fi
-  func_serial_update 'A[CM]_PROG_LIBTOOL' "$aclocaldir/libtool.m4" 
"$m4dir/libtool.m4"
+
+  libtool_m4="$pkgmacrodir/libtool.m4"
+  ltdl_m4="$pkgmacrodir/ltdl.m4"
+
+  func_copy_all_files "$pkgmacrodir" "$m4dir" \
+      "$re_pkgmacro_files" func_serial_update
+  func_serial_update  "$libtool_m4" "$m4dir/libtool.m4" 'A[CM]_PROG_LIBTOOL'
 
   if $seen_ltdl; then
-    func_serial_update 'AC_LIB_LTDL' "$aclocaldir/ltdl.m4" "$m4dir/ltdl.m4"
+    func_serial_update "$ltdl_m4" "$m4dir/ltdl.m4" 'AC_LIB_LTDL'
   else
-    func_verbose "Not copying \`$aclocaldir/ltdl.m4', AC_LIB_LTDL not used."
+    func_verbose "Not copying \`$ltdl_m4', AC_LIB_LTDL not used."
   fi
 }
 
Index: m4/ltsugar.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/ltsugar.m4,v
retrieving revision 1.1
diff -u -p -u -r1.1 ltsugar.m4
--- m4/ltsugar.m4 7 Jan 2004 12:26:25 -0000 1.1
+++ m4/ltsugar.m4 7 Jan 2004 15:25:25 -0000
@@ -22,6 +22,7 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# serial 1
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])

reply via email to

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