On 01/04/2010 03:03 PM, Jim Meyering wrote:
Testing my proposed make-regex-use-nl_langinfo changes,
I encountered this configure failure:
     ...
     checking whether<netinet/in.h>  is self-contained... yes
     ./configure: line 31968: syntax error near unexpected token `else'
     ./configure: line 31968: `  else'

It was due to this syntax error:

     if test $HAVE_LANGINFO_H = 1; then

     else
       ac_cv_func_nl_langinfo=no
     fi

Here's the work-around.
However, it would be far better if AC_CHECK_FUNCS_ONCE
were to expand to e.g., ":" rather than the empty string,
so that it can be used unadorned in situations like the above.
Otherwise, it looks like a pitfall designed to trap the uninitiated.

Bruno, ok to apply?

No, AC_CHECK_FUNCS_ONCE should _always_ expand to an empty string. The test is done always---and it is done outside the macro. It's clearer to do as in the attached patch. Bruno, is this okay?

Paolo
>From a22711636c61ed549191b7993662a1fb4a544b53 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <bonz...@gnu.org>
Date: Tue, 5 Jan 2010 18:54:29 +0100
Subject: [PATCH] nl_langinfo: do not call AC_CHECK_FUNC_ONCE inside if.

* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Do not call
AC_CHECK_FUNC_ONCE inside if, do not adjust ac_cv_func_nl_langinfo.
---
 ChangeLog         |    6 ++++++
 m4/nl_langinfo.m4 |   10 +++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2857d3d..fd6fa65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-05  Paolo Bonzini  <bonz...@gnu.org>
+
+       nl_langinfo: do not call AC_CHECK_FUNC_ONCE inside if.
+       * m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Do not call
+       AC_CHECK_FUNC_ONCE inside if, do not adjust ac_cv_func_nl_langinfo.
+
 2010-01-05  Jim Meyering  <meyer...@redhat.com>
 
        maint: remove useless inclusions of "xalloc.h"
diff --git a/m4/nl_langinfo.m4 b/m4/nl_langinfo.m4
index 076435f..e13546b 100644
--- a/m4/nl_langinfo.m4
+++ b/m4/nl_langinfo.m4
@@ -8,13 +8,9 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
 [
   AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
   AC_REQUIRE([gl_LANGINFO_H])
-  if test $HAVE_LANGINFO_H = 1; then
-    AC_CHECK_FUNCS_ONCE([nl_langinfo])
-    : # in case AC_CHECK_FUNCS_ONCE expands to nothing
-  else
-    ac_cv_func_nl_langinfo=no
-  fi
-  if test $ac_cv_func_nl_langinfo = yes; then
+  AC_CHECK_FUNCS_ONCE([nl_langinfo])
+  if test $HAVE_LANGINFO_H = 1 \
+     && test x$ac_cv_func_nl_langinfo = xyes; then
     if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then
       :
     else
-- 
1.6.5.2

Reply via email to