1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-17 12:41:05 +03:00
Files
gnulib/m4/logbf.m4
Paul Eggert a3fd683de3 version-etc: new year
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
* all files: Run 'make update-copyright'.
2017-01-01 02:59:23 +00:00

82 lines
2.4 KiB
Plaintext

# logbf.m4 serial 1
dnl Copyright (C) 2012-2017 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_LOGBF],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
dnl Persuade glibc <math.h> to declare logbf().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl Determine LOGBF_LIBM.
gl_MATHFUNC([logbf], [float], [(float)])
if test $gl_cv_func_logbf_no_libm = yes \
|| test $gl_cv_func_logbf_in_libm = yes; then
save_LIBS="$LIBS"
LIBS="$LIBS $LOGBF_LIBM"
gl_FUNC_LOGBF_WORKS
LIBS="$save_LIBS"
case "$gl_cv_func_logbf_works" in
*yes) ;;
*) REPLACE_LOGBF=1 ;;
esac
else
HAVE_LOGBF=0
fi
if test $HAVE_LOGBF = 0 || test $REPLACE_LOGBF = 1; then
dnl Find libraries needed to link lib/logbf.c.
AC_REQUIRE([gl_FUNC_FREXPF])
AC_REQUIRE([gl_FUNC_ISNANF])
LOGBF_LIBM=
dnl Append $FREXPF_LIBM to LOGBF_LIBM, avoiding gratuitous duplicates.
case " $LOGBF_LIBM " in
*" $FREXPF_LIBM "*) ;;
*) LOGBF_LIBM="$LOGBF_LIBM $FREXPF_LIBM" ;;
esac
dnl Append $ISNANF_LIBM to LOGBF_LIBM, avoiding gratuitous duplicates.
case " $LOGBF_LIBM " in
*" $ISNANF_LIBM "*) ;;
*) LOGBF_LIBM="$LOGBF_LIBM $ISNANF_LIBM" ;;
esac
fi
AC_SUBST([LOGBF_LIBM])
])
dnl Test whether logbf() works.
dnl On glibc 2.11/ppc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 10/SPARC,
dnl the return value for subnormal (denormalized) arguments is too large.
AC_DEFUN([gl_FUNC_LOGBF_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether logbf works], [gl_cv_func_logbf_works],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
volatile float x;
int main ()
{
int i;
for (i = 1, x = 1.0f; i >= FLT_MIN_EXP; i--, x *= 0.5f)
;
/* Here i = FLT_MIN_EXP - 1. Either x = 2^(i-1) is subnormal or x = 0.0. */
if (x > 0.0f && !(logbf (x) == (float)(i - 1)))
return 1;
return 0;
}
]])],
[gl_cv_func_logbf_works=yes],
[gl_cv_func_logbf_works=no],
[case "$host_os" in
*gnu* | solaris*) gl_cv_func_logbf_works="guessing no";;
*) gl_cv_func_logbf_works="guessing yes";;
esac
])
])
])