1 # remainderf.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.
7 AC_DEFUN([gl_FUNC_REMAINDERF],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_FUNC_REMAINDER])
12 dnl Test whether remainderf() exists. Assume that remainderf(), if it exists, is
13 dnl defined in the same library as remainder().
15 LIBS="$LIBS $REMAINDER_LIBM"
16 AC_CACHE_CHECK([for remainderf],
17 [gl_cv_func_remainderf],
21 [[#ifndef __NO_MATH_INLINES
22 # define __NO_MATH_INLINES 1 /* for glibc */
25 float (*funcptr) (float, float) = remainderf;
28 [[return funcptr (x, y) > 1
29 || remainderf (x, y) > 1;]])],
30 [gl_cv_func_remainderf=yes],
31 [gl_cv_func_remainderf=no])
34 if test $gl_cv_func_remainderf = yes; then
35 REMAINDERF_LIBM="$REMAINDER_LIBM"
38 dnl Find libraries needed to link lib/remainderf.c.
39 if test $gl_cv_func_remainder_no_libm = yes \
40 || test $gl_cv_func_remainder_in_libm = yes; then
41 AC_DEFINE([HAVE_REMAINDER], [1],
42 [Define to 1 if the remainder() function is available in libc or libm.])
43 REMAINDERF_LIBM="$REMAINDER_LIBM"
45 AC_REQUIRE([gl_FUNC_ROUNDF])
46 AC_REQUIRE([gl_FUNC_FMAF])
48 dnl Append $ROUNDF_LIBM to REMAINDERF_LIBM, avoiding gratuitous duplicates.
49 case " $REMAINDERF_LIBM " in
50 *" $ROUNDF_LIBM "*) ;;
51 *) REMAINDERF_LIBM="$REMAINDERF_LIBM $ROUNDF_LIBM" ;;
53 dnl Append $FMAF_LIBM to REMAINDERF_LIBM, avoiding gratuitous duplicates.
54 case " $REMAINDERF_LIBM " in
56 *) REMAINDERF_LIBM="$REMAINDERF_LIBM $FMAF_LIBM" ;;
60 AC_SUBST([REMAINDERF_LIBM])