]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Add AS_VAR_COPY.
authorEric Blake <ebb9@byu.net>
Fri, 17 Oct 2008 20:07:11 +0000 (14:07 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 17 Oct 2008 20:07:11 +0000 (14:07 -0600)
* lib/m4sugar/m4sh.m4 (AS_VAR_COPY): New macro.
(AS_VAR_IF): Use it, instead of the broken AS_VAR_GET.
* lib/autoconf/general.m4 (AC_CACHE_CHECK): Likewise.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* lib/autotest/general.m4 (_AT_FINISH): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/autoconf/general.m4
lib/autoconf/libs.m4
lib/autotest/general.m4
lib/m4sugar/m4sh.m4

index 39a3b3414a32ddc630050c1465e90dc56dd68c0f..072e51eed257bbd1fdfe9b4ff44dbd5840a3310a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-17  Eric Blake  <ebb9@byu.net>
 
+       Add AS_VAR_COPY.
+       * lib/m4sugar/m4sh.m4 (AS_VAR_COPY): New macro.
+       (AS_VAR_IF): Use it, instead of the broken AS_VAR_GET.
+       * lib/autoconf/general.m4 (AC_CACHE_CHECK): Likewise.
+       * lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
+       * lib/autotest/general.m4 (_AT_FINISH): Likewise.
+
        Sort AS_VAR_* interfaces.
        * lib/m4sugar/m4sh.m4 (AS_VAR_GET): Reduce output to one line.
        (AS_VAR_TEST_SET, AS_VAR_SET, AS_VAR_SET_IF, AS_VAR_POPDEF): Sort,
index beb310459641292a9cf154357606ccb5c9340b5a..8c858c460238809c459f23811bec6996291a77b8 100644 (file)
@@ -1990,7 +1990,7 @@ m4_defun([AC_CACHE_CHECK],
 AC_CACHE_VAL([$2], [$3])dnl
 AS_LITERAL_IF([$2],
              [AC_MSG_RESULT([$$2])],
-             [ac_res=AS_VAR_GET([$2])
+             [AS_VAR_COPY([ac_res], [$2])
               AC_MSG_RESULT([$ac_res])])dnl
 ])
 
index 4e62040db9a60f5c972b65f2b1afa9232a88b9ea..03258f0e113fa7ff36ba293c4d7aadb5f736e753 100644 (file)
@@ -84,7 +84,7 @@ done
 AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])dnl
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS])
-ac_res=AS_VAR_GET([ac_Search])
+AS_VAR_COPY([ac_res], [ac_Search])
 AS_IF([test "$ac_res" != no],
   [test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
   $3],
index f7ded3650e924add95cca5624c789c184ec3eaf7..9e7df68715c332b53844abe3ca7cc9cd13d74cc2 100644 (file)
@@ -774,7 +774,7 @@ if test -n "$at_top_srcdir"; then
   builddir=../..
   for at_dir_var in srcdir top_srcdir top_build_prefix
   do
-    at_val=AS_VAR_GET([at_$at_dir_var])
+    AS_VAR_COPY([at_val], [at_$at_dir_var])
     case $at_val in
       [[\\/$]]* | ?:[[\\/]]* ) at_prefix= ;;
       *) at_prefix=../../ ;;
index d0b1b8c4f3cffd9a458d09c05a4c897dcbeccc7c..11555f3b3d89f1c7905f53dc44a219a59b953fe1 100644 (file)
@@ -1625,6 +1625,12 @@ AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
 # when passed through eval, and a polymorphic name is either type.
 
 
+# AS_VAR_COPY(DEST, SOURCE)
+# -------------------------
+# Set the polymorphic shell variable DEST to the contents of the polymorphic
+# shell variable SOURCE.
+m4_define([AS_VAR_COPY],
+[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
 
 
 # AS_VAR_GET(VARIABLE)
@@ -1632,8 +1638,8 @@ AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
 # Get the value of the shell VARIABLE.
 # Evaluates to $VARIABLE if there are no indirection in VARIABLE,
 # else into the appropriate `eval' sequence.
-# FIXME: This mishandles values that end in newlines.
-# Fixing this will require changing the API.
+# This macro is deprecated because it sometimes mishandles trailing newlines;
+# use AS_VAR_COPY instead.
 m4_define([AS_VAR_GET],
 [AS_LITERAL_IF([$1],
               [$$1],
@@ -1648,7 +1654,7 @@ AS_ECHO(["$as_val"])'`])])
 m4_define([AS_VAR_IF],
 [AS_LITERAL_IF([$1],
   [AS_IF([test "x$$1" = x""$2], [$3], [$4])],
-  [as_val=AS_VAR_GET([$1])
+  [AS_VAR_COPY([as_val], [$1])
    AS_IF([test "x$as_val" = x""$2], [$3], [$4])])])