Tests for module 'log1pl-ieee'.
[gnulib.git] / m4 / log1pl.m4
1 # log1pl.m4 serial 1
2 dnl Copyright (C) 2012 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_LOG1PL],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
11   AC_REQUIRE([gl_FUNC_LOG1P])
12
13   dnl Persuade glibc <math.h> to declare log1pl().
14   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15
16   dnl Test whether log1pl() exists. Assume that log1pl(), if it exists, is
17   dnl defined in the same library as log1p().
18   save_LIBS="$LIBS"
19   LIBS="$LIBS $LOG1P_LIBM"
20   AC_CHECK_FUNCS([log1pl])
21   LIBS="$save_LIBS"
22   if test $ac_cv_func_log1pl = yes; then
23     LOG1PL_LIBM="$LOG1P_LIBM"
24   else
25     HAVE_LOG1PL=0
26     dnl Find libraries needed to link lib/log1pl.c.
27     if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
28       LOG1PL_LIBM="$LOG1P_LIBM"
29     else
30       AC_REQUIRE([gl_FUNC_ISNANL])
31       AC_REQUIRE([gl_FUNC_LOGL])
32       AC_REQUIRE([gl_FUNC_ROUNDL])
33       LOG1PL_LIBM=
34       dnl Append $ISNANL_LIBM to LOG1PL_LIBM, avoiding gratuitous duplicates.
35       case " $LOG1PL_LIBM " in
36         *" $ISNANL_LIBM "*) ;;
37         *) LOG1PL_LIBM="$LOG1PL_LIBM $ISNANL_LIBM" ;;
38       esac
39       dnl Append $LOGL_LIBM to LOG1PL_LIBM, avoiding gratuitous duplicates.
40       case " $LOG1PL_LIBM " in
41         *" $LOGL_LIBM "*) ;;
42         *) LOG1PL_LIBM="$LOG1PL_LIBM $LOGL_LIBM" ;;
43       esac
44       dnl Append $ROUNDL_LIBM to LOG1PL_LIBM, avoiding gratuitous duplicates.
45       case " $LOG1PL_LIBM " in
46         *" $ROUNDL_LIBM "*) ;;
47         *) LOG1PL_LIBM="$LOG1PL_LIBM $ROUNDL_LIBM" ;;
48       esac
49     fi
50   fi
51   AC_SUBST([LOG1PL_LIBM])
52 ])