On 02/10/2014 05:10 PM, Laine Stump wrote:
>
> AC_CHECK_DECLS unconditionally defines the variable to either 0 or 1, so
> checking if it is defined will still fail to compile on older headers
> that lack the enum;
Well, it would have compiled successfully, but compiled the wrong code :-)
> what you want is to check that it has a non-zero value.
Now that I've seen this, it bugs me that all HAVE_* #defines aren't
consistent about this - some are undefined if the capability is missing,
and some are #defined, but to 0.
It's historical baggage of autoconf - the various checks were written at
different times, but autoconf can't change the older checks to always
define the macro because of back-compat. The general rule of thumb is
HAVE_DECL_ is always defined, any other HAVE_ is likely undefined if the
feature is missing.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org