Patchwork libgfortran: do not assume libm

login
register
mail settings
Submitter Tristan Gingold
Date March 20, 2012, 9:01 a.m.
Message ID <3B352F61-8E1D-4708-A9B4-C2191C0F9F18@adacore.com>
Download mbox | patch
Permalink /patch/147767/
State New
Headers show

Comments

Tristan Gingold - March 20, 2012, 9:01 a.m.
Hi,

I am starting to build fortran for VMS.

The first serious issue was with libgfortran/configure.  It checks for several math functions, but directly in libm using AC_CHECK_LIB.
But there is on such things as libm on VMS systems (thus requiring to define MATH_LIBRARY as "").  Therefore all these tests fail,
resulting in a failure during libgfortran build.

I think the best way to test for the math function is to use AC_CHECK_DECLS as hinted by the autoconf manual
(cf the AC_CHECK_DECLS example in http://www.gnu.org/software/autoconf/manual/autoconf.html
         AC_CHECK_DECLS([j0], [], [], [[#include <math.h>]])
         AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])

)
but I am not an autoconf expert.

I think that this change makes the AIX specific check for __clog obsolete, but I haven't removed it.

With this change I was able to cross build libgfortran for VMS (ia64 and alpha).
I have also bootstrapped gcc for x86_64-darwin, without fortran regressions.

Ok for trunk ?

Tristan.

libgfortran/
2012-03-20  Tristan Gingold  <gingold@adacore.com>

	* configure.ac: Check for libm.  Use AC_CHECK_DECLS for
	math functions.
	* configure: Regenerate.
Ralf Corsepius - March 20, 2012, 9:56 a.m.
On 03/20/2012 10:01 AM, Tristan Gingold wrote:
> Hi,
>
> I am starting to build fortran for VMS.
>
> The first serious issue was with libgfortran/configure.  It checks for several math functions, but directly in libm using AC_CHECK_LIB.
> But there is on such things as libm on VMS systems (thus requiring to define MATH_LIBRARY as "").  Therefore all these tests fail,
> resulting in a failure during libgfortran build.
>
> I think the best way to test for the math function is to use AC_CHECK_DECLS as hinted by the autoconf manual
> (cf the AC_CHECK_DECLS example in http://www.gnu.org/software/autoconf/manual/autoconf.html
>           AC_CHECK_DECLS([j0], [], [], [[#include<math.h>]])
>           AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])
>
> )
> but I am not an autoconf expert.
>
> I think that this change makes the AIX specific check for __clog obsolete, but I haven't removed it.
>
> With this change I was able to cross build libgfortran for VMS (ia64 and alpha).
> I have also bootstrapped gcc for x86_64-darwin, without fortran regressions.
>
> Ok for trunk ?

IMO, no.

What you are doing here is to replace checks, which check for presence 
of a symbol in a library (e.g. cos in libm.*) by checks for presence of 
a symbol's declaration inside of a header.

This is something entirely different (This also reflects in 
AC_CHECK_DECL by default providing HAVE_DECL_XXX defines).

Also note that it's not uncommon to have declarations inside of headers, 
which are not present inside of a library.

Ralf
Tristan Gingold - March 20, 2012, 10:16 a.m.
On Mar 20, 2012, at 10:56 AM, Ralf Corsepius wrote:

> On 03/20/2012 10:01 AM, Tristan Gingold wrote:
>> Hi,
>> 
>> I am starting to build fortran for VMS.
>> 
>> The first serious issue was with libgfortran/configure.  It checks for several math functions, but directly in libm using AC_CHECK_LIB.
>> But there is on such things as libm on VMS systems (thus requiring to define MATH_LIBRARY as "").  Therefore all these tests fail,
>> resulting in a failure during libgfortran build.
>> 
>> I think the best way to test for the math function is to use AC_CHECK_DECLS as hinted by the autoconf manual
>> (cf the AC_CHECK_DECLS example in http://www.gnu.org/software/autoconf/manual/autoconf.html
>>          AC_CHECK_DECLS([j0], [], [], [[#include<math.h>]])
>>          AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])
>> 
>> )
>> but I am not an autoconf expert.
>> 
>> I think that this change makes the AIX specific check for __clog obsolete, but I haven't removed it.
>> 
>> With this change I was able to cross build libgfortran for VMS (ia64 and alpha).
>> I have also bootstrapped gcc for x86_64-darwin, without fortran regressions.
>> 
>> Ok for trunk ?
> 
> IMO, no.
> 
> What you are doing here is to replace checks, which check for presence of a symbol in a library (e.g. cos in libm.*) by checks for presence of a symbol's declaration inside of a header.
> 
> This is something entirely different (This also reflects in AC_CHECK_DECL by default providing HAVE_DECL_XXX defines).

Ah, indeed.  I missed that.

> Also note that it's not uncommon to have declarations inside of headers, which are not present inside of a library.

So, I should use AC_LINK_IFELSE instead, shouldn't I ?

Tristan.

Patch

diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 7011a93..aaaedc2 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -268,192 +268,195 @@  strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
 getcwd localtime_r gmtime_r strerror_r getpwuid_r ttyname_r clock_gettime \
 readlink getgid getpid getppid getuid geteuid umask)
 
+# Check for libm
+AC_CHECK_LIB([m],[sin])
+
 # Check for C99 (and other IEEE) math functions
-AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
-AC_CHECK_LIB([m],[acos],[AC_DEFINE([HAVE_ACOS],[1],[libm includes acos])])
-AC_CHECK_LIB([m],[acosl],[AC_DEFINE([HAVE_ACOSL],[1],[libm includes acosl])])
-AC_CHECK_LIB([m],[acoshf],[AC_DEFINE([HAVE_ACOSHF],[1],[libm includes acoshf])])
-AC_CHECK_LIB([m],[acosh],[AC_DEFINE([HAVE_ACOSH],[1],[libm includes acosh])])
-AC_CHECK_LIB([m],[acoshl],[AC_DEFINE([HAVE_ACOSHL],[1],[libm includes acoshl])])
-AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
-AC_CHECK_LIB([m],[asin],[AC_DEFINE([HAVE_ASIN],[1],[libm includes asin])])
-AC_CHECK_LIB([m],[asinl],[AC_DEFINE([HAVE_ASINL],[1],[libm includes asinl])])
-AC_CHECK_LIB([m],[asinhf],[AC_DEFINE([HAVE_ASINHF],[1],[libm includes asinhf])])
-AC_CHECK_LIB([m],[asinh],[AC_DEFINE([HAVE_ASINH],[1],[libm includes asinh])])
-AC_CHECK_LIB([m],[asinhl],[AC_DEFINE([HAVE_ASINHL],[1],[libm includes asinhl])])
-AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
-AC_CHECK_LIB([m],[atan2],[AC_DEFINE([HAVE_ATAN2],[1],[libm includes atan2])])
-AC_CHECK_LIB([m],[atan2l],[AC_DEFINE([HAVE_ATAN2L],[1],[libm includes atan2l])])
-AC_CHECK_LIB([m],[atanf],[AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
-AC_CHECK_LIB([m],[atan],[AC_DEFINE([HAVE_ATAN],[1],[libm includes atan])])
-AC_CHECK_LIB([m],[atanl],[AC_DEFINE([HAVE_ATANL],[1],[libm includes atanl])])
-AC_CHECK_LIB([m],[atanhf],[AC_DEFINE([HAVE_ATANHF],[1],[libm includes atanhf])])
-AC_CHECK_LIB([m],[atanh],[AC_DEFINE([HAVE_ATANH],[1],[libm includes atanh])])
-AC_CHECK_LIB([m],[atanhl],[AC_DEFINE([HAVE_ATANHL],[1],[libm includes atanhl])])
-AC_CHECK_LIB([m],[cargf],[AC_DEFINE([HAVE_CARGF],[1],[libm includes cargf])])
-AC_CHECK_LIB([m],[carg],[AC_DEFINE([HAVE_CARG],[1],[libm includes carg])])
-AC_CHECK_LIB([m],[cargl],[AC_DEFINE([HAVE_CARGL],[1],[libm includes cargl])])
-AC_CHECK_LIB([m],[ceilf],[AC_DEFINE([HAVE_CEILF],[1],[libm includes ceilf])])
-AC_CHECK_LIB([m],[ceil],[AC_DEFINE([HAVE_CEIL],[1],[libm includes ceil])])
-AC_CHECK_LIB([m],[ceill],[AC_DEFINE([HAVE_CEILL],[1],[libm includes ceill])])
-AC_CHECK_LIB([m],[copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1],[libm includes copysignf])])
-AC_CHECK_LIB([m],[copysign],[AC_DEFINE([HAVE_COPYSIGN],[1],[libm includes copysign])])
-AC_CHECK_LIB([m],[copysignl],[AC_DEFINE([HAVE_COPYSIGNL],[1],[libm includes copysignl])])
-AC_CHECK_LIB([m],[cosf],[AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
-AC_CHECK_LIB([m],[cos],[AC_DEFINE([HAVE_COS],[1],[libm includes cos])])
-AC_CHECK_LIB([m],[cosl],[AC_DEFINE([HAVE_COSL],[1],[libm includes cosl])])
-AC_CHECK_LIB([m],[ccosf],[AC_DEFINE([HAVE_CCOSF],[1],[libm includes ccosf])])
-AC_CHECK_LIB([m],[ccos],[AC_DEFINE([HAVE_CCOS],[1],[libm includes ccos])])
-AC_CHECK_LIB([m],[ccosl],[AC_DEFINE([HAVE_CCOSL],[1],[libm includes ccosl])])
-AC_CHECK_LIB([m],[coshf],[AC_DEFINE([HAVE_COSHF],[1],[libm includes coshf])])
-AC_CHECK_LIB([m],[cosh],[AC_DEFINE([HAVE_COSH],[1],[libm includes cosh])])
-AC_CHECK_LIB([m],[coshl],[AC_DEFINE([HAVE_COSHL],[1],[libm includes coshl])])
-AC_CHECK_LIB([m],[ccoshf],[AC_DEFINE([HAVE_CCOSHF],[1],[libm includes ccoshf])])
-AC_CHECK_LIB([m],[ccosh],[AC_DEFINE([HAVE_CCOSH],[1],[libm includes ccosh])])
-AC_CHECK_LIB([m],[ccoshl],[AC_DEFINE([HAVE_CCOSHL],[1],[libm includes ccoshl])])
-AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
-AC_CHECK_LIB([m],[exp],[AC_DEFINE([HAVE_EXP],[1],[libm includes exp])])
-AC_CHECK_LIB([m],[expl],[AC_DEFINE([HAVE_EXPL],[1],[libm includes expl])])
-AC_CHECK_LIB([m],[cexpf],[AC_DEFINE([HAVE_CEXPF],[1],[libm includes cexpf])])
-AC_CHECK_LIB([m],[cexp],[AC_DEFINE([HAVE_CEXP],[1],[libm includes cexp])])
-AC_CHECK_LIB([m],[cexpl],[AC_DEFINE([HAVE_CEXPL],[1],[libm includes cexpl])])
-AC_CHECK_LIB([m],[fabsf],[AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
-AC_CHECK_LIB([m],[fabs],[AC_DEFINE([HAVE_FABS],[1],[libm includes fabs])])
-AC_CHECK_LIB([m],[fabsl],[AC_DEFINE([HAVE_FABSL],[1],[libm includes fabsl])])
-AC_CHECK_LIB([m],[cabsf],[AC_DEFINE([HAVE_CABSF],[1],[libm includes cabsf])])
-AC_CHECK_LIB([m],[cabs],[AC_DEFINE([HAVE_CABS],[1],[libm includes cabs])])
-AC_CHECK_LIB([m],[cabsl],[AC_DEFINE([HAVE_CABSL],[1],[libm includes cabsl])])
-AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
-AC_CHECK_LIB([m],[floor],[AC_DEFINE([HAVE_FLOOR],[1],[libm includes floor])])
-AC_CHECK_LIB([m],[floorl],[AC_DEFINE([HAVE_FLOORL],[1],[libm includes floorl])])
-AC_CHECK_LIB([m],[fmodf],[AC_DEFINE([HAVE_FMODF],[1],[libm includes fmodf])])
-AC_CHECK_LIB([m],[fmod],[AC_DEFINE([HAVE_FMOD],[1],[libm includes fmod])])
-AC_CHECK_LIB([m],[fmodl],[AC_DEFINE([HAVE_FMODL],[1],[libm includes fmodl])])
-AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
-AC_CHECK_LIB([m],[frexp],[AC_DEFINE([HAVE_FREXP],[1],[libm includes frexp])])
-AC_CHECK_LIB([m],[frexpl],[AC_DEFINE([HAVE_FREXPL],[1],[libm includes frexpl])])
-AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
-AC_CHECK_LIB([m],[hypot],[AC_DEFINE([HAVE_HYPOT],[1],[libm includes hypot])])
-AC_CHECK_LIB([m],[hypotl],[AC_DEFINE([HAVE_HYPOTL],[1],[libm includes hypotl])])
-AC_CHECK_LIB([m],[ldexpf],[AC_DEFINE([HAVE_LDEXPF],[1],[libm includes ldexpf])])
-AC_CHECK_LIB([m],[ldexp],[AC_DEFINE([HAVE_LDEXP],[1],[libm includes ldexp])])
-AC_CHECK_LIB([m],[ldexpl],[AC_DEFINE([HAVE_LDEXPL],[1],[libm includes ldexpl])])
-AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
-AC_CHECK_LIB([m],[log],[AC_DEFINE([HAVE_LOG],[1],[libm includes log])])
-AC_CHECK_LIB([m],[logl],[AC_DEFINE([HAVE_LOGL],[1],[libm includes logl])])
-AC_CHECK_LIB([m],[clogf],[AC_DEFINE([HAVE_CLOGF],[1],[libm includes clogf])])
-AC_CHECK_LIB([m],[clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
-AC_CHECK_LIB([m],[clogl],[AC_DEFINE([HAVE_CLOGL],[1],[libm includes clogl])])
-AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
-AC_CHECK_LIB([m],[log10],[AC_DEFINE([HAVE_LOG10],[1],[libm includes log10])])
-AC_CHECK_LIB([m],[log10l],[AC_DEFINE([HAVE_LOG10L],[1],[libm includes log10l])])
-AC_CHECK_LIB([m],[clog10f],[AC_DEFINE([HAVE_CLOG10F],[1],[libm includes clog10f])])
-AC_CHECK_LIB([m],[clog10],[AC_DEFINE([HAVE_CLOG10],[1],[libm includes clog10])])
-AC_CHECK_LIB([m],[clog10l],[AC_DEFINE([HAVE_CLOG10L],[1],[libm includes clog10l])])
-AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
-AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
-AC_CHECK_LIB([m],[nextafterl],[AC_DEFINE([HAVE_NEXTAFTERL],[1],[libm includes nextafterl])])
-AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
-AC_CHECK_LIB([m],[pow],[AC_DEFINE([HAVE_POW],[1],[libm includes pow])])
-AC_CHECK_LIB([m],[powl],[AC_DEFINE([HAVE_POWL],[1],[libm includes powl])])
-AC_CHECK_LIB([m],[cpowf],[AC_DEFINE([HAVE_CPOWF],[1],[libm includes cpowf])])
-AC_CHECK_LIB([m],[cpow],[AC_DEFINE([HAVE_CPOW],[1],[libm includes cpow])])
-AC_CHECK_LIB([m],[cpowl],[AC_DEFINE([HAVE_CPOWL],[1],[libm includes cpowl])])
-AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
-AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
-AC_CHECK_LIB([m],[roundl],[AC_DEFINE([HAVE_ROUNDL],[1],[libm includes roundl])])
-AC_CHECK_LIB([m],[lroundf],[AC_DEFINE([HAVE_LROUNDF],[1],[libm includes lroundf])])
-AC_CHECK_LIB([m],[lround],[AC_DEFINE([HAVE_LROUND],[1],[libm includes lround])])
-AC_CHECK_LIB([m],[lroundl],[AC_DEFINE([HAVE_LROUNDL],[1],[libm includes lroundl])])
-AC_CHECK_LIB([m],[llroundf],[AC_DEFINE([HAVE_LLROUNDF],[1],[libm includes llroundf])])
-AC_CHECK_LIB([m],[llround],[AC_DEFINE([HAVE_LLROUND],[1],[libm includes llround])])
-AC_CHECK_LIB([m],[llroundl],[AC_DEFINE([HAVE_LLROUNDL],[1],[libm includes llroundl])])
-AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
-AC_CHECK_LIB([m],[scalbn],[AC_DEFINE([HAVE_SCALBN],[1],[libm includes scalbn])])
-AC_CHECK_LIB([m],[scalbnl],[AC_DEFINE([HAVE_SCALBNL],[1],[libm includes scalbnl])])
-AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
-AC_CHECK_LIB([m],[sin],[AC_DEFINE([HAVE_SIN],[1],[libm includes sin])])
-AC_CHECK_LIB([m],[sinl],[AC_DEFINE([HAVE_SINL],[1],[libm includes sinl])])
-AC_CHECK_LIB([m],[csinf],[AC_DEFINE([HAVE_CSINF],[1],[libm includes csinf])])
-AC_CHECK_LIB([m],[csin],[AC_DEFINE([HAVE_CSIN],[1],[libm includes csin])])
-AC_CHECK_LIB([m],[csinl],[AC_DEFINE([HAVE_CSINL],[1],[libm includes csinl])])
-AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
-AC_CHECK_LIB([m],[sinh],[AC_DEFINE([HAVE_SINH],[1],[libm includes sinh])])
-AC_CHECK_LIB([m],[sinhl],[AC_DEFINE([HAVE_SINHL],[1],[libm includes sinhl])])
-AC_CHECK_LIB([m],[csinhf],[AC_DEFINE([HAVE_CSINHF],[1],[libm includes csinhf])])
-AC_CHECK_LIB([m],[csinh],[AC_DEFINE([HAVE_CSINH],[1],[libm includes csinh])])
-AC_CHECK_LIB([m],[csinhl],[AC_DEFINE([HAVE_CSINHL],[1],[libm includes csinhl])])
-AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
-AC_CHECK_LIB([m],[sqrt],[AC_DEFINE([HAVE_SQRT],[1],[libm includes sqrt])])
-AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
-AC_CHECK_LIB([m],[csqrtf],[AC_DEFINE([HAVE_CSQRTF],[1],[libm includes csqrtf])])
-AC_CHECK_LIB([m],[csqrt],[AC_DEFINE([HAVE_CSQRT],[1],[libm includes csqrt])])
-AC_CHECK_LIB([m],[csqrtl],[AC_DEFINE([HAVE_CSQRTL],[1],[libm includes csqrtl])])
-AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
-AC_CHECK_LIB([m],[tan],[AC_DEFINE([HAVE_TAN],[1],[libm includes tan])])
-AC_CHECK_LIB([m],[tanl],[AC_DEFINE([HAVE_TANL],[1],[libm includes tanl])])
-AC_CHECK_LIB([m],[ctanf],[AC_DEFINE([HAVE_CTANF],[1],[libm includes ctanf])])
-AC_CHECK_LIB([m],[ctan],[AC_DEFINE([HAVE_CTAN],[1],[libm includes ctan])])
-AC_CHECK_LIB([m],[ctanl],[AC_DEFINE([HAVE_CTANL],[1],[libm includes ctanl])])
-AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
-AC_CHECK_LIB([m],[tanh],[AC_DEFINE([HAVE_TANH],[1],[libm includes tanh])])
-AC_CHECK_LIB([m],[tanhl],[AC_DEFINE([HAVE_TANHL],[1],[libm includes tanhl])])
-AC_CHECK_LIB([m],[ctanhf],[AC_DEFINE([HAVE_CTANHF],[1],[libm includes ctanhf])])
-AC_CHECK_LIB([m],[ctanh],[AC_DEFINE([HAVE_CTANH],[1],[libm includes ctanh])])
-AC_CHECK_LIB([m],[ctanhl],[AC_DEFINE([HAVE_CTANHL],[1],[libm includes ctanhl])])
-AC_CHECK_LIB([m],[truncf],[AC_DEFINE([HAVE_TRUNCF],[1],[libm includes truncf])])
-AC_CHECK_LIB([m],[trunc],[AC_DEFINE([HAVE_TRUNC],[1],[libm includes trunc])])
-AC_CHECK_LIB([m],[truncl],[AC_DEFINE([HAVE_TRUNCL],[1],[libm includes truncl])])
-AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
-AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
-AC_CHECK_LIB([m],[erfl],[AC_DEFINE([HAVE_ERFL],[1],[libm includes erfl])])
-AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
-AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
-AC_CHECK_LIB([m],[erfcl],[AC_DEFINE([HAVE_ERFCL],[1],[libm includes erfcl])])
-AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
-AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
-AC_CHECK_LIB([m],[j0l],[AC_DEFINE([HAVE_J0L],[1],[libm includes j0l])])
-AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
-AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
-AC_CHECK_LIB([m],[j1l],[AC_DEFINE([HAVE_J1L],[1],[libm includes j1l])])
-AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
-AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
-AC_CHECK_LIB([m],[jnl],[AC_DEFINE([HAVE_JNL],[1],[libm includes jnl])])
-AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
-AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
-AC_CHECK_LIB([m],[y0l],[AC_DEFINE([HAVE_Y0L],[1],[libm includes y0l])])
-AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
-AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
-AC_CHECK_LIB([m],[y1l],[AC_DEFINE([HAVE_Y1L],[1],[libm includes y1l])])
-AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
-AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
-AC_CHECK_LIB([m],[ynl],[AC_DEFINE([HAVE_YNL],[1],[libm includes ynl])])
-AC_CHECK_LIB([m],[tgamma],[AC_DEFINE([HAVE_TGAMMA],[1],[libm includes tgamma])])
-AC_CHECK_LIB([m],[tgammaf],[AC_DEFINE([HAVE_TGAMMAF],[1],[libm includes tgammaf])])
-AC_CHECK_LIB([m],[tgammal],[AC_DEFINE([HAVE_TGAMMAL],[1],[libm includes tgammal])])
-AC_CHECK_LIB([m],[lgamma],[AC_DEFINE([HAVE_LGAMMA],[1],[libm includes lgamma])])
-AC_CHECK_LIB([m],[lgammaf],[AC_DEFINE([HAVE_LGAMMAF],[1],[libm includes lgammaf])])
-AC_CHECK_LIB([m],[lgammal],[AC_DEFINE([HAVE_LGAMMAL],[1],[libm includes lgammal])])
+AC_CHECK_DECLS([acosf],[AC_DEFINE([HAVE_ACOSF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([acos],[AC_DEFINE([HAVE_ACOS],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([acosl],[AC_DEFINE([HAVE_ACOSL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([acoshf],[AC_DEFINE([HAVE_ACOSHF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([acosh],[AC_DEFINE([HAVE_ACOSH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([acoshl],[AC_DEFINE([HAVE_ACOSHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asinf],[AC_DEFINE([HAVE_ASINF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asin],[AC_DEFINE([HAVE_ASIN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asinl],[AC_DEFINE([HAVE_ASINL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asinhf],[AC_DEFINE([HAVE_ASINHF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asinh],[AC_DEFINE([HAVE_ASINH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([asinhl],[AC_DEFINE([HAVE_ASINHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atan2f],[AC_DEFINE([HAVE_ATAN2F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atan2],[AC_DEFINE([HAVE_ATAN2],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atan2l],[AC_DEFINE([HAVE_ATAN2L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atanf],[AC_DEFINE([HAVE_ATANF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atan],[AC_DEFINE([HAVE_ATAN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atanl],[AC_DEFINE([HAVE_ATANL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atanhf],[AC_DEFINE([HAVE_ATANHF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atanh],[AC_DEFINE([HAVE_ATANH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([atanhl],[AC_DEFINE([HAVE_ATANHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cargf],[AC_DEFINE([HAVE_CARGF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([carg],[AC_DEFINE([HAVE_CARG],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cargl],[AC_DEFINE([HAVE_CARGL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ceilf],[AC_DEFINE([HAVE_CEILF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ceil],[AC_DEFINE([HAVE_CEIL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ceill],[AC_DEFINE([HAVE_CEILL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([copysign],[AC_DEFINE([HAVE_COPYSIGN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([copysignl],[AC_DEFINE([HAVE_COPYSIGNL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cosf],[AC_DEFINE([HAVE_COSF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cos],[AC_DEFINE([HAVE_COS],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cosl],[AC_DEFINE([HAVE_COSL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ccosf],[AC_DEFINE([HAVE_CCOSF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ccos],[AC_DEFINE([HAVE_CCOS],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ccosl],[AC_DEFINE([HAVE_CCOSL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([coshf],[AC_DEFINE([HAVE_COSHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cosh],[AC_DEFINE([HAVE_COSH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([coshl],[AC_DEFINE([HAVE_COSHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ccoshf],[AC_DEFINE([HAVE_CCOSHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ccosh],[AC_DEFINE([HAVE_CCOSH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ccoshl],[AC_DEFINE([HAVE_CCOSHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([expf],[AC_DEFINE([HAVE_EXPF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([exp],[AC_DEFINE([HAVE_EXP],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([expl],[AC_DEFINE([HAVE_EXPL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cexpf],[AC_DEFINE([HAVE_CEXPF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cexp],[AC_DEFINE([HAVE_CEXP],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cexpl],[AC_DEFINE([HAVE_CEXPL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([fabsf],[AC_DEFINE([HAVE_FABSF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([fabs],[AC_DEFINE([HAVE_FABS],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([fabsl],[AC_DEFINE([HAVE_FABSL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cabsf],[AC_DEFINE([HAVE_CABSF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cabs],[AC_DEFINE([HAVE_CABS],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cabsl],[AC_DEFINE([HAVE_CABSL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([floorf],[AC_DEFINE([HAVE_FLOORF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([floor],[AC_DEFINE([HAVE_FLOOR],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([floorl],[AC_DEFINE([HAVE_FLOORL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([fmodf],[AC_DEFINE([HAVE_FMODF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([fmod],[AC_DEFINE([HAVE_FMOD],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([fmodl],[AC_DEFINE([HAVE_FMODL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([frexpf],[AC_DEFINE([HAVE_FREXPF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([frexp],[AC_DEFINE([HAVE_FREXP],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([frexpl],[AC_DEFINE([HAVE_FREXPL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([hypotf],[AC_DEFINE([HAVE_HYPOTF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([hypot],[AC_DEFINE([HAVE_HYPOT],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([hypotl],[AC_DEFINE([HAVE_HYPOTL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ldexpf],[AC_DEFINE([HAVE_LDEXPF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ldexp],[AC_DEFINE([HAVE_LDEXP],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ldexpl],[AC_DEFINE([HAVE_LDEXPL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([logf],[AC_DEFINE([HAVE_LOGF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([log],[AC_DEFINE([HAVE_LOG],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([logl],[AC_DEFINE([HAVE_LOGL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([clogf],[AC_DEFINE([HAVE_CLOGF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([clog],[AC_DEFINE([HAVE_CLOG],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([clogl],[AC_DEFINE([HAVE_CLOGL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([log10f],[AC_DEFINE([HAVE_LOG10F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([log10],[AC_DEFINE([HAVE_LOG10],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([log10l],[AC_DEFINE([HAVE_LOG10L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([clog10f],[AC_DEFINE([HAVE_CLOG10F],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([clog10],[AC_DEFINE([HAVE_CLOG10],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([clog10l],[AC_DEFINE([HAVE_CLOG10L],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([nextafterl],[AC_DEFINE([HAVE_NEXTAFTERL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([powf],[AC_DEFINE([HAVE_POWF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([pow],[AC_DEFINE([HAVE_POW],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([powl],[AC_DEFINE([HAVE_POWL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([cpowf],[AC_DEFINE([HAVE_CPOWF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cpow],[AC_DEFINE([HAVE_CPOW],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cpowl],[AC_DEFINE([HAVE_CPOWL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([roundf],[AC_DEFINE([HAVE_ROUNDF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([round],[AC_DEFINE([HAVE_ROUND],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([roundl],[AC_DEFINE([HAVE_ROUNDL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lroundf],[AC_DEFINE([HAVE_LROUNDF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lround],[AC_DEFINE([HAVE_LROUND],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lroundl],[AC_DEFINE([HAVE_LROUNDL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([llroundf],[AC_DEFINE([HAVE_LLROUNDF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([llround],[AC_DEFINE([HAVE_LLROUND],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([llroundl],[AC_DEFINE([HAVE_LLROUNDL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([scalbn],[AC_DEFINE([HAVE_SCALBN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([scalbnl],[AC_DEFINE([HAVE_SCALBNL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sinf],[AC_DEFINE([HAVE_SINF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sin],[AC_DEFINE([HAVE_SIN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sinl],[AC_DEFINE([HAVE_SINL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([csinf],[AC_DEFINE([HAVE_CSINF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csin],[AC_DEFINE([HAVE_CSIN],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csinl],[AC_DEFINE([HAVE_CSINL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([sinhf],[AC_DEFINE([HAVE_SINHF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sinh],[AC_DEFINE([HAVE_SINH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sinhl],[AC_DEFINE([HAVE_SINHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([csinhf],[AC_DEFINE([HAVE_CSINHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csinh],[AC_DEFINE([HAVE_CSINH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csinhl],[AC_DEFINE([HAVE_CSINHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([sqrtf],[AC_DEFINE([HAVE_SQRTF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sqrt],[AC_DEFINE([HAVE_SQRT],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([sqrtl],[AC_DEFINE([HAVE_SQRTL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([csqrtf],[AC_DEFINE([HAVE_CSQRTF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csqrt],[AC_DEFINE([HAVE_CSQRT],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([csqrtl],[AC_DEFINE([HAVE_CSQRTL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([tanf],[AC_DEFINE([HAVE_TANF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tan],[AC_DEFINE([HAVE_TAN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tanl],[AC_DEFINE([HAVE_TANL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ctanf],[AC_DEFINE([HAVE_CTANF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ctan],[AC_DEFINE([HAVE_CTAN],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ctanl],[AC_DEFINE([HAVE_CTANL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([tanhf],[AC_DEFINE([HAVE_TANHF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tanh],[AC_DEFINE([HAVE_TANH],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tanhl],[AC_DEFINE([HAVE_TANHL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ctanhf],[AC_DEFINE([HAVE_CTANHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ctanh],[AC_DEFINE([HAVE_CTANH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([ctanhl],[AC_DEFINE([HAVE_CTANHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([truncf],[AC_DEFINE([HAVE_TRUNCF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([trunc],[AC_DEFINE([HAVE_TRUNC],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([truncl],[AC_DEFINE([HAVE_TRUNCL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erff],[AC_DEFINE([HAVE_ERFF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erf],[AC_DEFINE([HAVE_ERF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erfl],[AC_DEFINE([HAVE_ERFL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erfcf],[AC_DEFINE([HAVE_ERFCF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erfc],[AC_DEFINE([HAVE_ERFC],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([erfcl],[AC_DEFINE([HAVE_ERFCL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j0f],[AC_DEFINE([HAVE_J0F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j0],[AC_DEFINE([HAVE_J0],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j0l],[AC_DEFINE([HAVE_J0L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j1f],[AC_DEFINE([HAVE_J1F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j1],[AC_DEFINE([HAVE_J1],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([j1l],[AC_DEFINE([HAVE_J1L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([jnf],[AC_DEFINE([HAVE_JNF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([jn],[AC_DEFINE([HAVE_JN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([jnl],[AC_DEFINE([HAVE_JNL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y0f],[AC_DEFINE([HAVE_Y0F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y0],[AC_DEFINE([HAVE_Y0],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y0l],[AC_DEFINE([HAVE_Y0L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y1f],[AC_DEFINE([HAVE_Y1F],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y1],[AC_DEFINE([HAVE_Y1],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([y1l],[AC_DEFINE([HAVE_Y1L],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ynf],[AC_DEFINE([HAVE_YNF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([yn],[AC_DEFINE([HAVE_YN],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([ynl],[AC_DEFINE([HAVE_YNL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tgamma],[AC_DEFINE([HAVE_TGAMMA],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tgammaf],[AC_DEFINE([HAVE_TGAMMAF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([tgammal],[AC_DEFINE([HAVE_TGAMMAL],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lgamma],[AC_DEFINE([HAVE_LGAMMA],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lgammaf],[AC_DEFINE([HAVE_LGAMMAF],[1])],[],[[#include <math.h>]])
+AC_CHECK_DECLS([lgammal],[AC_DEFINE([HAVE_LGAMMAL],[1])],[],[[#include <math.h>]])
 
 # Check for GFORTRAN_C99_1.1 funcs
-AC_CHECK_LIB([m],[cacos],[AC_DEFINE([HAVE_CACOS],[1],[libm includes cacos])])
-AC_CHECK_LIB([m],[cacosf],[AC_DEFINE([HAVE_CACOSF],[1],[libm includes cacosf])])
-AC_CHECK_LIB([m],[cacosh],[AC_DEFINE([HAVE_CACOSH],[1],[libm includes cacosh])])
-AC_CHECK_LIB([m],[cacoshf],[AC_DEFINE([HAVE_CACOSHF],[1],[libm includes cacoshf])])
-AC_CHECK_LIB([m],[cacoshl],[AC_DEFINE([HAVE_CACOSHL],[1],[libm includes cacoshl])])
-AC_CHECK_LIB([m],[cacosl],[AC_DEFINE([HAVE_CACOSL],[1],[libm includes cacosl])])
-AC_CHECK_LIB([m],[casin],[AC_DEFINE([HAVE_CASIN],[1],[libm includes casin])])
-AC_CHECK_LIB([m],[casinf],[AC_DEFINE([HAVE_CASINF],[1],[libm includes casinf])])
-AC_CHECK_LIB([m],[casinh],[AC_DEFINE([HAVE_CASINH],[1],[libm includes casinh])])
-AC_CHECK_LIB([m],[casinhf],[AC_DEFINE([HAVE_CASINHF],[1],[libm includes casinhf])])
-AC_CHECK_LIB([m],[casinhl],[AC_DEFINE([HAVE_CASINHL],[1],[libm includes casinhl])])
-AC_CHECK_LIB([m],[casinl],[AC_DEFINE([HAVE_CASINL],[1],[libm includes casinl])])
-AC_CHECK_LIB([m],[catan],[AC_DEFINE([HAVE_CATAN],[1],[libm includes catan])])
-AC_CHECK_LIB([m],[catanf],[AC_DEFINE([HAVE_CATANF],[1],[libm includes catanf])])
-AC_CHECK_LIB([m],[catanh],[AC_DEFINE([HAVE_CATANH],[1],[libm includes catanh])])
-AC_CHECK_LIB([m],[catanhf],[AC_DEFINE([HAVE_CATANHF],[1],[libm includes catanhf])])
-AC_CHECK_LIB([m],[catanhl],[AC_DEFINE([HAVE_CATANHL],[1],[libm includes catanhl])])
-AC_CHECK_LIB([m],[catanl],[AC_DEFINE([HAVE_CATANL],[1],[libm includes catanl])])
+AC_CHECK_DECLS([cacos],[AC_DEFINE([HAVE_CACOS],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cacosf],[AC_DEFINE([HAVE_CACOSF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cacosh],[AC_DEFINE([HAVE_CACOSH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cacoshf],[AC_DEFINE([HAVE_CACOSHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cacoshl],[AC_DEFINE([HAVE_CACOSHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([cacosl],[AC_DEFINE([HAVE_CACOSL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casin],[AC_DEFINE([HAVE_CASIN],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casinf],[AC_DEFINE([HAVE_CASINF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casinh],[AC_DEFINE([HAVE_CASINH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casinhf],[AC_DEFINE([HAVE_CASINHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casinhl],[AC_DEFINE([HAVE_CASINHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([casinl],[AC_DEFINE([HAVE_CASINL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catan],[AC_DEFINE([HAVE_CATAN],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catanf],[AC_DEFINE([HAVE_CATANF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catanh],[AC_DEFINE([HAVE_CATANH],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catanhf],[AC_DEFINE([HAVE_CATANHF],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catanhl],[AC_DEFINE([HAVE_CATANHL],[1])],[],[[#include <complex.h>]])
+AC_CHECK_DECLS([catanl],[AC_DEFINE([HAVE_CATANL],[1])],[],[[#include <complex.h>]])
 
 # On AIX, clog is present in libm as __clog
 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])