summaryrefslogtreecommitdiffstats
path: root/gl/m4/floorf.m4
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 21:27:12 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 21:27:12 (GMT)
commit26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch)
treec4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/m4/floorf.m4
parent5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff)
downloadmonitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/m4/floorf.m4')
-rw-r--r--gl/m4/floorf.m484
1 files changed, 66 insertions, 18 deletions
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4
index fb17a5e..c892ff9 100644
--- a/gl/m4/floorf.m4
+++ b/gl/m4/floorf.m4
@@ -1,16 +1,17 @@
1# floorf.m4 serial 6 1# floorf.m4 serial 13
2dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_FLOORF], 7AC_DEFUN([gl_FUNC_FLOORF],
8[ 8[
9 m4_divert_text([DEFAULTS], [gl_floorf_required=plain])
9 AC_REQUIRE([gl_MATH_H_DEFAULTS]) 10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 dnl Persuade glibc <math.h> to declare floorf(). 11 dnl Persuade glibc <math.h> to declare floorf().
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 dnl Test whether floorf() is declared. 13 dnl Test whether floorf() is declared.
13 AC_CHECK_DECLS([floorf], , , [#include <math.h>]) 14 AC_CHECK_DECLS([floorf], , , [[#include <math.h>]])
14 if test "$ac_cv_have_decl_floorf" = yes; then 15 if test "$ac_cv_have_decl_floorf" = yes; then
15 dnl Test whether floorf() can be used without libm. 16 dnl Test whether floorf() can be used without libm.
16 gl_FUNC_FLOORF_LIBS 17 gl_FUNC_FLOORF_LIBS
@@ -19,11 +20,54 @@ AC_DEFUN([gl_FUNC_FLOORF],
19 dnl libm.so, but not in the libm.so that the compiler uses. 20 dnl libm.so, but not in the libm.so that the compiler uses.
20 REPLACE_FLOORF=1 21 REPLACE_FLOORF=1
21 fi 22 fi
23 m4_ifdef([gl_FUNC_FLOORF_IEEE], [
24 if test $gl_floorf_required = ieee && test $REPLACE_FLOORF = 0; then
25 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
26 AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559],
27 [gl_cv_func_floorf_ieee],
28 [
29 save_LIBS="$LIBS"
30 LIBS="$LIBS $FLOORF_LIBM"
31 AC_RUN_IFELSE(
32 [AC_LANG_SOURCE([[
33#ifndef __NO_MATH_INLINES
34# define __NO_MATH_INLINES 1 /* for glibc */
35#endif
36#include <math.h>
37]gl_FLOAT_MINUS_ZERO_CODE[
38]gl_FLOAT_SIGNBIT_CODE[
39static float dummy (float f) { return 0; }
40int main (int argc, char *argv[])
41{
42 float (*my_floorf) (float) = argc ? floorf : dummy;
43 /* Test whether floorf (-0.0f) is -0.0f. */
44 if (signbitf (minus_zerof) && !signbitf (my_floorf (minus_zerof)))
45 return 1;
46 return 0;
47}
48 ]])],
49 [gl_cv_func_floorf_ieee=yes],
50 [gl_cv_func_floorf_ieee=no],
51 [case "$host_os" in
52 # Guess yes on glibc systems.
53 *-gnu*) gl_cv_func_floorf_ieee="guessing yes" ;;
54 # If we don't know, assume the worst.
55 *) gl_cv_func_floorf_ieee="guessing no" ;;
56 esac
57 ])
58 LIBS="$save_LIBS"
59 ])
60 case "$gl_cv_func_floorf_ieee" in
61 *yes) ;;
62 *) REPLACE_FLOORF=1 ;;
63 esac
64 fi
65 ])
22 else 66 else
23 HAVE_DECL_FLOORF=0 67 HAVE_DECL_FLOORF=0
24 fi 68 fi
25 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then 69 if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then
26 AC_LIBOBJ([floorf]) 70 dnl No libraries are needed to link lib/floorf.c.
27 FLOORF_LIBM= 71 FLOORF_LIBM=
28 fi 72 fi
29 AC_SUBST([FLOORF_LIBM]) 73 AC_SUBST([FLOORF_LIBM])
@@ -35,24 +79,28 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS],
35[ 79[
36 gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [ 80 gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [
37 gl_cv_func_floorf_libm=? 81 gl_cv_func_floorf_libm=?
38 AC_TRY_LINK([ 82 AC_LINK_IFELSE(
39 #ifndef __NO_MATH_INLINES 83 [AC_LANG_PROGRAM(
40 # define __NO_MATH_INLINES 1 /* for glibc */ 84 [[#ifndef __NO_MATH_INLINES
41 #endif 85 # define __NO_MATH_INLINES 1 /* for glibc */
42 #include <math.h> 86 #endif
43 float x;], 87 #include <math.h>
44 [x = floorf(x);], 88 float (*funcptr) (float) = floorf;
89 float x;]],
90 [[x = funcptr(x) + floorf(x);]])],
45 [gl_cv_func_floorf_libm=]) 91 [gl_cv_func_floorf_libm=])
46 if test "$gl_cv_func_floorf_libm" = "?"; then 92 if test "$gl_cv_func_floorf_libm" = "?"; then
47 save_LIBS="$LIBS" 93 save_LIBS="$LIBS"
48 LIBS="$LIBS -lm" 94 LIBS="$LIBS -lm"
49 AC_TRY_LINK([ 95 AC_LINK_IFELSE(
50 #ifndef __NO_MATH_INLINES 96 [AC_LANG_PROGRAM(
51 # define __NO_MATH_INLINES 1 /* for glibc */ 97 [[#ifndef __NO_MATH_INLINES
52 #endif 98 # define __NO_MATH_INLINES 1 /* for glibc */
53 #include <math.h> 99 #endif
54 float x;], 100 #include <math.h>
55 [x = floorf(x);], 101 float (*funcptr) (float) = floorf;
102 float x;]],
103 [[x = funcptr(x) + floorf(x);]])],
56 [gl_cv_func_floorf_libm="-lm"]) 104 [gl_cv_func_floorf_libm="-lm"])
57 LIBS="$save_LIBS" 105 LIBS="$save_LIBS"
58 fi 106 fi