2 dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_EXPM1L],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
12 dnl Persuade glibc <math.h> to declare expm1l().
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
16 AC_CACHE_CHECK([whether expm1l() can be used without linking with libm],
17 [gl_cv_func_expm1l_no_libm],
21 [[#ifndef __NO_MATH_INLINES
22 # define __NO_MATH_INLINES 1 /* for glibc */
29 long double expm1l (long double);
30 long double (*funcptr) (long double) = expm1l;
32 [[return funcptr (x) > 0.5
33 || expm1l (x) > 0.5;]])],
34 [gl_cv_func_expm1l_no_libm=yes],
35 [gl_cv_func_expm1l_no_libm=no])
37 if test $gl_cv_func_expm1l_no_libm = no; then
38 AC_CACHE_CHECK([whether expm1l() can be used with libm],
39 [gl_cv_func_expm1l_in_libm],
45 [[#ifndef __NO_MATH_INLINES
46 # define __NO_MATH_INLINES 1 /* for glibc */
53 long double expm1l (long double);
54 long double (*funcptr) (long double) = expm1l;
56 [[return funcptr (x) > 0.5
57 || expm1l (x) > 0.5;]])],
58 [gl_cv_func_expm1l_in_libm=yes],
59 [gl_cv_func_expm1l_in_libm=no])
62 if test $gl_cv_func_expm1l_in_libm = yes; then
66 if test $gl_cv_func_expm1l_no_libm = yes \
67 || test $gl_cv_func_expm1l_in_libm = yes; then
69 dnl Also check whether it's declared.
70 dnl IRIX 6.5 has expm1l() in libm but doesn't declare it in <math.h>.
71 AC_CHECK_DECL([expm1l], , [HAVE_DECL_EXPM1L=0], [[#include <math.h>]])
75 dnl Find libraries needed to link lib/expm1l.c.
76 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
77 AC_REQUIRE([gl_FUNC_EXPM1])
78 EXPM1L_LIBM="$EXPM1_LIBM"
80 AC_REQUIRE([gl_FUNC_ISNANL])
81 AC_REQUIRE([gl_FUNC_EXPL])
82 AC_REQUIRE([gl_FUNC_ROUNDL])
83 AC_REQUIRE([gl_FUNC_LDEXPL])
85 dnl Append $ISNANL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
86 case " $EXPM1L_LIBM " in
87 *" $ISNANL_LIBM "*) ;;
88 *) EXPM1L_LIBM="$EXPM1L_LIBM $ISNANL_LIBM" ;;
90 dnl Append $EXPL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
91 case " $EXPM1L_LIBM " in
93 *) EXPM1L_LIBM="$EXPM1L_LIBM $EXPL_LIBM" ;;
95 dnl Append $ROUNDL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
96 case " $EXPM1L_LIBM " in
97 *" $ROUNDL_LIBM "*) ;;
98 *) EXPM1L_LIBM="$EXPM1L_LIBM $ROUNDL_LIBM" ;;
100 dnl Append $LDEXPL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
101 case " $EXPM1L_LIBM " in
102 *" $LDEXPL_LIBM "*) ;;
103 *) EXPM1L_LIBM="$EXPM1L_LIBM $LDEXPL_LIBM" ;;
107 AC_SUBST([EXPM1L_LIBM])