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.

Signed-off-by: Eric Blake <ebb9@byu.net>
This commit is contained in:
Eric Blake 2008-10-17 14:07:11 -06:00
parent 7fdde10b5f
commit 6e3761f85f
5 changed files with 19 additions and 6 deletions

View File

@ -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,

View 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
])

View 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],

View 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=../../ ;;

View 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])])])