diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/frexpl.m4 | 47 | ||||
-rw-r--r-- | m4/math_h.m4 | 5 | ||||
-rw-r--r-- | m4/mathl.m4 | 6 |
3 files changed, 53 insertions, 5 deletions
diff --git a/m4/frexpl.m4 b/m4/frexpl.m4 new file mode 100644 index 0000000000..361fd2d867 --- /dev/null +++ b/m4/frexpl.m4 @@ -0,0 +1,47 @@ +# frexpl.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_FREXPL], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + FREXPL_LIBM= + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include <math.h> + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = no; then + AC_CACHE_CHECK([whether frexpl() can be used with libm], + [gl_cv_func_frexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include <math.h> + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_in_libm=yes], + [gl_cv_func_frexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_frexpl_in_libm = yes; then + FREXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_frexpl_no_libm = yes \ + || test $gl_cv_func_frexpl_in_libm = yes; then + AC_DEFINE([HAVE_FREXPL], 1, + [Define if the frexpl() function is available.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>. + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>]) + else + AC_LIBOBJ([frexpl]) + fi +]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 5b393f4b84..fb3ea09f2b 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -21,8 +21,9 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR], AC_DEFUN([gl_MATH_H_DEFAULTS], [ - GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) - GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) + GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) + GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) + GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) diff --git a/m4/mathl.m4 b/m4/mathl.m4 index c875203d41..57d70a5a7a 100644 --- a/m4/mathl.m4 +++ b/m4/mathl.m4 @@ -1,5 +1,5 @@ -# mathl.m4 serial 2 -dnl Copyright (c) 2003 Free Software Foundation, Inc. +# mathl.m4 serial 3 +dnl Copyright (c) 2003, 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. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LONG_DOUBLE_MATH], [ AC_CHECK_LIB(m, atan) -AC_REPLACE_FUNCS(floorl ceill sqrtl frexpl ldexpl asinl acosl atanl \ +AC_REPLACE_FUNCS(floorl ceill sqrtl ldexpl asinl acosl atanl \ logl expl tanl sinl cosl) ]) |