[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/12] use a shell function for _AC_LINK_IFELSE
From: |
Eric Blake |
Subject: |
Re: [PATCH 03/12] use a shell function for _AC_LINK_IFELSE |
Date: |
Wed, 22 Oct 2008 17:32:40 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Paolo Bonzini <bonzini <at> gnu.org> writes:
>
> 2008-10-12 Paolo Bonzini <bonzini <at> gnu.org>
>
> * lib/autoconf/general.m4 (_AC_LINK_IFELSE): Use a shell function.
> + AS_IF([_AC_DO_STDERR($ac_link) && {
I just noticed that _AC_DO_STDERR used $LINENO rather than $as_lineno, so by
moving it inside a function, the config.log has repeated line numbers (meaning
patches 1 and 2 had a minor regression, and fixing it will also improve at
least patch 4). And while fixing it, I noticed a way to use fewer subshells in
the configure script, which is always a bonus. So, I'm committing the first
patch, then squashing the second patch on top of yours.
>From 8c0a06f866b6a4709a1c0576e99d6da3dca9b7fa Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 22 Oct 2008 10:50:26 -0600
Subject: [PATCH] Fix autoconf logging commands.
* lib/autoconf/general.m4 (AC_MSG_RESULT_UNQUOTED, _AC_EVAL)
(_AC_EVAL_STDERR, AC_RUN_LOG): Respect as_lineno.
(_AC_DO_ECHO): Likewise, and use fewer dnl.
(_AC_RUN_LOG_STDERR): Avoid subshell for logging.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
lib/autoconf/general.m4 | 16 ++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f150c5f..9e79f1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-10-22 Eric Blake <address@hidden>
+ Fix autoconf logging commands.
+ * lib/autoconf/general.m4 (AC_MSG_RESULT_UNQUOTED, _AC_EVAL)
+ (_AC_EVAL_STDERR, AC_RUN_LOG): Respect as_lineno.
+ (_AC_DO_ECHO): Likewise, and use fewer dnl.
+ (_AC_RUN_LOG_STDERR): Avoid subshell for logging.
+
+2008-10-22 Eric Blake <address@hidden>
+
Fix testsuite failure.
* tests/mktests.sh (ac_exclude_list): Don't generate test for
AC_REQUIRE_SHELL_FN.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index e0df6e7..583ac06 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2207,7 +2207,7 @@ AU_DEFUN([AC_CHECKING],
# ----------------------------------
# No escaping, so it performed also backtick substitution.
AU_DEFUN([AC_MSG_RESULT_UNQUOTED],
-[_AS_ECHO_UNQUOTED([$as_me:$LINENO: result: $1], AS_MESSAGE_LOG_FD)
+[_AS_ECHO_UNQUOTED([$as_me:${as_lineno-$LINENO}: result: $1],
AS_MESSAGE_LOG_FD)
_AS_ECHO_UNQUOTED([$1])[]dnl
])
@@ -2245,7 +2245,7 @@ AC_DEFUN([_AC_RUN_LOG],
# Note that when tracing, most shells will leave the traces in stderr
# starting with "+": that's what this macro tries to address.
AC_DEFUN([_AC_RUN_LOG_STDERR],
-[{ ($2) >&AS_MESSAGE_LOG_FD
+[{ { $2; } >&AS_MESSAGE_LOG_FD
($1) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
@@ -2259,7 +2259,7 @@ AC_DEFUN([_AC_RUN_LOG_STDERR],
# Echo COMMAND. This is designed to be used just before evaluating COMMAND.
AC_DEFUN([_AC_DO_ECHO],
[m4_if([$1], [$ac_try], [], [ac_try="$1"
-])dnl
+])]dnl
dnl If the string contains '\"', '`', or '\\', then just echo it rather
dnl than expanding it. This is a hack, but it is safer, while also
dnl typically expanding simple substrings like '$CC', which is what we want.
@@ -2273,11 +2273,11 @@ dnl `AC_CHECK_FUNC(foo, , AC_CHECK_LIB(a, foo, ,
AC_CHECK_LIB(b, foo)))'.
dnl We normally wouldn't bother with this kind of workaround for invalid code
dnl but this change was put in just before Autoconf 2.60 and we wanted to
dnl minimize the integration hassle.
-[case "(($ac_try" in
+[[case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""]
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""]
AS_ECHO(["$ac_try_echo"])])
# _AC_DO(COMMAND)
@@ -2322,7 +2322,7 @@ AC_DEFUN([_AC_DO_TOKENS],
# It is present only for backward compatibility with previous Autoconf
versions.
AC_DEFUN([_AC_EVAL],
[_AC_RUN_LOG([eval $1],
- [eval echo "$as_me:$LINENO: \"$1\""])])
+ [eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$1\""])])
# _AC_EVAL_STDERR(COMMAND)
@@ -2332,7 +2332,7 @@ AC_DEFUN([_AC_EVAL],
# It is present only for backward compatibility with previous Autoconf
versions.
AC_DEFUN([_AC_EVAL_STDERR],
[_AC_RUN_LOG_STDERR([eval $1],
- [eval echo "$as_me:$LINENO: \"$1\""])])
+ [eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$1\""])])
# AC_TRY_EVAL(VARIABLE)
@@ -2368,7 +2368,7 @@ AC_DEFUN([AC_TRY_COMMAND],
# -------------------
AC_DEFUN([AC_RUN_LOG],
[_AC_RUN_LOG([$1],
- [AS_ECHO(["$as_me:$LINENO: AS_ESCAPE([$1])"])])])
+ [AS_ECHO(["$as_me:${as_lineno-$LINENO}: AS_ESCAPE([$1])"])])])
--
1.6.0.2
>From 2fc847bb6914e3b936d162487c3f8ef7be1778a6 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 22 Oct 2008 10:58:04 -0600
Subject: [PATCH] Use a shell function for _AC_LINK_IFELSE.
* lib/autoconf/general.m4 (_AC_LINK_IFELSE_BODY): New macro.
(_AC_LINK_IFELSE): Use a shell function.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
lib/autoconf/general.m4 | 47 +++++++++++++++++++++++++++--------------------
2 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9e79f1c..bdc3244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-22 Paolo Bonzini <address@hidden>
+ and Eric Blake <address@hidden>
+
+ Use a shell function for _AC_LINK_IFELSE.
+ * lib/autoconf/general.m4 (_AC_LINK_IFELSE_BODY): New macro.
+ (_AC_LINK_IFELSE): Use a shell function.
+
2008-10-22 Eric Blake <address@hidden>
Fix autoconf logging commands.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 583ac06..04866c2 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2524,22 +2524,11 @@ AU_DEFUN([AC_TRY_COMPILE],
## --------------------- ##
-# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-# -------------------------------------------------------------
-# Try to link PROGRAM.
-# This macro can be used during the selection of a compiler.
-#
-# Test that resulting file is executable; see the problem reported by mwoehlke
-# in <http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00048.html>.
-# But skip the test when cross-compiling, to prevent problems like the one
-# reported by Chris Johns in
-# <http://lists.gnu.org/archive/html/autoconf/2007-03/msg00085.html>.
-#
-AC_DEFUN([_AC_LINK_IFELSE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_link],
- [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_link], [LINENO],
- [Try to link conftest.$ac_ext, and return whether this succeeded.])], [
- AS_LINENO_PUSH([$[]1])
+# _AC_LINK_IFELSE_BODY
+# --------------------
+# Shell function body for _AC_LINK_IFELSE.
+m4_define([_AC_LINK_IFELSE_BODY],
+[ AS_LINENO_PUSH([$[]1])
rm -f conftest.$ac_objext conftest$ac_exeext
AS_IF([_AC_DO_STDERR($ac_link) && {
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
@@ -2559,10 +2548,28 @@ AC_DEFUN([_AC_LINK_IFELSE],
conftest$ac_exeext
AS_LINENO_POP
return $ac_retval
-])dnl
-m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])
+])# _AC_LINK_IFELSE_BODY
+
+
+# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# -------------------------------------------------------------
+# Try to link PROGRAM.
+# This macro can be used during the selection of a compiler.
+#
+# Test that resulting file is executable; see the problem reported by mwoehlke
+# in <http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00048.html>.
+# But skip the test when cross-compiling, to prevent problems like the one
+# reported by Chris Johns in
+# <http://lists.gnu.org/archive/html/autoconf/2007-03/msg00085.html>.
+#
+AC_DEFUN([_AC_LINK_IFELSE],
+[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_link],
+ [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_link], [LINENO],
+ [Try to link conftest.$ac_ext, and return whether this succeeded.])],
+ [$0_BODY])]dnl
+[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
+[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
+m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
])# _AC_LINK_IFELSE
--
1.6.0.2