[Top][All Lists]

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

Re: Supplying header files for AC_CHECK_FUNCS to #include?

From: Eric Blake
Subject: Re: Supplying header files for AC_CHECK_FUNCS to #include?
Date: Sat, 06 Dec 2008 10:07:18 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20081105 Thunderbird/ Mnenhy/

Hash: SHA1

According to Skip Montanaro on 12/6/2008 9:49 AM:
> The Python file contains a line similar to this:
>     AC_CHECK_FUNCS(acosh asinh atanh expm1 finite isinf isnan log1p)
> On Solaris 10 isinf is not detected because the generated conftest.c
> doesn't #include <math.h>.  Is there a way to tell AC_CHECK_FUNCS
> to do that?

No - the purpose of AC_CHECK_FUNCS is to check whether the linker can find
a function by that name, independently of system headers, so there is no
reason to include any system headers.  But POSIX states that isinf must be
a macro, not a function [1], which means using AC_CHECK_FUNCS for isinf is
the wrong check (the macro does not have to expand to a function named
isinf, and the test is correctly detecting that there is no isinf
function).  The correct test, when looking for something that is only
guaranteed to be a macro, is to use AC_CHECK_DECLS, which does indeed
allow the selection of prerequisite headers.


The above test should be rewritten (with proper m4 quoting) as:

AC_CHECK_FUNCS([acosh asinh atanh expm1 finite log1p])
AC_CHECK_DECLS([isinf isnan], [], [], [[#include <math.h>]])

then your code adjusted to check for HAVE_DECL_ISINF rather than HAVE_ISINF.

But while we are at it, many platforms have a broken isinf and/or isnan,
not to mention that the limitation of linking with -lm is annoying when
these macros can be portably implemented without needing an extra library.
 You may be interested in looking into the gnulib isinf and isnan modules.;a=blob;f=m4/isinf.m4;h=1b9e45a;hb=67461c3

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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