]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
tests: always extract only the first AC_CONFIG_MACRO_DIR arg.
authorGary V. Vaughan <gary@gnu.org>
Fri, 19 Oct 2012 05:23:39 +0000 (12:23 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 19 Oct 2012 07:24:21 +0000 (14:24 +0700)
Previous releases of libtoolize used the final invocation when
there were several, and after the rewrite over extract-trace,
all the invocation directories were concatenated.  This change
enforces correct and consistent behaviour.
* tests/libtoolize.at (multiple AC_CONFIG_MACRO_DIR invocation):
New test.
* build-aux/extract-trace (func_extract_trace_first): New function
for clients that source this file, which returns only the first
argument to the first invocation of the named macros.
* libtoolize.in (func_require_ac_macro_dir): Use it to make sure
the first argument is always used.
(func_require_ac_aux_dir, func_require_ac_ltdl_dir)
(func_require_ac_ltdl_options): Future proof these functions against
multiple invocations or additional arguments to the macros they
trace.
* News (Important incompatible changes): Note change in semantics.
Reported by Eric Blake.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
NEWS
build-aux/extract-trace
libtoolize.in
tests/libtoolize.at

diff --git a/NEWS b/NEWS
index 17436b1cd57a0fd1b494c159c572bddb81e21e39..ad1d8f96b8fd7b98b64804bc7b69a603490a610a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,12 @@ NEWS - list of user-visible changes between releases of GNU Libtool
     upgrade to the more standard naming of `ltdl.mk' in keeping with other
     GNU projects.
 
+  - libtoolize now behaves consistenty in respect of multiple directory
+    arguments to ACLOCAL_AMFLAGS and multiple invocations of AC_CONFIG-
+    _MACRO_DIRS, where the first directory is always selected.  Previous
+    releases took the first ACLOCAL_AMFLAGS argument, but the last
+    invocation of AC_CONFIG_MACRO_DIRS.
+
 New in 2.4.2 2011-10-17: git version 2.4.1a, Libtool team:
 
 * New features:
index d8be25cab86f12791341471c7d4f6e0999493320..f133b720fb923f2c9a47129f47fd37e91f877ee8 100755 (executable)
@@ -348,6 +348,21 @@ func_extract_trace ()
 }
 
 
+# func_extract_trace_first MACRO_NAMES [FILENAME]...
+# --------------------------------------------------
+# Exactly like func_extract_trace, except that only the first argument
+# to the first invocation of one of the comma separated MACRO_NAMES is
+# returned in `$func_extract_trace_first_result`.
+func_extract_trace_first ()
+{
+    $debug_cmd
+
+    func_extract_trace ${1+"$@"}
+    func_extract_trace_first_result=`$bs_echo "$func_extract_trace_result" \
+      |$SED 's|:.*$||g;1q'`
+}
+
+
 # func_main [ARG]...
 # ------------------
 func_main ()
index 17ba83de9fc7e5b1f05ff0df6b9b9bd0d98fb575..09e3a9bce8c7250f31c8fbae4787699911b975d2 100644 (file)
@@ -1421,8 +1421,8 @@ func_require_ac_aux_dir ()
     $require_configure_ac
 
     test -n "$configure_ac" && {
-      func_extract_trace AC_CONFIG_AUX_DIR
-      ac_aux_dir=$func_extract_trace_result
+      func_extract_trace_first AC_CONFIG_AUX_DIR
+      ac_aux_dir=$func_extract_trace_first_result
 
       case $ac_aux_dir in
         *\$*)
@@ -1449,8 +1449,8 @@ func_require_ac_ltdl_dir ()
     $require_configure_ac
 
     if test -n "$configure_ac"; then
-      func_extract_trace LT_CONFIG_LTDL_DIR
-      ac_ltdl_dir=`expr "$func_extract_trace_result" : '\([^:]*\)'`
+      func_extract_trace_first LT_CONFIG_LTDL_DIR
+      ac_ltdl_dir=$func_extract_trace_first_result
 
       case $ac_ltdl_dir in
         *\$*)
@@ -1498,8 +1498,8 @@ func_require_ac_ltdl_options ()
     $require_configure_ac
 
     if test -n "$configure_ac"; then
-      func_extract_trace LTDL_INIT
-      ac_ltdl_options=$func_extract_trace_result
+      func_extract_trace_first LTDL_INIT
+      ac_ltdl_options=$func_extract_trace_first_result
 
       case $ac_ltdl_options in
         *\$*)
@@ -1524,8 +1524,8 @@ func_require_ac_macro_dir ()
     $require_configure_ac
 
     if test -n "$configure_ac"; then
-      func_extract_trace AC_CONFIG_MACRO_DIR
-      ac_macro_dir=$func_extract_trace_result
+      func_extract_trace_first AC_CONFIG_MACRO_DIR
+      ac_macro_dir=$func_extract_trace_first_result
     fi
 
     require_ac_macro_dir=:
index 332b7e9db01102fdacce750eed06e83f46b4bfdb..cd0fa34ac3d16a4c0872c154a67e7e3438144da7 100644 (file)
@@ -123,6 +123,38 @@ LT_AT_CHECK_LIBTOOLIZE([--copy], 1, [ignore], experr)
 AT_CLEANUP
 
 
+## ---------------------------------------- ##
+## AC_CONFIG_MACRO_DIR macrodir extraction. ##
+## ---------------------------------------- ##
+
+AT_SETUP([multiple AC_CONFIG_MACRO_DIR invocation])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([first])
+AC_CONFIG_MACRO_DIR([second])
+LT_INIT
+AC_OUTPUT
+]])
+
+AT_DATA(expout,
+[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
+libtoolize: copying file `build-aux/ltmain.sh'
+libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `first'.
+libtoolize: copying file `first/libtool.m4'
+libtoolize: copying file `first/ltoptions.m4'
+libtoolize: copying file `first/ltsugar.m4'
+libtoolize: copying file `first/ltversion.m4'
+libtoolize: copying file `first/lt~obsolete.m4'
+libtoolize: Consider adding `-I first' to ACLOCAL_AMFLAGS in Makefile.am.
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
+
+AT_CLEANUP
+
+
 ## ------------------------------------ ##
 ## ACLOCAL_AMFLAGS macrodir extraction. ##
 ## ------------------------------------ ##