New module 'floor'.
[gnulib.git] / m4 / floor.m4
1 # floor.m4 serial 1
2 dnl Copyright (C) 2007 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_FLOOR],
8 [
9   dnl Test whether floor() can be used without libm.
10   FLOOR_LIBM=?
11   AC_TRY_LINK([
12      #ifndef __NO_MATH_INLINES
13      # define __NO_MATH_INLINES 1 /* for glibc */
14      #endif
15      #include <math.h>
16      double x;],
17     [x = floor(x);],
18     [FLOOR_LIBM=])
19   if test "$FLOOR_LIBM" = "?"; then
20     save_LIBS="$LIBS"
21     LIBS="$LIBS -lm"
22     AC_TRY_LINK([
23        #ifndef __NO_MATH_INLINES
24        # define __NO_MATH_INLINES 1 /* for glibc */
25        #endif
26        #include <math.h>
27        double x;],
28       [x = floor(x);],
29       [FLOOR_LIBM="-lm"])
30     LIBS="$save_LIBS"
31   fi
32   if test "$FLOOR_LIBM" = "?"; then
33     FLOOR_LIBM=
34   fi
35   AC_SUBST([FLOOR_LIBM])
36 ])