Allow AS_VAR_SET_IF in shell lists.

* lib/m4sugar/m4sh.m4 (AS_VAR_SET_IF): Allow continuation of
line.
* lib/autoconf/general.m4 (AC_CACHE_VAL): Supply newline no longer
provided by AS_VAR_SET_IF.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Adjust
clients.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* tests/m4sh.at (AS@&t@_VAR basics): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
This commit is contained in:
Eric Blake 2008-10-20 17:14:03 -06:00
parent 0467924f24
commit ca7380b2a8
6 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,15 @@
2008-10-21 Eric Blake <ebb9@byu.net>
Allow AS_VAR_SET_IF in shell lists.
* lib/m4sugar/m4sh.m4 (AS_VAR_SET_IF): Allow continuation of
line.
* lib/autoconf/general.m4 (AC_CACHE_VAL): Supply newline no longer
provided by AS_VAR_SET_IF.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Adjust
clients.
* lib/autoconf/libs.m4 (AC_SEARCH_LIBS): Likewise.
* tests/m4sh.at (AS@&t@_VAR basics): Enhance test.
Allow AS_VAR_IF in shell lists.
* lib/m4sugar/m4sh.m4 (AS_VAR_IF): Allow continuation of line.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Adjust clients.

View File

@ -2002,7 +2002,8 @@ m4_if(m4_index([$2], [AC_SUBST]), [-1], [],
[where no actions should be taken])])dnl
AS_VAR_SET_IF([$1],
[_AS_ECHO_N([(cached) ])],
[$2])])
[$2])
])
# AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS)

View File

@ -141,9 +141,9 @@ case $ac_header_compiler:$ac_header_preproc:$ac_[]_AC_LANG_ABBREV[]_preproc_warn
;;
esac
AC_CACHE_CHECK([for $1], [ac_Header],
[AS_VAR_SET([ac_Header], [$ac_header_preproc])])
])dnl ! set ac_HEADER
AS_VAR_IF([ac_Header], [yes], [$2], [$3])[]dnl
[AS_VAR_SET([ac_Header], [$ac_header_preproc])])[]dnl
])
AS_VAR_IF([ac_Header], [yes], [$2], [$3])
AS_VAR_POPDEF([ac_Header])dnl
])# _AC_CHECK_HEADER_MONGREL
@ -160,7 +160,7 @@ AC_CACHE_CHECK([for $1], [ac_Header],
@%:@include <$1>])],
[AS_VAR_SET([ac_Header], [yes])],
[AS_VAR_SET([ac_Header], [no])])])
AS_VAR_IF([ac_Header], [yes], [$2], [$3])[]dnl
AS_VAR_IF([ac_Header], [yes], [$2], [$3])
AS_VAR_POPDEF([ac_Header])dnl
])# _AC_CHECK_HEADER_NEW
@ -175,7 +175,7 @@ AC_CACHE_CHECK([for $1], [ac_Header],
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$1>])],
[AS_VAR_SET([ac_Header], [yes])],
[AS_VAR_SET([ac_Header], [no])])])
AS_VAR_IF([ac_Header], [yes], [$2], [$3])[]dnl
AS_VAR_IF([ac_Header], [yes], [$2], [$3])
AS_VAR_POPDEF([ac_Header])dnl
])# _AC_CHECK_HEADER_OLD
@ -403,7 +403,7 @@ AC_CACHE_CHECK([for $1 that defines DIR], [ac_Header],
return 0;])],
[AS_VAR_SET([ac_Header], [yes])],
[AS_VAR_SET([ac_Header], [no])])])
AS_VAR_IF([ac_Header], [yes], [$2], [$3])[]dnl
AS_VAR_IF([ac_Header], [yes], [$2], [$3])
AS_VAR_POPDEF([ac_Header])dnl
])# _AC_CHECK_HEADER_DIRENT

View File

@ -79,9 +79,9 @@ for ac_lib in '' $2; do
LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
fi
AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])])
AS_VAR_SET_IF([ac_Search], [break])dnl
AS_VAR_SET_IF([ac_Search], [break])
done
AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])dnl
AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS])
AS_VAR_COPY([ac_res], [ac_Search])

View File

@ -1778,9 +1778,7 @@ m4_define([AS_VAR_SET],
# Implement a shell `if-then-else' depending whether VARIABLE is set
# or not. Polymorphic.
m4_define([AS_VAR_SET_IF],
[AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])
dnl fixme: remove the newline?
])
[AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
# AS_VAR_TEST_SET(VARIABLE)

View File

@ -949,7 +949,7 @@ AT_DATA_M4SH([script.as], [[dnl
AS_INIT
# Literals.
dnl AS_VAR_SET_IF also covers AS_VAR_TEST_SET
AS_VAR_SET_IF([foo], [echo oops], [echo ok])
AS_VAR_SET_IF([foo], [echo oops]) && echo ok
AS_VAR_SET([foo], ['\a "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [foo])
@ -966,7 +966,7 @@ m4_ifdef([tmp], [echo oops])
# Indirects via shell vars.
echo '===='
num=1
AS_VAR_SET_IF([foo$num], [echo oops], [echo ok])
AS_VAR_SET_IF([foo$num], [echo oops]) && echo ok
AS_VAR_SET([foo$num], ['\a "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [foo$num])
@ -984,7 +984,7 @@ m4_ifdef([tmp], [echo oops])
# Indirects via command substitution.
echo '===='
AS_VAR_SET_IF([`echo foo3`], [echo oops], [echo ok])
AS_VAR_SET_IF([`echo foo3`], [echo oops]) && echo ok
AS_VAR_SET([`echo foo3`], ['\a "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [`echo foo3`])