2 dnl Copyright (C) 2011-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.
7 AC_DEFUN([gl_FUNC_FMODL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
11 AC_REQUIRE([gl_FUNC_FMOD])
13 dnl Test whether fmodl() is declared.
14 dnl AIX 5.1 has fmodl() in libc but doesn't declare it in <math.h>, and the
15 dnl function produces NaN results for finite values.
16 AC_CHECK_DECL([fmodl],
17 [ac_cv_have_decl_fmodl=yes], [ac_cv_have_decl_fmodl=no],
18 [[#include <math.h>]])
20 dnl Test whether fmodl() exists. Assume that fmodl(), if it exists, is
21 dnl defined in the same library as fmod().
23 LIBS="$LIBS $FMOD_LIBM"
24 AC_CHECK_FUNCS([fmodl])
26 if test $ac_cv_func_fmodl = yes; then
27 if test $ac_cv_have_decl_fmodl = yes; then
28 FMODL_LIBM="$FMOD_LIBM"
35 if test $HAVE_FMODL = 0 || test $REPLACE_FMODL = 1; then
36 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
37 FMODL_LIBM="$FMOD_LIBM"
39 AC_REQUIRE([gl_FUNC_TRUNCL])
40 AC_REQUIRE([gl_FUNC_FMAL])
42 dnl Append $TRUNCL_LIBM to FMODL_LIBM, avoiding gratuitous duplicates.
43 case " $FMODL_LIBM " in
44 *" $TRUNCL_LIBM "*) ;;
45 *) FMODL_LIBM="$FMODL_LIBM $TRUNCL_LIBM" ;;
47 dnl Append $FMAL_LIBM to FMODL_LIBM, avoiding gratuitous duplicates.
48 case " $FMODL_LIBM " in
50 *) FMODL_LIBM="$FMODL_LIBM $FMAL_LIBM" ;;
54 AC_SUBST([FMODL_LIBM])