]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Add func_append test cases for smart and retarded implementations.
authorGary V. Vaughan <gary@gnu.org>
Tue, 29 Jun 2010 22:12:42 +0000 (05:12 +0700)
committerGary V. Vaughan <gary@gnu.org>
Tue, 29 Jun 2010 22:12:42 +0000 (05:12 +0700)
* tests/getopt-m4sh.at (_LT_AT_FALLBACK_FUNC_EXTRACT): New
macro to extract a fallback function implementation from
ltmain.m4sh.
[option appending]: Use it for a test of the fallback
implementation of func_append.
[enhanced shell option appending]: And also test the enhanced
implementation.
* libltdl/config/ltmain.m4sh (func_append_quoted): Fix missing \
to escape a quoted space for eval.
* libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Fix missing $ in
dereference of func_append inline replacement for retarded
shells.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
ChangeLog
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4
tests/getopt-m4sh.at

index 8e075adc5f069c5a880f87d178b1e21f9325e2ba..e9ca7a83f1c1230382dc8a34f704b1ffb8717ece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-06-30  Gary V. Vaughan  <gary@gnu.org>
+
+       Add func_append test cases for smart and retarded implementations.
+       * tests/getopt-m4sh.at (_LT_AT_FALLBACK_FUNC_EXTRACT): New
+       macro to extract a fallback function implementation from
+       ltmain.m4sh.
+       [option appending]: Use it for a test of the fallback
+       implementation of func_append.
+       [enhanced shell option appending]: And also test the enhanced
+       implementation.
+       * libltdl/config/ltmain.m4sh (func_append_quoted): Fix missing \\
+       to escape a quoted space for eval.
+       * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Fix missing $ in
+       dereference of func_append inline replacement for retarded
+       shells.
+
 2010-06-29  Gary V. Vaughan  <gary@gnu.org>
 
        Correct func_split_short_opt comment cut-n-pasto.
index 46a8aa3fd05334697145e20f54c985c226b10ea0..fc2358e6abc7e433da802ad3be389036089f6d99 100644 (file)
@@ -161,7 +161,7 @@ func_append ()
 func_append_quoted ()
 {
     func_quote_for_eval "${2}"
-    eval "${1}=\$${1} \$func_quote_for_eval_result"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
 } # func_append_quoted may be replaced by XSI optimised implementation
 
 
index 7140627952fcea574668515164da86e1399541f7..f3ebc87723aeef9df152909933c385d694419dd5 100644 (file)
@@ -7333,7 +7333,7 @@ dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
   test 0 -eq $? || _lt_xsi_replace_fail=:
 else
   # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="\1%g' $cfgfile > $cfgfile.tmp \
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
     && mv -f "$cfgfile.tmp" "$cfgfile" \
       || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
   test 0 -eq $? || _lt_xsi_replace_fail=:
index c55acfc8ff99f359011558489103b1a00d644ca8..572522a6da039c57c68adf6943c67b23f34ab2b9 100644 (file)
@@ -34,13 +34,17 @@ m4_define([_LT_AT_GETOPT_M4SH_SETUP],
 m4_pattern_allow([m4_include])
 AT_DATA([options.m4sh],
 [[AS_INIT[]m4_include([getopt.m4sh])
+nl='
+'
+list=
 options=
 M4SH_GETOPTS(
+  [a!],        [--append],     [],     [func_append list "$optarg$nl"],
   [f], [--force],      [],     [options="$options force"],
   [i], [--install],    [],     [options="$options install"],
   [v], [--verbose],    [],     [options="$options verbose"],
   [!], [--ltdl],       [false],[options="$options ltdl=$optarg"],
-[echo $options])
+[echo "$list"$options])
 ]])
 m4_pattern_forbid([m4_include])
 m4_pattern_forbid([AS_INIT])
@@ -53,13 +57,25 @@ $M4SH -B $abs_top_srcdir/libltdl/config options.m4sh \
 ])# _LT_AT_GETOPT_M4SH_SETUP
 
 
+# _LT_AT_FALLBACK_FUNC_EXTRACT(FUNC-NAME)
+# ---------------------------------------
+# Extract the fallback function FUNC-NAME from ltmain.m4sh
+m4_define([_LT_AT_FALLBACK_FUNC_EXTRACT],
+[dnl {{
+$SED '/^# func_dirname /q' options > options.tmp
+echo '# func_append var value' >> options.tmp
+$SED -n '/^$1 ()/,/^} # $1 /p' $abs_top_srcdir/libltdl/config/ltmain.m4sh >> options.tmp
+$SED '1,/^# func_dirname/d' options >> options.tmp
+rm -f options && mv options.tmp options])
+
+
 # _LT_AT_XSI_FUNC_EXTRACT(FUNC-NAME)
 # ----------------------------------
 # Extract the XSI decorated function FUNC-NAME from libtool
 m4_define([_LT_AT_XSI_FUNC_EXTRACT],
 [dnl {{
 $SED '/^# $1/q' options > options.tmp
-$SED -n '/^$1/,/^} # XSI $1 /p' $abs_top_builddir/libtool >> options.tmp
+$SED -n '/^$1 ()/,/^} # XSI $1 /p' $abs_top_builddir/libtool >> options.tmp
 $SED '1,/^} # $1 /d' options >> options.tmp
 rm -f options && mv options.tmp options])
 
@@ -130,3 +146,40 @@ _LT_AT_XSI_FUNC_EXTRACT(func_split_long_opt)
 AT_CHECK([$SHELL ./options --ltdl=long], 0, [expout])
 
 AT_CLEANUP
+
+
+## ----------------- ##
+## Option appending. ##
+## ----------------- ##
+
+AT_SETUP([option appending])
+
+AT_DATA(expout,
+[[first   --append second
+third
+
+]])
+
+_LT_AT_GETOPT_M4SH_SETUP
+_LT_AT_FALLBACK_FUNC_EXTRACT(func_append)
+
+AT_CHECK([$SHELL ./options -a "first   --append second" -athird], 0, [expout])
+
+AT_CLEANUP
+
+
+AT_SETUP([enhanced shell option appending])
+
+AT_DATA(expout,
+[[first   --append second
+third
+
+]])
+
+_LT_AT_GETOPT_M4SH_SETUP
+_LT_AT_FALLBACK_FUNC_EXTRACT(func_append)
+_LT_AT_XSI_FUNC_EXTRACT(func_append)
+
+AT_CHECK([$SHELL ./options -a "first   --append second" -athird], 0, [expout])
+
+AT_CLEANUP