libtool-patches
[Top][All Lists]
Advanced

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

fix testsuite with support for -I in libtoolize [libtool--gary--1.0--pat


From: Gary V. Vaughan
Subject: fix testsuite with support for -I in libtoolize [libtool--gary--1.0--patch-61]
Date: Fri, 26 Nov 2004 11:14:50 +0000 (GMT)
User-agent: mailnotify/0.6

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

Okay to commit?

        Add a search path option to libtoolize so that we can run it from
        the testsuite without pulling in the last installed macros and
        ltdl sources:

        * libtoolize.m4sh:  Add a -I option to change libtoolize's search
        path for macro files, and libltdl master sources.
        (pkgvdatadir, pkgvmacrodir): Renamed...
        (pkgvdatadirs, pkgvmacrodirs): ...as they can now contain a ':'
        delimited list of directories.  Adjust all callers.
        (func_copy_all_from_path): New function to search a ':' delimited
        search path for a directory to copy.
        (func_serial_update, func_ltmain_update, func_config_update): New
        first parameter is a filename to search for.  srcdir parameter can
        now be a ':' delimited search path.  Adjust all callers.
        (func_copy_some_files): Ditto.
        Put srcfile_spec first in parameter list for consistency with
        other functions.  Adjust all callers.
        (func_copy_cb): func_copy adapter function to call func_copy
        correctly from func_copy_some_files.
        (func_filename_path_search): Return the full path to the first
        occurence of a named file found in a list of directories.
        * tests/testsuite.at (AT_LIBTOOLIZE): Factor out libtoolize calls,
        and set search path to find macros and libltdl source files from
        the source tree.
        (AT_CHECK_LIBTOOLIZE): Test it.
        (AT_BOOTSTRAP): Adjust.  Split out call to make.
        * tests/am-subdir.at: Call make explicitly.
        (Makefile.am): Fix typo in ACLOCAL_AMFLAGS,

- -- 
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
_________________________________________________________
This patch notification generated by tlaapply version 0.9
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFBpxApFRMICSmD1gYRAlDZAKDLshigG665MmH6YVsAfORzduA/iQCfSYs0
bGlVyZtNvc0IfdWUR31HEwM=
=9V6d
-----END PGP SIGNATURE-----
* looking for address@hidden/libtool--gary--1.0--patch-60 to compare with
* comparing to address@hidden/libtool--gary--1.0--patch-60
M  ChangeLog
M  libtoolize.m4sh
M  tests/am-subdir.at
M  tests/testsuite.at

* modified files

Index: Changelog
from  Gary V. Vaughan  <address@hidden>
        Add a search path option to libtoolize so that we can run it from
        the testsuite without pulling in the last installed macros and
        ltdl sources:

        * libtoolize.m4sh:  Add a -I option to change libtoolize's search
        path for macro files, and libltdl master sources.
        (pkgvdatadir, pkgvmacrodir): Renamed...
        (pkgvdatadirs, pkgvmacrodirs): ...as they can now contain a ':'
        delimited list of directories.  Adjust all callers.
        (func_copy_all_from_path): New function to search a ':' delimited
        search path for a directory to copy.
        (func_serial_update, func_ltmain_update, func_config_update): New
        first parameter is a filename to search for.  srcdir parameter can
        now be a ':' delimited search path.  Adjust all callers.
        (func_copy_some_files): Ditto.
        Put srcfile_spec first in parameter list for consistency with
        other functions.  Adjust all callers.
        (func_copy_cb): func_copy adapter function to call func_copy
        correctly from func_copy_some_files.
        (func_filename_path_search): Return the full path to the first
        occurence of a named file found in a list of directories.
        * tests/testsuite.at (AT_LIBTOOLIZE): Factor out libtoolize calls,
        and set search path to find macros and libltdl source files from
        the source tree.
        (AT_CHECK_LIBTOOLIZE): Test it.
        (AT_BOOTSTRAP): Adjust.  Split out call to make.
        * tests/am-subdir.at: Call make explicitly.
        (Makefile.am): Fix typo in ACLOCAL_AMFLAGS,

2004-11-24  Gary V. Vaughan  <address@hidden>

        Move most libltdl headers to libtldl/libltdl to allow
        * libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
--- orig/libtoolize.m4sh
+++ mod/libtoolize.m4sh
@@ -40,6 +40,7 @@
 # -f, --force           replace existing files
 # -i, --install         copy missing auxiliary files
 #     --ltdl[=DIR]      install libltdl in a subdirectory [default: libltdl]
+# -I DIR                search DIR for libtoolize master source files
 # -q, --quiet           work silently
 # -v, --verbose         verbosely report processing
 #     --version         print version information and exit
@@ -79,8 +80,8 @@
 # Locations for important files:
 address@hidden@
 address@hidden@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
 auxdir=
 m4dir=
 ltdldir=
@@ -135,6 +136,16 @@
                        fi
                        ;;
 
+      -I)              test "$#" = 0 && func_missing_arg $opt && break
+                       test -d "$1" \
+                         && pkgvdatadirs="`cd $1 && pwd`:$pkgvdatadirs"
+                       test -d "$1/m4" \
+                         && pkgvmacrodirs="`cd $1/m4 && pwd`:$pkgvmacrodirs"
+                       func_quote_for_eval "$1"
+                       libtoolize_flags="$libtoolize_flags -I 
$func_quote_for_eval_result"
+                       shift
+                       ;;
+
       --quiet|--automake|-q) # --automake is for 1.5 compatibility
                        opt_quiet=:
                        libtoolize_flags="${libtoolize_flags} --quiet"
@@ -145,7 +156,7 @@
                        ;;
 
       # Separate optargs to long options:
-      --ltdl=*)
+      --*=*)
                        arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
                        opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
                        set -- "$opt" "$arg" ${1+"$@"}
@@ -195,7 +206,46 @@
     return $my_return_status
 }
 
-# func_copy_all_files [-r] srcdir destdir [glob_exclude] [copy_cb=func_copy]
+
+# func_copy_cb filename srcdir destdir
+# A wrapper for func_copy that accepts arguments in the order
+# used by func_copy_all_files callbacks.
+func_copy_cb ()
+{
+    func_copy "$2/$1" "$3/$1"
+}
+
+
+# func_copy_all_from_path [-r] dirname srcpath destdir [glob_exclude]
+# Search each : delimited directory in SRCPATH for a directory named
+# DIRNAME.  Recursively copy the contents of the first match found
+# to DESTDIR.
+func_copy_all_from_path ()
+{
+    if test "X$1" = X-r; then
+      my_args=-r
+      shift
+    fi
+
+    my_dirname="$1"
+    my_srcpath="$2"
+    my_destdir="$3"
+    my_globexc="$4"
+
+    save_IFS="$IFS"; IFS=:
+    for myvdir in $my_srcpath; do
+      IFS="$save_IFS"
+      test "X$my_dirname" = X. || myvdir="$myvdir/$my_dirname"
+      if test -d "$myvdir"; then
+        eval func_copy_all_files $my_args "$myvdir" "$my_destdir" "$my_globexc"
+        break
+      fi
+    done
+    IFS="$save_IFS"
+}
+
+
+# func_copy_all_files [-r] srcdir destdir [glob_exclude] [copy_cb=func_copy_cb]
 # For each file in SRCDIR, then try to copy the file to DESTDIR by calling
 # COPY_CB with the src and dest files.  With the `-r' option, recurse into
 # subdirectories of srcdir too.  If GLOB_EXCLUDE is given, exclude any
@@ -214,7 +264,7 @@
     my_srcdir="$1"
     my_destdir="$2"
     my_glob_exclude="$3"
-    my_copy_cb="${4-func_copy}"
+    my_copy_cb="${4-func_copy_cb}"
 
     my_srcfiles=
     my_basedir="$my_srcdir"
@@ -229,7 +279,7 @@
 
       for my_filename in `cd "$my_srcdir" && ls`; do
 
-        # ignore excluded filenames
+         # ignore excluded filenames
         if test -n "$my_glob_exclude"; then
           eval 'case $my_filename in '$my_glob_exclude') continue ;; esac'
         fi
@@ -247,41 +297,43 @@
     done
     IFS="$my_save_IFS"
 
-    func_copy_some_files "$my_basedir" "$my_srcfiles" \
+    func_copy_some_files "$my_srcfiles" "$my_basedir" \
       "$my_destdir" "$my_copy_cb"
 }
 
 
-# func_copy_some_files srcdir srcfile_spec destdir [copy_cb=func_copy]
-# Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
-# names in SRCFILE_SPEC.  The odd calling convention is needed to allow
-# spaces in file and directory names.
+# func_copy_some_files srcfile_spec srcdirs destdir [copy_cb=func_copy_cb]
+# Call COPY_CB for each regular file named by the ':' delimited names in
+# SRCFILE_SPEC first found in a directory from SRCDIRS.  The odd calling
+# convention is needed to allow spaces in file and directory names.
 func_copy_some_files ()
 {
-    my_srcdir="$1"
-    my_srcfile_spec="$2"
+    my_srcfile_spec="$1"
+    my_srcdirs="$2"
     my_destdir="$3"
-    my_copy_cb="${4-func_copy}"
+    my_copy_cb="${4-func_copy_cb}"
 
     my_save_IFS="$IFS"
     IFS=:
     for my_filename in $my_srcfile_spec; do
-
-      IFS="$my_save_IFS"
-      if test -f "$my_srcdir/$my_filename"; then
-        if test "X$my_copy_cb" = Xfunc_copy; then
-         $opt_force || if test -f "$my_destdir/$my_filename"; then
-           $opt_quiet \
-             || func_error "\`$my_destdir/$my_filename' exists: use \`--force' 
to overwrite"
-           continue
-         fi
+      for my_srcdir in $my_srcdirs; do
+        IFS="$my_save_IFS"
+        if test -f "$my_srcdir/$my_filename"; then
+          if test "X$my_copy_cb" = Xfunc_copy_cb; then
+           $opt_force || if test -f "$my_destdir/$my_filename"; then
+             $opt_quiet \
+               || func_error "\`$my_destdir/$my_filename' exists: use 
\`--force' to overwrite"
+             continue
+           fi
+          fi
+        else
+          # Not a regular file
+          continue
         fi
-      else
-        # Not a regular file
-        continue
-      fi
 
-      $my_copy_cb "$my_srcdir/$my_filename" "$my_destdir/$my_filename"
+        $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir"
+      done
+      IFS="$my_save_IFS"
     done
     IFS="$my_save_IFS"
 }
@@ -299,9 +351,9 @@
     test -f "$configure_ac" \
         || func_fatal_help "\`$configure_ac' does not exist"
 
-    test -n "`cd $pkgvdatadir && ls`" \
-        || func_fatal_error "can not list files in \`$pkgvdatadir'"
-
+    # TODO: check that existing directories from the list can be ls'ed
+    #test -n "`{ cd $pkgvdatadir && ls; } 2>dev/null`" \
+    #    || func_fatal_error "can not list files in \`$pkgvdatadir'"
 
     # Set local variables to reflect contents of configure.ac
     my_uses_autoconf=false
@@ -415,6 +467,23 @@
     done
 }
 
+
+# func_filename_path_search filename dirs
+func_filename_path_search ()
+{
+    func_filename_path_search_result=
+
+    my_save_IFS="$IFS"; IFS=:
+    for mydir in $2; do
+      IFS="$my_save_IFS"
+      test -f "$mydir/$1" && break
+    done
+    IFS="$my_save_IFS"
+
+    test -f "$mydir/$1" && func_filename_path_search_result="$mydir/$1"
+}
+
+
 # func_serial filename [macro_regex]
 # Output the value of the serial number comment in FILENAME, where the
 # comment line must also match MACRO_REGEX, if given.
@@ -444,20 +513,28 @@
     $ECHO $my_serial
 }
 
-# func_serial_update srcfile destfile [macro_regex] [old_macro_regex]
-# Copy SRCFILE to DESTFILE provided SRCFILE has a newer serial number, or
-# DESTFILE does not yet exist, or the user specified `--force'.  If given,
-# MACRO_REGEX or OLD_MACRO_REGEX must match any text after "# serial N" in
-# both files.
+# func_serial_update filename srcdirs destdir [macro_regex] [old_macro_regex]
+# Copy the first file named FILENAME from a directory listed in the
+# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has
+# a newer serial number, or DESTFILE does not yet exist, or the user
+# specified `--force' at the command line.  If given, MACRO_REGEX or
+# OLD_MACRO_REGEX must match any text after "# serial N" in both files.
 func_serial_update ()
 {
-    my_srcfile="$1"
-    my_destfile="$2"
-    my_macro_regex="$3"
-    my_old_macro_regex="$4"
+    my_filename="$1"
+    my_srcdirs="$2"
+    my_destdir="$3"
+    my_macro_regex="$4"
+    my_old_macro_regex="$5"
 
     my_return_status=1
     my_update_p=:
+    func_filename_path_search "$my_filename" "$my_srcdirs"
+    my_srcfile="$func_filename_path_search_result"
+    my_destfile="$my_destdir/$my_filename"
+
+    test -f "$my_srcfile" || \
+      { func_error "\`$my_filename' not found in \`$my_srcdirs'"; return; }
 
     if test -f "$my_destfile"; then
       my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
@@ -522,56 +599,70 @@
     # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
 }
 
-# func_ltmain_update srcfile destfile
-# Copy SRCFILE to DESTFILE provided SRCFILE has a newer VERSION/TIMESTAMP,
-# or DESTFILE does not yet exist, or the user specified `--force'.
+# func_ltmain_update filename srcdirs destdir
+# Copy the first file named FILENAME from a directory listed in the
+# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has
+# a newer TIMESTAMP, or DESTFILE does not yet exist, or the user
+# specified `--force' at the command line.
 func_ltmain_update ()
 {
-    my_srcfile="$1"
-    my_destfile="$2"
+    my_filename="$1"
+    my_srcdirs="$2"
+    my_destdir="$3"
+
+    func_filename_path_search "$my_filename" "$my_srcdirs"
+    my_srcfile="$func_filename_path_search_result"
+    my_destfile="$my_destdir/$my_filename"
     my_sed_ltmain='
        s,^VERSION=[[^0-9]]*\(.*\)[[    ]]*$,\1,; t
        s,^TIMESTAMP=[[^0-9]]*\([[.0-9]]*\) .*$,\1,; t
        d'
 
-    if test -f "$my_srcfile"; then :
-    else
-      func_error "\`$my_srcfile' does not exist."
-      return
-    fi
+    if test -n "$my_srcfile"; then
+
+      # FIXME:  check versions, and only downgrade with --force
+      cmp -s  "$my_srcfile" "$my_destfile"
+      if test "$?" -ne 0 || $opt_force; then
+        func_copy "$my_srcfile" "$my_destfile"
+      else
+        $opt_quiet \
+          || func_echo "\`$my_destfile' is already up to date."
+      fi
 
-    # FIXME:  check versions, and only downgrade with --force
-    cmp -s  "$my_srcfile" "$my_destfile"
-    if test "$?" -ne 0 || $opt_force; then
-      func_copy "$my_srcfile" "$my_destfile"
     else
-      $opt_quiet \
-        || func_echo "\`$my_destfile' is already up to date."
+      func_error "\`$my_filename' not found in \`$my_srcdirs'."
     fi
 }
 
-# func_config_update srcfile destfile
-# Copy SRCFILE to DESTFILE provided SRCFILE has a newer TIMESTAMP,
-# or DESTFILE does not yet exist, or the user specified `--force'.
+# func_config_update filename srcdirs destdir
+# Copy the first file named FILENAME from a directory listed in the
+# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has
+# a newer TIMESTAMP, or DESTFILE does not yet exist, or the user
+# specified `--force' at the command line.
 func_config_update ()
 {
-    my_srcfile="$1"
-    my_destfile="$2"
+    my_filename="$1"
+    my_srcdirs="$2"
+    my_destdir="$3"
+
+    func_filename_path_search "$my_filename" "$my_srcdirs"
+    my_srcfile="$func_filename_path_search_result"
+    my_destfile="$my_destdir/$my_filename"
     my_sed_config='s,^timestamp=[[^0-9]]*\([[.0-9-]]*\)[[^0-9]].*$,\1,; t; d'
 
-    if test -f "$my_srcfile"; then :
-    else
-      func_error "\`$my_srcfile' does not exist."
-      return
-    fi
+    if test -n "$my_srcfile"; then
+
+      # FIXME:  check versions, and only downgrade with --force
+      cmp -s  "$my_srcfile" "$my_destfile"
+      if test "$?" -ne 0 || $opt_force; then
+        func_copy "$my_srcfile" "$my_destfile"
+      else
+        $opt_quiet \
+          || func_echo "\`$my_destfile' is already up to date."
+      fi
 
-    # FIXME:  check versions, and only downgrade with --force
-    cmp -s  "$my_srcfile" "$my_destfile"
-    if test "$?" -ne 0 || $opt_force; then
-      func_copy "$my_srcfile" "$my_destfile"
     else
-      $opt_quiet \
-        || func_echo "\`$my_destfile' is already up to date."
+      func_error "\`$my_filename' not found in \`$my_srcdirs'."
     fi
 }
 
@@ -594,13 +685,14 @@
   func_scan_files
   $opt_quiet || func_check_macros
 
-  # Copy all the files from installed libltdl to this project, if the
-  # user specified `--ltdl'.
+  # Copy all the files from installed (or specified, if `-I' was used)
+  # libltdl to this project, if the user specified `--ltdl'.
   if test -n "$ltdldir"; then
-    eval func_copy_all_files -r "$pkgvdatadir/libltdl" "$ltdldir"
+    func_copy_all_from_path -r libltdl "$pkgvdatadirs" "$ltdldir"
 
     # libtoolize the newly copied libltdl tree
-    ( cd "$ltdldir" && "$progpath" $libtoolize_flags ) || exit $EXIT_FAILURE
+    ( cd "$ltdldir" && eval "$progpath" $libtoolize_flags ) \
+      || exit $EXIT_FAILURE
   fi
 
   # Copy all the installed utility files to the auxiliary directory if
@@ -609,30 +701,27 @@
     func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
   fi
   if $opt_install || $opt_force; then
-    func_copy_all_files "$pkgvdatadir" "$auxdir" "$glob_exclude_pkgaux_files"
-    func_config_update "$pkgvdatadir/config.guess" "$auxdir/config.guess"
-    test -f "$pkgvdatadir/config.sub" \
-      && func_config_update "$pkgvdatadir/config.sub" "$auxdir/config.sub"
+    func_copy_all_from_path . "$pkgvdatadirs" \
+      "$auxdir" "$glob_exclude_pkgaux_files"
+    func_config_update config.guess "$pkgvdatadirs" "$auxdir"
+    func_config_update config.sub   "$pkgvdatadirs" "$auxdir"
   fi
-  func_ltmain_update "$pkgvdatadir/ltmain.sh" "$auxdir/ltmain.sh"
+  func_ltmain_update ltmain.sh "$pkgvdatadirs" "$auxdir"
 
   # Copy libtool's m4 macros to the macro directory, if they are newer.
   if test -n "$m4dir"; then
-    libtool_m4="$pkgvmacrodir/libtool.m4"
-    ltdl_m4="$pkgvmacrodir/ltdl.m4"
-
     $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
 
-    func_serial_update  "$libtool_m4" "$m4dir/libtool.m4" \
+    func_serial_update  libtool.m4 "$pkgvmacrodirs" "$m4dir" \
       LT_INIT 'A[[CM]]_PROG_LIBTOOL'
 
     if $seen_ltdl; then
-      func_serial_update "$ltdl_m4" "$m4dir/ltdl.m4" 'LTDL_INIT'
+      func_serial_update ltdl.m4 "$pkgvmacrodirs" "$m4dir" 'LTDL_INIT'
     else
-      func_verbose "Not copying \`$ltdl_m4', libltdl not used."
+      func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
     fi
 
-    func_copy_some_files "$pkgvmacrodir" "$pkgvmacro_files" \
+    func_copy_some_files "$pkgvmacro_files" "$pkgvmacrodirs" \
       "$m4dir" func_serial_update
   fi
 }


--- orig/tests/am-subdir.at
+++ mod/tests/am-subdir.at
@@ -36,7 +36,7 @@
 ]])
 
 AT_DATA([[Makefile.am]],
-[[AC_LOCAL_AMFLAGS = -I ../../m4
+[[ACLOCAL_AMFLAGS = -I m4
 AM_CPPFLAGS    = -I$(top_srcdir)/../..
 
 lib_LTLIBRARIES                = subdir/libsub.la
@@ -73,6 +73,7 @@
 ]])
 
 AT_BOOTSTRAP
+"${MAKE-make}"
 AT_CHECK([subdir/subdemo], 0, expout)
 
 AT_CLEANUP
@@ -111,7 +112,7 @@
 ]])
 
 AT_DATA([[Makefile.am]],
-[[AC_LOCAL_AMFLAGS = -I ../../m4
+[[ACLOCAL_AMFLAGS = -I m4
 AM_CPPFLAGS    = -I$(top_srcdir)/../..
 
 lib_LTLIBRARIES                = subdir/libsub.la
@@ -155,6 +156,7 @@
 ]])
 
 AT_BOOTSTRAP
+"${MAKE-make}"
 AT_CHECK([subdir/subdemo], 0, expout)
 
 AT_CLEANUP


--- orig/tests/testsuite.at
+++ mod/tests/testsuite.at
@@ -18,23 +18,37 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
+
+# AT_LIBTOOLIZE([ARGS])
+# ---------------------
+m4_define([AT_LIBTOOLIZE],
+["${LIBTOOLIZE-${abs_top_builddir}/libtoolize}" \
+    -I "$abs_top_srcdir" -I "$abs_top_srcdir/config" $1
+])
+
+
+# AT_CHECK_LIBTOOLIZE(ARGS, [EXIT-STATUS = 0], [STDOUT = `'], [STDERR = `'])
+# --------------------------------------------------------------------------
+m4_define([AT_CHECK_LIBTOOLIZE],
+[AT_CHECK([AT_LIBTOOLIZE([$1])],
+  [$2], [$3], [$4])
+])
+
+
 # AT_BOOTSTRAP
 # ------------
 m4_define([AT_BOOTSTRAP],
-[[LIBTOOLIZE=${abs_top_builddir}/libtoolize
-export LIBTOOLIZE
-
-test -f ./ltmain.sh || $LIBTOOLIZE --copy
+[
+test -f ./ltmain.sh || AT_LIBTOOLIZE([--copy])
 test -f ./configure || autoreconf --force --verbose --install
 test -f ./configure || exit 1
 ./configure
-${MAKE-make}
-]])
+])
 
 # We use `dnl' in zillions of places...
 m4_pattern_allow([^dnl$])
 
-# We exercise libtool.
+# We exercise these tools.
 AT_TESTED([grep autoreconf autom4te automake])
 
 ## ----------- ##




reply via email to

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