]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Make AS_SET_CATFILE polymorphic, and add testsuite coverage.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 8 Jun 2010 04:55:10 +0000 (06:55 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 8 Jun 2010 04:55:10 +0000 (06:55 +0200)
* lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): Use AS_VAR_SET to set
the variable.
* tests/m4sh.at (AS@&t@_SET_CATFILE): New test.
* doc/autoconf.texi (Common Shell Constructs): Document that
AS_SET_CATFILE is polymorphic in its VAR argument now.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/autoconf.texi
lib/m4sugar/m4sh.m4
tests/m4sh.at

index 36632aec79fe50a77b522cf6cdc85bf18c802101..dcb54a1c1afb6f878823e5e280c6605405f001ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-06-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Make AS_SET_CATFILE polymorphic, and add testsuite coverage.
+       * lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): Use AS_VAR_SET to set
+       the variable.
+       * tests/m4sh.at (AS@&t@_SET_CATFILE): New test.
+       * doc/autoconf.texi (Common Shell Constructs): Document that
+       AS_SET_CATFILE is polymorphic in its VAR argument now.
+       * NEWS: Update.
+
        Testsuite coverage for AC_COPYRIGHT and AT_COPYRIGHT.
        * tests/autotest.at (AT@&t@_COPYRIGHT): New test.
        * tests/base.at (AC@&t@_COPYRIGHT): Likewise.
diff --git a/NEWS b/NEWS
index 04cf8dd9d027c78eec681658f9093fc24cd2bd79..dfe8cd7796fa0a772beeb39b27c260aa6b454f0c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ GNU Autoconf NEWS - User visible changes.
 ** AC_CHECK_DECL and AC_CHECK_DECLS accept optional function argument types
    for overloaded C++ functions.
 
+** AS_SET_CATFILE accepts nonliterals in its variable name argument now.
+
 * Major changes in Autoconf 2.65 (2009-11-21) [stable]
   Released by Eric Blake, based on git versions 2.64.*.
 
index 0de5485841eba827a5c39b0535810bb34b4186e9..e99103dafcd67c5104545fe107965804bda2ec76 100644 (file)
@@ -13234,8 +13234,8 @@ if test "x$HAVE_sys_some_file_h" = xyes; then echo "Have it!"; fi
 
 @defmac AS_SET_CATFILE (@var{var}, @var{dir}, @var{file})
 @asindex{SET_CATFILE}
-Set the shell variable @var{var} to @var{dir}/@var{file}, but
-optimizing the common cases (@var{dir} or @var{file} is @samp{.},
+Set the polymorphic shell variable @var{var} to @var{dir}/@var{file},
+but optimizing the common cases (@var{dir} or @var{file} is @samp{.},
 @var{file} is absolute, etc.).
 @end defmac
 
index f056569477a7f868cddffe5eda68fc85961f6ace..024498d4eaa01e9b0c2cd005a54060eb3cad6a73 100644 (file)
@@ -1313,12 +1313,12 @@ IFS=$as_save_IFS
 # Optimize the common case where $2 or $3 is '.'.
 m4_define([AS_SET_CATFILE],
 [case $2 in @%:@((
-.) $1=$3;;
+.) AS_VAR_SET([$1], [$3]);;
 *)
   case $3 in @%:@(((
-  .) $1=$2;;
-  [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
-  *) $1=$2/$3;;
+  .) AS_VAR_SET([$1], [$2]);;
+  [[\\/]]* | ?:[[\\/]]* ) AS_VAR_SET([$1], [$3]);;
+  *) AS_VAR_SET([$1], [$2/$3]);;
   esac;;
 esac[]])# AS_SET_CATFILE
 
index 7f2cc3924b826f1eaede9040987ef770e6a68b02..05cea8538bae3cc823021b8522716321b52dadeb 100644 (file)
@@ -241,6 +241,48 @@ AT_CHECK([$CONFIG_SHELL ./script])
 AT_CLEANUP
 
 
+## ---------------- ##
+## AS_SET_CATFILE.  ##
+## ---------------- ##
+
+AT_SETUP([AS@&t@_SET_CATFILE])
+AT_KEYWORDS([m4sh])
+
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+
+# CATFILE_TEST(DIR, FILE, EXPECTED)
+m4_define([CATFILE_TEST],
+[# AS_SET_CATFILE works and can be used in a compound list.
+if AS_SET_CATFILE([var], [$1], [$2]) \
+   && test "$var" = $3; then :; else
+  echo "catfile($1, $2) = $var != $3" >&2
+fi
+# AS_SET_CATFILE can use non-literals in its arguments.
+varname=var2
+dirpart=$1
+filepart=$2
+if AS_SET_CATFILE([$varname], [$dirpart], [$filepart]) \
+   && test "$var2" = $3; then :; else
+  echo "catfile($dirpart, $filepart) = $var2 != $3" >&2
+fi
+])
+
+CATFILE_TEST([dir], [file], [dir/file])
+CATFILE_TEST([.], [file], [file])
+CATFILE_TEST([dir], [.], [dir])
+CATFILE_TEST([dir], [/abs/file], [/abs/file])
+CATFILE_TEST([dir], [C:/abs/file], [C:/abs/file])
+CATFILE_TEST(["dir  name"], ['file  name'], ['dir  name/file  name'])
+
+AS_EXIT(0)
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script])
+
+AT_CLEANUP
+
 
 ## --------- ##
 ## AS_ECHO.  ##