[Top][All Lists]

[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: Eric Blake
Subject: Re: [PATCH] Fix use of ENABLE_NLS (which is not always defined)
Date: Wed, 17 Mar 2010 17:18:39 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3

On 03/17/2010 05:00 PM, Grégoire Sutre wrote:
> 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.

Then you contrast it with AC_CHECK_DECL, which defines


to either 0 or 1, but always defines it.  If you use #ifdef in those
situations, you lose (you typed 3 more bytes, and you get the wrong result).

It is a maintenance nightmare to remember which variables are defined as
0 and which are left undefined, and much simpler to blindly use #if than
it is to decide when #ifdef is necessary.

> 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):

Actually, it DOES guarantee that it will be 1, but the guarantee is
(admittedly indirectly) specified elsewhere in the manual (that is,
AC_DEFINE defaults to 1 in the absence of any other value, and
AC_CHECK_FUNCS does not provide an interface to inject any other value.
 Autoconf will NOT be changing the use of AC_CHECK_FUNCS; but I am open
to doc patches to make this point more clear.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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