autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interrupt causes parse error in configure script


From: Jim Meyering
Subject: Re: interrupt causes parse error in configure script
Date: Mon, 18 Aug 2008 15:59:18 +0200

Ralf Wildenhues <address@hidden> wrote:
> * Jim Meyering wrote on Mon, Aug 18, 2008 at 12:12:29PM CEST:
>> Ralf Wildenhues <address@hidden> wrote:
>> >
>> > Doesn't this patch hide potential typos otherwise exposed by the `test'
>> > error?  AIUI gnulib uses this idiom a lot.
>>
>> Good point!
>> Here's an incremental to fix that:
>
> I don't see how that would improve things, sorry.
> (I can only actually test things tonight though,
> so this is from looking at your patch only.)

Hi Ralf,

Actually, I think that incremental change is undesirable,
and prefer the original patch.

Look at the uses of AC_VAR_SET in autoconf.
Each usually follows corresponding AS_VAR_SET uses
that set the variable in question.
Remember: this is merely replacing each of these:

  -AS_IF([test AS_VAR_GET([ac_Lib]) = yes],
  +AS_IF([AS_VAR_YES([ac_Lib])],

since the former is susceptible to the parse error
I encountered, while the latter is not.

> Maybe all you want to prevent is errors from inside the trap code?

No, I want to avoid the parse error.

Eric's suggestion looks sensible, so I've adjusted it to
make "yes" merely the default value.

Note that one of the uses of AS_VAR_GET in gnulib is not portable,
since it double-quotes the expansion of AS_VAR_GET, and you end up
with "`..."..."...`".


>From 61c80c3a03703a1c483fc0f77952ab89b62e8374 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 15 Jun 2008 17:56:37 +0200
Subject: [PATCH] AS_VAR_YES: new function, to handle an unusual failure

Prompted by this (interrupting a configure run):

    $ ./configure
    ...
    checking for alloca... (cached) yes
    checking for arpa/inet.h... (cached) yes
    ^C./configure: line 6354: test: =: unary operator expected
    ,make: *** [config.status] Error 1
    [Exit 130 (INT)]

* lib/m4sugar/m4sh.m4 (AS_VAR_YES): New function.
* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Use it in place of
"test AS_VAR_GET([...]) = yes"
* lib/autoconf/general.m4 (AC_CHECK_FILE, AC_CHECK_DECL): Likewise.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL): Likewise.
(_AC_CHECK_HEADER_NEW, _AC_CHECK_HEADER_OLD): Likewise.
(_AC_CHECK_HEADER_DIRENT): Likewise.
* lib/autoconf/libs.m4 (AC_CHECK_LIB): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, AC_CHECK_MEMBER): Likewise.
---
 lib/autoconf/functions.m4 |    2 +-
 lib/autoconf/general.m4   |    4 ++--
 lib/autoconf/headers.m4   |    8 ++++----
 lib/autoconf/libs.m4      |    2 +-
 lib/autoconf/types.m4     |    4 ++--
 lib/m4sugar/m4sh.m4       |    7 +++++++
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 78c7678..a15cdba 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -70,7 +70,7 @@ AC_CACHE_CHECK([for $1], [ac_var],
 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
                [AS_VAR_SET([ac_var], [yes])],
                [AS_VAR_SET([ac_var], [no])])])
-AS_IF([test AS_VAR_GET([ac_var]) = yes], [$2], [$3])dnl
+AS_IF([AS_VAR_YES([ac_var])], [$2], [$3])dnl
 AS_VAR_POPDEF([ac_var])dnl
 ])# AC_CHECK_FUNC

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 8af0dc4..03e18e2 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2614,7 +2614,7 @@ if test -r "$1"; then
 else
   AS_VAR_SET([ac_File], [no])
 fi])
-AS_IF([test AS_VAR_GET([ac_File]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_File])], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_File])dnl
 ])# AC_CHECK_FILE

@@ -2651,7 +2651,7 @@ AC_CACHE_CHECK([whether $1 is declared], [ac_Symbol],
 ])],
                   [AS_VAR_SET([ac_Symbol], [yes])],
                   [AS_VAR_SET([ac_Symbol], [no])])])
-AS_IF([test AS_VAR_GET([ac_Symbol]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Symbol])], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_Symbol])dnl
 ])# AC_CHECK_DECL

diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 476df37..f2f2f54 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -143,7 +143,7 @@ esac
 AC_CACHE_CHECK([for $1], [ac_Header],
               [AS_VAR_SET([ac_Header], [$ac_header_preproc])])
 ])dnl ! set ac_HEADER
-AS_IF([test AS_VAR_GET([ac_Header]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Header])], [$2], [$3])[]dnl
 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_IF([test AS_VAR_GET([ac_Header]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Header])], [$2], [$3])[]dnl
 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(address@hidden:@include 
<$1>])],
                                         [AS_VAR_SET([ac_Header], [yes])],
                                         [AS_VAR_SET([ac_Header], [no])])])
-AS_IF([test AS_VAR_GET([ac_Header]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Header])], [$2], [$3])[]dnl
 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_IF([test AS_VAR_GET([ac_Header]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Header])], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_Header])dnl
 ])# _AC_CHECK_HEADER_DIRENT

diff --git a/lib/autoconf/libs.m4 b/lib/autoconf/libs.m4
index 429918c..04f7202 100644
--- a/lib/autoconf/libs.m4
+++ b/lib/autoconf/libs.m4
@@ -130,7 +130,7 @@ AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
               [AS_VAR_SET([ac_Lib], [yes])],
               [AS_VAR_SET([ac_Lib], [no])])
 LIBS=$ac_check_lib_save_LIBS])
-AS_IF([test AS_VAR_GET([ac_Lib]) = yes],
+AS_IF([AS_VAR_YES([ac_Lib])],
       [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
   LIBS="-l$1 $LIBS"
 ])],
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index 50a489c..20ffb2b 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -160,7 +160,7 @@ AC_COMPILE_IFELSE(
          return 0;])],
      [],
      [AS_VAR_SET([ac_Type], [yes])])])])
-AS_IF([test AS_VAR_GET([ac_Type]) = yes], [$2], [$3])[]dnl
+AS_IF([AS_VAR_YES([ac_Type])], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_Type])dnl
 ])# _AC_CHECK_TYPE_NEW

@@ -834,7 +834,7 @@ if (sizeof ac_aggr.m4_bpatsubst([$1], [^[^.]*\.]))
 return 0;])],
                [AS_VAR_SET([ac_Member], [yes])],
                [AS_VAR_SET([ac_Member], [no])])])])
-AS_IF([test AS_VAR_GET([ac_Member]) = yes], [$2], [$3])dnl
+AS_IF([AS_VAR_YES([ac_Member])], [$2], [$3])dnl
 AS_VAR_POPDEF([ac_Member])dnl
 ])# AC_CHECK_MEMBER

diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 3dd735e..dd5ec99 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1544,6 +1544,13 @@ m4_define([AS_VAR_SET],
               [eval "$1=AS_ESCAPE([$2])"])])


+# AS_VAR_YES(VARIABLE, [VALUE = yes])
+# --------------------
+# Succeed if VARIABLE has the value, VALUE.
+m4_define([AS_VAR_YES],
+[as_yes=AS_VAR_GET([$1]); test "x$as_yes" = x""m4_default([$2], [yes])])
+
+
 # AS_VAR_GET(VARIABLE)
 # --------------------
 # Get the value of the shell VARIABLE.
--
1.6.0.4.g750768




reply via email to

[Prev in Thread] Current Thread [Next in Thread]