bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] nl_langinfo: avoid configure-time syntax error


From: Jim Meyering
Subject: [PATCH] nl_langinfo: avoid configure-time syntax error
Date: Mon, 04 Jan 2010 15:03:20 +0100

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?

>From 9e02cb5888ff492d260536803ed9c96e1ef7b7e5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 4 Jan 2010 14:59:04 +0100
Subject: [PATCH] nl_langinfo: avoid configure-time syntax error

* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): When we've already tested
for nl_langinfo.h, AC_CHECK_FUNCS_ONCE([nl_langinfo]) expands to
the empty string.  Don't let that provoke a shell syntax error.
---
 ChangeLog         |    5 +++++
 m4/nl_langinfo.m4 |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 90e9af4..2f7b357 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-01-04  Jim Meyering  <address@hidden>

+       nl_langinfo: avoid configure-time syntax error
+       * m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): When we've already tested
+       for nl_langinfo.h, AC_CHECK_FUNCS_ONCE([nl_langinfo]) expands to
+       the empty string.  Don't let that provoke a shell syntax error.
+
        regcomp, regexec, fnmatch: avoid array bounds read error
        * lib/regcomp.c (build_equiv_class): From glibc:
        Use only the low 24 bits of a findidx return value as an index
diff --git a/m4/nl_langinfo.m4 b/m4/nl_langinfo.m4
index ecb05c4..076435f 100644
--- a/m4/nl_langinfo.m4
+++ b/m4/nl_langinfo.m4
@@ -1,4 +1,4 @@
-# nl_langinfo.m4 serial 1
+# nl_langinfo.m4 serial 2
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,7 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
   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
--
1.6.6.384.g14e6a




reply via email to

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