bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)


From: Grégoire Sutre
Subject: Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)
Date: Thu, 18 Mar 2010 00:00:15 +0100
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)

Hi Eric,

> AC_CHECK_FUNCS leaves HAVE_FUNC undefined if it is missing, but defines
> HAVE_FUNC to 1 if it is present.  It is much easier to write:
>
> #if HAVE_FUNC

In that case you only need to write:

#ifdef HAVE_FUNC

which is just as simple, and is compliant with -Wundef.

Moreover, the documentation [1] of AC_CHECK_FUNCS actually does *not*
guarantee that the value will be 1, it could as well be 0 (or -1234):

Macro: AC_CHECK_FUNCS (function..., [action-if-found], [action-if-not-found])
   For each function enumerated in the blank-or-newline-separated
   argument list, define HAVE_function (in all capitals) if it is
   available.

I guess that the implementation of autoconf currently defines it to 1
(when it defines it), but it's usually better to only rely on what the
specification guarantees.  So I would definitely prefer #ifdef over #if
in that case.

Best regards,

Grégoire

[1] http://www.gnu.org/software/hello/manual/autoconf/Generic-Functions.html




reply via email to

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