termios: fix pid_t always, not just for tcgetsid
[gnulib.git] / m4 / fmodf.m4
1 # fmodf.m4 serial 2
2 dnl Copyright (C) 2011-2012 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_FMODF],
8 [
9   m4_divert_text([DEFAULTS], [gl_fmodf_required=plain])
10   AC_REQUIRE([gl_MATH_H_DEFAULTS])
11   AC_REQUIRE([gl_FUNC_FMOD])
12
13   dnl Test whether fmodf() exists. Assume that fmodf(), if it exists, is
14   dnl defined in the same library as fmod().
15   save_LIBS="$LIBS"
16   LIBS="$LIBS $FMOD_LIBM"
17   AC_CHECK_FUNCS([fmodf])
18   LIBS="$save_LIBS"
19   if test $ac_cv_func_fmodf = yes; then
20     FMODF_LIBM="$FMOD_LIBM"
21     m4_ifdef([gl_FUNC_FMODF_IEEE], [
22       if test $gl_fmodf_required = ieee && test $REPLACE_FMODF = 0; then
23         AC_CACHE_CHECK([whether fmodf works according to ISO C 99 with IEC 60559],
24           [gl_cv_func_fmodf_ieee],
25           [
26             save_LIBS="$LIBS"
27             LIBS="$LIBS $FMODF_LIBM"
28             AC_RUN_IFELSE(
29               [AC_LANG_SOURCE([[
30 #ifndef __NO_MATH_INLINES
31 # define __NO_MATH_INLINES 1 /* for glibc */
32 #endif
33 #include <math.h>
34 /* Compare two numbers with ==.
35    This is a separate function because IRIX 6.5 "cc -O" miscompiles an
36    'x == x' test.  */
37 static int
38 numeric_equal (float x, float y)
39 {
40   return x == y;
41 }
42 static float dummy (float x, float y) { return 0; }
43 int main (int argc, char *argv[])
44 {
45   float (*my_fmodf) (float, float) = argc ? fmodf : dummy;
46   float i;
47   float f;
48   /* Test fmodf(...,0.0f).
49      This test fails on OSF/1 5.1.  */
50   f = my_fmodf (2.0f, 0.0f);
51   if (numeric_equal (f, f))
52     return 1;
53   return 0;
54 }
55               ]])],
56               [gl_cv_func_fmodf_ieee=yes],
57               [gl_cv_func_fmodf_ieee=no],
58               [gl_cv_func_fmodf_ieee="guessing no"])
59             LIBS="$save_LIBS"
60           ])
61         case "$gl_cv_func_fmodf_ieee" in
62           *yes) ;;
63           *) REPLACE_FMODF=1 ;;
64         esac
65       fi
66     ])
67   else
68     HAVE_FMODF=0
69   fi
70   if test $HAVE_FMODF = 0 || test $REPLACE_FMODF = 1; then
71     dnl Find libraries needed to link lib/fmodf.c.
72     FMODF_LIBM="$FMOD_LIBM"
73   fi
74   AC_SUBST([FMODF_LIBM])
75 ])