bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] nl_langinfo: avoid configure-time syntax error


From: Jim Meyering
Subject: Re: [PATCH] nl_langinfo: avoid configure-time syntax error
Date: Tue, 05 Jan 2010 19:09:57 +0100

Paolo Bonzini wrote:
> 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?
...

Hi Paolo,

Your proposed version is both more concise and more readable.
One might regret however that when the test is performed here,
it is wasted effort on systems lacking langinfo.h.
Considering that the penalty is incurred only on losing systems,
this seems like a clear improvement.

> 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




reply via email to

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