From c4e30f595b0c62a8060fc5278cd9a7d70cdca169 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 8 Jan 2004 10:34:52 +0000 Subject: [PATCH] * 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. * m4/ltsugar.m4: Add a serial number. --- ChangeLog | 26 ++++++++++++++++++ Makefile.am | 19 +++++++------ libtoolize.in | 76 ++++++++++++++++++++++++++++++--------------------- m4/ltsugar.m4 | 1 + 4 files changed, 82 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index acb8f7990..54d5eca16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2004-01-07 Gary V. Vaughan + + * 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. + * m4/ltsugar.m4: Add a serial number. + 2004-01-07 Gary V. Vaughan A complete rewrite of the m4 code involved in the generation of diff --git a/Makefile.am b/Makefile.am index 7a7e49155..f2ab94d54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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_MAKEFILE_LIST) 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: diff --git a/libtoolize.in b/libtoolize.in index 357fe039b..a1a6c0cb4 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -2,7 +2,7 @@ # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ # Written by Gary V. Vaughan -# 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 prefix=@prefix@ datadir=@datadir@ pkgdatadir=@pkgdatadir@ -aclocaldir=@aclocaldir@ +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 } diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index 10c263ba1..c0f31aa63 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 @@ -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])]) -- 2.47.2