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