Branch
Hash :
7b089321
Author :
Date :
2025-01-01T09:24:36
maint: run 'make update-copyright'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
# totalorder.m4
# serial 3
dnl Copyright 2023-2025 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.
dnl This file is offered as-is, without any warranty.
AC_DEFUN([gl_FUNC_TOTALORDERF],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl glibc versions < 2.31 had an incompatible declaration of this function,
dnl see <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=42760d764649ad82f5fe45a26cbdf2c2500409f7>
AC_CACHE_CHECK([whether totalorderf has a non-standard declaration],
[gl_cv_func_totalorderf_incompatible],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
]],
[[extern
#ifdef __cplusplus
"C"
#endif
int totalorderf (float const *, float const *);
]])
],
[gl_cv_func_totalorderf_incompatible=no],
[gl_cv_func_totalorderf_incompatible=yes])
])
if test $gl_cv_func_totalorderf_incompatible = yes; then
REPLACE_TOTALORDERF=1
else
gl_MATHFUNC([totalorderf], [int], [(float const *, float const *)])
if test $gl_cv_func_totalorderf_no_libm != yes \
&& test $gl_cv_func_totalorderf_in_libm != yes; then
HAVE_TOTALORDERF=0
fi
fi
if test $HAVE_TOTALORDERF = 0 || test $REPLACE_TOTALORDERF = 1; then
TOTALORDERF_LIBM='$(ISNANF_LIBM)'
dnl Prerequisite of lib/totalorderf.c.
gl_NAN_MIPS
fi
AC_SUBST([TOTALORDERF_LIBM])
])
AC_DEFUN([gl_FUNC_TOTALORDER],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl glibc versions < 2.31 had an incompatible declaration of this function,
dnl see <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=42760d764649ad82f5fe45a26cbdf2c2500409f7>
AC_CACHE_CHECK([whether totalorder has a non-standard declaration],
[gl_cv_func_totalorder_incompatible],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
]],
[[extern
#ifdef __cplusplus
"C"
#endif
int totalorder (double const *, double const *);
]])
],
[gl_cv_func_totalorder_incompatible=no],
[gl_cv_func_totalorder_incompatible=yes])
])
if test $gl_cv_func_totalorder_incompatible = yes; then
REPLACE_TOTALORDER=1
else
gl_MATHFUNC([totalorder], [int], [(double const *, double const *)])
if test $gl_cv_func_totalorder_no_libm != yes \
&& test $gl_cv_func_totalorder_in_libm != yes; then
HAVE_TOTALORDER=0
fi
fi
if test $HAVE_TOTALORDER = 0 || test $REPLACE_TOTALORDER = 1; then
TOTALORDER_LIBM='$(ISNAND_LIBM)'
dnl Prerequisite of lib/totalorder.c.
gl_NAN_MIPS
fi
AC_SUBST([TOTALORDER_LIBM])
])
AC_DEFUN([gl_FUNC_TOTALORDERL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
dnl glibc versions < 2.31 had an incompatible declaration of this function,
dnl see <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=42760d764649ad82f5fe45a26cbdf2c2500409f7>
AC_CACHE_CHECK([whether totalorderl has a non-standard declaration],
[gl_cv_func_totalorderl_incompatible],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
]],
[[extern
#ifdef __cplusplus
"C"
#endif
int totalorderl (long double const *, long double const *);
]])
],
[gl_cv_func_totalorderl_incompatible=no],
[gl_cv_func_totalorderl_incompatible=yes])
])
if test $gl_cv_func_totalorderl_incompatible = yes; then
REPLACE_TOTALORDERL=1
else
gl_MATHFUNC([totalorderl], [int],
[(long double const *, long double const *)])
if test $gl_cv_func_totalorderl_no_libm != yes \
&& test $gl_cv_func_totalorderl_in_libm != yes; then
HAVE_TOTALORDERL=0
fi
fi
if test $HAVE_TOTALORDERL = 0 || test $REPLACE_TOTALORDERL = 1; then
dnl Find libraries needed to link lib/totalorderl.c.
if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
AC_REQUIRE([gl_FUNC_TOTALORDER])
TOTALORDERL_LIBM="$TOTALORDER_LIBM"
else
TOTALORDERL_LIBM='$(ISNANL_LIBM)'
fi
dnl Prerequisite of lib/totalorderl.c.
gl_LONG_DOUBLE_SIGN_LOCATION
gl_NAN_MIPS
fi
AC_SUBST([TOTALORDERL_LIBM])
])