dirent: Fix compilation error in C++ mode on OS/2 kLIBC.
[gnulib.git] / m4 / copysignf.m4
blobbef9e30d5664e4ec1550944a61d293876cf1e514
1 # copysignf.m4 serial 4
2 dnl Copyright (C) 2011-2021 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_COPYSIGNF],
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   AC_REQUIRE([AC_CANONICAL_HOST])
12   dnl Persuade glibc <math.h> to declare copysignf().
13   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15   dnl Determine COPYSIGNF_LIBM.
16   gl_MATHFUNC([copysignf], [float], [(float, float)],
17     [extern
18      #ifdef __cplusplus
19      "C"
20      #endif
21      float copysignf (float, float);
22     ])
23   if test $gl_cv_func_copysignf_no_libm = yes \
24      || test $gl_cv_func_copysignf_in_libm = yes; then
25     HAVE_COPYSIGNF=1
26     dnl Also check whether it's declared.
27     dnl IRIX 6.5 has copysignf() in libm but doesn't declare it in <math.h>.
28     AC_CHECK_DECL([copysignf], , [HAVE_DECL_COPYSIGNF=0], [[#include <math.h>]])
29   else
30     HAVE_COPYSIGNF=0
31     HAVE_DECL_COPYSIGNF=0
32     dnl On HP-UX 11.31/ia64, cc has a built-in for copysignf that redirects
33     dnl to the symbol '_copysignf', defined in libm, not libc.
34     case "$host_os" in
35       hpux*) COPYSIGNF_LIBM='-lm' ;;
36       *)     COPYSIGNF_LIBM= ;;
37     esac
38   fi
39   AC_SUBST([COPYSIGNF_LIBM])