maint: update copyright
[gnulib.git] / m4 / expm1f.m4
1 # expm1f.m4 serial 2
2 dnl Copyright (C) 2011-2014 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.
6
7 AC_DEFUN([gl_FUNC_EXPM1F],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   AC_REQUIRE([gl_FUNC_EXPM1])
11
12   dnl Persuade glibc <math.h> to declare expm1f().
13   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14
15   dnl Test whether expm1f() exists. Assume that expm1f(), if it exists, is
16   dnl defined in the same library as expm1().
17   save_LIBS="$LIBS"
18   LIBS="$LIBS $EXPM1_LIBM"
19   AC_CHECK_FUNCS([expm1f])
20   LIBS="$save_LIBS"
21   if test $ac_cv_func_expm1f = yes; then
22     EXPM1F_LIBM="$EXPM1_LIBM"
23     save_LIBS="$LIBS"
24     LIBS="$LIBS $EXPM1F_LIBM"
25     gl_FUNC_EXPM1F_WORKS
26     LIBS="$save_LIBS"
27     case "$gl_cv_func_expm1f_works" in
28       *yes) ;;
29       *) REPLACE_EXPM1F=1 ;;
30     esac
31   else
32     HAVE_EXPM1F=0
33   fi
34   if test $HAVE_EXPM1F = 0 || test $REPLACE_EXPM1F = 1; then
35     dnl Find libraries needed to link lib/expm1f.c.
36     EXPM1F_LIBM="$EXPM1_LIBM"
37   fi
38   AC_SUBST([EXPM1F_LIBM])
39 ])
40
41 dnl Test whether expm1f() works.
42 dnl On IRIX 6.5, for arguments <= -17.32868, it returns -5.6295e14.
43 AC_DEFUN([gl_FUNC_EXPM1F_WORKS],
44 [
45   AC_REQUIRE([AC_PROG_CC])
46   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
47   AC_CACHE_CHECK([whether expm1f works], [gl_cv_func_expm1f_works],
48     [
49       AC_RUN_IFELSE(
50         [AC_LANG_SOURCE([[
51 #include <math.h>
52 volatile float x;
53 float y;
54 int main ()
55 {
56   x = -100.0f;
57   y = expm1f (x);
58   if (y < -1.0f)
59     return 1;
60   return 0;
61 }
62 ]])],
63         [gl_cv_func_expm1f_works=yes],
64         [gl_cv_func_expm1f_works=no],
65         [case "$host_os" in
66            irix*) gl_cv_func_expm1f_works="guessing no";;
67            *)     gl_cv_func_expm1f_works="guessing yes";;
68          esac
69         ])
70     ])
71 ])