diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-05 03:54:50 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2007-10-05 03:54:50 +0200 |
commit | d23df56e2060a3f468b8c6b069c0b87f6c15b774 (patch) | |
tree | 619f259dbf3c737374ca38c44d76cbe0bb1905b7 /m4/ceill.m4 | |
parent | 9ae286b3b3918e354fafeaafd8082d37b7c90460 (diff) | |
download | gnulib-d23df56e2060a3f468b8c6b069c0b87f6c15b774.tar.gz |
New module 'ceill'.
Diffstat (limited to 'm4/ceill.m4')
-rw-r--r-- | m4/ceill.m4 | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/m4/ceill.m4 b/m4/ceill.m4 new file mode 100644 index 0000000000..7413a3110c --- /dev/null +++ b/m4/ceill.m4 @@ -0,0 +1,48 @@ +# ceill.m4 serial 1 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_CEILL], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + dnl Persuade glibc <math.h> to declare ceill(). + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + dnl Test whether ceill() is declared. + AC_CHECK_DECLS([ceill], , , [#include <math.h>]) + if test "$ac_cv_have_decl_ceill" = yes; then + dnl Test whether ceill() can be used without libm. + CEILL_LIBM=? + AC_TRY_LINK([ + #ifndef __NO_MATH_INLINES + # define __NO_MATH_INLINES 1 /* for glibc */ + #endif + #include <math.h> + long double x;], + [x = ceill(x);], + [CEILL_LIBM=]) + if test "$CEILL_LIBM" = "?"; then + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([ + #ifndef __NO_MATH_INLINES + # define __NO_MATH_INLINES 1 /* for glibc */ + #endif + #include <math.h> + long double x;], + [x = ceill(x);], + [CEILL_LIBM="-lm"]) + LIBS="$save_LIBS" + fi + if test "$CEILL_LIBM" = "?"; then + CEILL_LIBM= + fi + else + HAVE_DECL_CEILL=0 + AC_LIBOBJ([ceill]) + CEILL_LIBM= + fi + AC_SUBST([HAVE_DECL_CEILL]) + AC_SUBST([CEILL_LIBM]) +]) |