Branch
Hash :
b1fcec6d
Author :
Date :
2025-09-10T23:22:53
Remove support for IRIX. * all-modules: Update comments. * build-aux/install-reloc: Likewise. * build-aux/reloc-ldflags: Likewise. * gnulib-tool: Likewise. * gnulib-tool.py: Likewise. * gnulib-tool.sh: Likewise. * lib/aligned-malloc.h: Likewise. * lib/boot-time.c: Likewise. * lib/c32is-impl.h: Likewise. * lib/c32srtombs-state.c: Likewise. * lib/c32to-impl.h: Likewise. * lib/c32width.c: Likewise. * lib/errno.in.h: Likewise. * lib/euidaccess.c: Likewise. * lib/fbufmode.c: Likewise. * lib/fenv-except-state-get.c: Likewise. * lib/fenv-except-state-set.c: Likewise. * lib/fenv-except-tracking-clear.c: Likewise. * lib/fenv-except-tracking-set.c: Likewise. * lib/fenv-except-tracking-test.c: Likewise. * lib/fenv-except-trapping.c: Likewise. * lib/fenv-round.c: Likewise. * lib/fflush.c: Likewise. * lib/fileblocks.c: Likewise. * lib/forkpty.c: Likewise. * lib/fpending.c: Likewise. * lib/fpurge.c: Likewise. * lib/freadable.c: Likewise. * lib/freadahead.c: Likewise. * lib/freading.c: Likewise. * lib/freadptr.c: Likewise. * lib/freadseek.c: Likewise. * lib/fseeko.c: Likewise. * lib/fseterr.c: Likewise. * lib/fsusage.c: Likewise. * lib/fwritable.c: Likewise. * lib/fwriting.c: Likewise. * lib/getdomainname.c: Likewise. * lib/idpriv-drop.c: Likewise. * lib/idpriv-droptemp.c: Likewise. * lib/limits.in.h: Likewise. * lib/mbrtoc16.c: Likewise. * lib/mbrtoc32.c: Likewise. * lib/mbsrtoc32s-state.c: Likewise. * lib/mbsrtowcs-state.c: Likewise. * lib/mbtowc-lock.h: Likewise. * lib/minmax.h: Likewise. * lib/netdb.in.h: Likewise. * lib/pipe-filter-ii.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/ptsname_r.c: Likewise. * lib/readutmp.c: Likewise. * lib/readutmp.h: Likewise. * lib/resource-ext.h: Likewise. * lib/safe-read.h: Likewise. * lib/safe-write.h: Likewise. * lib/save-cwd.c: Likewise. * lib/stdbool.in.h: Likewise. * lib/striconv.c: Likewise. * lib/striconveh.c: Likewise. * lib/termcap.h: Likewise. * lib/terminfo.h: Likewise. * lib/unistd.in.h: Likewise. * lib/vasnprintf.c: Likewise. * lib/wcrtomb.c: Likewise. * lib/wcsrtombs-state.c: Likewise. * m4/fenv-environment.m4: Likewise. * m4/fenv-exceptions-state.m4: Likewise. * m4/fenv-exceptions-tracking.m4: Likewise. * m4/fenv-rounding.m4: Likewise. * m4/fmod.m4: Likewise. * m4/getdomainname.m4: Likewise. * m4/getloadavg.m4: Likewise. * m4/getopt.m4: Likewise. * m4/hypot.m4: Likewise. * m4/hypotf.m4: Likewise. * m4/hypotl.m4: Likewise. * m4/iconv.m4: Likewise. * m4/intl-thread-locale.m4: Likewise. * m4/largefile.m4: Likewise. * m4/libdl.m4: Likewise. * m4/locale-ja.m4: Likewise. * m4/locale_h.m4: Likewise. * m4/log.m4: Likewise. * m4/log10.m4: Likewise. * m4/log10f.m4: Likewise. * m4/logf.m4: Likewise. * m4/modf.m4: Likewise. * m4/modff.m4: Likewise. * m4/modfl.m4: Likewise. * m4/pthread-rwlock.m4: Likewise. * m4/semaphore.m4: Likewise. * m4/socklen.m4: Likewise. * m4/stdint.m4: Likewise. * m4/strtod.m4: Likewise. * m4/strtof.m4: Likewise. * m4/strtold.m4: Likewise. * modules/sigsegv: Likewise. * posix-modules: Likewise. * pygnulib/GLImport.py: Likewise. * tests/init.sh: Likewise. * tests/test-echo.sh: Likewise. * tests/test-isatty.c: Likewise. * tests/test-math-h.c: Likewise. * tests/test-nonblocking-pipe.h: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-strtod.h: Likewise. * tests/test-strtof.h: Likewise. * tests/test-strtold.h: Likewise. * tests/test-vasnprintf.c: Likewise. * tests/test-vasnwprintf.c: Likewise.
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
# fenv-environment.m4
# serial 6
dnl Copyright (C) 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_FENV_ENVIRONMENT],
[
AC_REQUIRE([gl_FENV_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
dnl FE_DFL_ENV references an undefined global variable on
dnl NetBSD 10.0/{hppa,sparc} and Cygwin 2.9.0 (see
dnl <https://sourceware.org/pipermail/cygwin/2018-July/237888.html>).
AC_CACHE_CHECK([whether FE_DFL_ENV is usable],
[gl_cv_var_FE_DFL_ENV_works],
[case "$host_os" in
netbsd* | cygwin*)
saved_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
fenv_t volatile env;
]],
[[fenv_t const * volatile fenv_default = FE_DFL_ENV;
env = *fenv_default;
]])
],
[gl_cv_var_FE_DFL_ENV_works=yes],
[gl_cv_var_FE_DFL_ENV_works=no])
LIBS="$saved_LIBS"
;;
*)
gl_cv_var_FE_DFL_ENV_works="guessing yes"
;;
esac
])
case "$gl_cv_var_FE_DFL_ENV_works" in
*yes)
AC_DEFINE([HAVE_FE_DFL_ENV], [1],
[Define to 1 if FE_DFL_ENV from <fenv.h> is usable.])
;;
*)
dnl If FE_DFL_ENV is not usable, we not only need to redefine it,
dnl but also override fesetenv and feupdateenv.
REPLACE_FESETENV=1
REPLACE_FEUPDATEENV=1
;;
esac
gl_MATHFUNC([fesetenv], [int], [(fenv_t const *)], [
#include <fenv.h>
fenv_t fenv_ret;
#if HAVE_FE_DFL_ENV
/* FreeBSD often has fesetenv inline in <fenv.h>, but needs -lm for
FE_DFL_ENV. */
fenv_t const *fenv_default = FE_DFL_ENV;
#endif
])
if test $gl_cv_func_fesetenv_no_libm = yes \
|| test $gl_cv_func_fesetenv_in_libm = yes; then
dnl It needs linking with -lm on
dnl glibc, FreeBSD, NetBSD, OpenBSD, AIX, HP-UX, Solaris, Android.
if test $gl_cv_func_fesetenv_no_libm = yes; then
FENV_ENVIRONMENT_LIBM=
else
FENV_ENVIRONMENT_LIBM=-lm
fi
dnl The feholdexcept function does not work on glibc 2.5 (see
dnl <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=a8c79c4088e8c04e4297936efa0dee6c8e6e974d>)
dnl and on FreeBSD 12.2/arm64.
dnl Also, on musl libc for most CPUs, it does not clear the exception trap
dnl bits. It's mentioned in
dnl <https://wiki.musl-libc.org/functional-differences-from-glibc.html>.
dnl Likewise on mingw: it does not clear the exception trap bits.
dnl Whereas on MSVC, this function may even fail.
AC_CACHE_CHECK([whether feholdexcept works],
[gl_cv_func_feholdexcept_works],
[case "$host_os" in
# Guess no on glibc ≤ 2.5.
*-gnu* | gnu*)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <string.h> /* for __GNU_LIBRARY__ */
#ifdef __GNU_LIBRARY__
#include <features.h>
#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 5
Unlucky user
#endif
#endif
]],
[])],
[gl_cv_func_feholdexcept_works="guessing yes"],
[gl_cv_func_feholdexcept_works="guessing no"])
;;
*-musl* | midipix*)
dnl This is only needed when the module 'fenv-exceptions-trapping' is
dnl in use.
m4_ifdef([g][l_FENV_EXCEPTIONS_TRAPPING], [
case "$host_cpu" in
riscv*)
dnl This architecture does not have exception trap bits anyway.
gl_cv_func_feholdexcept_works="guessing yes"
;;
i?86)
dnl On this architecture, the feholdexcept override happens to
dnl not be needed.
gl_cv_func_feholdexcept_works="guessing yes"
;;
*)
gl_cv_func_feholdexcept_works="guessing no"
;;
esac
], [gl_cv_func_feholdexcept_works="guessing yes"])
;;
mingw* | windows*)
gl_cv_func_feholdexcept_works="guessing no"
;;
*)
dnl This test fails on FreeBSD 12.2/arm64.
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
]],
[[fenv_t env;
feclearexcept (FE_ALL_EXCEPT);
feraiseexcept (FE_INVALID | FE_OVERFLOW | FE_INEXACT);
return (feholdexcept (&env) == 0
&& fetestexcept (FE_ALL_EXCEPT) != 0);
]])
],
[gl_cv_func_feholdexcept_works="guessing yes"],
[gl_cv_func_feholdexcept_works=no],
[gl_cv_func_feholdexcept_works="guessing yes"])
LIBS="$saved_LIBS"
;;
esac
])
case "$gl_cv_func_feholdexcept_works" in
*yes) ;;
*) REPLACE_FEHOLDEXCEPT=1 ;;
esac
dnl The fegetenv function does not work on glibc 2.19/x86_64
dnl (see <https://sourceware.org/PR16198>)
dnl and Mac OS X 10.5/{i386,x86_64}.
AC_CACHE_CHECK([whether fegetenv works],
[gl_cv_func_fegetenv_works],
[case "$host" in
# Guess no on glibc ≤ 2.19 / x86_64.
x86_64-*-*-gnu* | x86_64-*-gnu*)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <string.h> /* for __GNU_LIBRARY__ */
#ifdef __GNU_LIBRARY__
#include <features.h>
#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 19
Unlucky user
#endif
#endif
]],
[])],
[gl_cv_func_fegetenv_works="guessing yes"],
[gl_cv_func_fegetenv_works="guessing no"])
;;
# Guess no on Mac OS X/{i386,x86_64}.
*86*-*-darwin*)
gl_cv_func_fegetenv_works="guessing no"
;;
*) gl_cv_func_fegetenv_works="guessing yes" ;;
esac
])
case "$gl_cv_func_fegetenv_works" in
*yes) ;;
*) REPLACE_FEGETENV=1 ;;
esac
dnl The fesetenv function does not work on FreeBSD 12.2/arm64 (see
dnl <https://cgit.freebsd.org/src/commit/?id=34cc08e336987a8ebc316595e3f552a4c09f1fd4>),
dnl on mingw 13 (where fesetenv (FE_DFL_ENV) does not reset the rounding
dnl direction),
dnl on musl libc/{i386,x86_64} and AIX and Solaris and MSVC 14 (where it
dnl fails to restore the exception trap bits),
dnl on mingw < 13 (where calling it with FE_DFL_ENV argument has no effect
dnl on the mxcsr register),
dnl and on NetBSD/m68k.
AC_CACHE_CHECK([whether fesetenv works],
[gl_cv_func_fesetenv_works],
[case "$host" in
i?86-*-*-musl* | x86_64-*-*-musl*)
dnl This is only needed when the module 'fenv-exceptions-trapping' is
dnl in use.
m4_ifdef([g][l_FENV_EXCEPTIONS_TRAPPING], [
gl_cv_func_fesetenv_works="guessing no"
], [gl_cv_func_fesetenv_works="guessing yes"])
;;
*-*-aix*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
#include <fptrap.h>
]],
[[fenv_t env;
feclearexcept (FE_ALL_EXCEPT);
if (fegetenv (&env) == 0)
{
fp_enable (TRP_DIV_BY_ZERO);
if (!fp_is_enabled (TRP_DIV_BY_ZERO))
return 1;
if (fesetenv (&env) == 0
&& fp_is_enabled (TRP_DIV_BY_ZERO))
return 2;
}
return 0;
]])
],
[gl_cv_func_fesetenv_works="guessing yes"],
[gl_cv_func_fesetenv_works=no],
[gl_cv_func_fesetenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
*-*-solaris*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
#include <ieeefp.h>
]],
[[fenv_t env1, env2;
feclearexcept (FE_ALL_EXCEPT);
if (fegetenv (&env1) == 0)
{
fpsetmask (FP_X_DZ);
if (fegetenv (&env2) == 0)
{
if (fpgetmask () != FP_X_DZ)
return 1;
if (fesetenv (&env1) == 0)
{
if (fpgetmask () != 0)
return 2;
fpsetmask (FP_X_INV);
if (fpgetmask () != FP_X_INV)
return 3;
if (fesetenv (&env2) == 0)
{
if (fpgetmask () != FP_X_DZ)
return 4;
}
}
}
}
return 0;
]])
],
[gl_cv_func_fesetenv_works="guessing yes"],
[gl_cv_func_fesetenv_works=no],
[gl_cv_func_fesetenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
# Guess no on NetBSD/m68k.
m68*-*-netbsd*)
gl_cv_func_fesetenv_works="guessing no"
;;
# Guess no on mingw and MSVC.
*86*-*-mingw* | *86*-*-windows*)
gl_cv_func_fesetenv_works="guessing no"
;;
*)
dnl This test fails on FreeBSD 12.2/arm64.
dnl Here we test only the rounding mode restoration, but the function
dnl is more broken than that.
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
]],
[[fenv_t env;
return (fesetround (FE_TOWARDZERO) == 0
&& fegetenv (&env) == 0
&& fesetround (FE_TONEAREST) == 0
&& fesetenv (&env) == 0
&& fegetround () != FE_TOWARDZERO);
]])
],
[gl_cv_func_fesetenv_works="guessing yes"],
[gl_cv_func_fesetenv_works=no],
[gl_cv_func_fesetenv_works="guessing yes"])
LIBS="$saved_LIBS"
;;
esac
])
case "$gl_cv_func_fesetenv_works" in
*yes) ;;
*) REPLACE_FESETENV=1 ;;
esac
dnl The feupdateenv function does not work on glibc 2.37/riscv64
dnl (see <https://sourceware.org/PR31022>)
dnl and on glibc 2.37/hppa
dnl (see <https://sourceware.org/PR31023>)
dnl and on glibc 2.5/{i386,x86_64,ia64} (see
dnl <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=a8c79c4088e8c04e4297936efa0dee6c8e6e974d>)
dnl and on Mac OS X 10.5/{i386,x86_64} (where it forgets about the currently
dnl set floating-point exception flags)
dnl and on musl libc/s390x and NetBSD 10.0/powerpc (where it does not
dnl trigger traps)
dnl and on musl libc/{i386,x86_64} and AIX and Solaris and mingw 10 (where
dnl it fails to restore the exception trap bits),
dnl and on FreeBSD 12.2/arm64 (see
dnl <https://cgit.freebsd.org/src/commit/?id=34cc08e336987a8ebc316595e3f552a4c09f1fd4>),
dnl and on mingw 13 (where feupdateenv (FE_DFL_ENV) does not restore the
dnl rounding direction).
dnl On MSVC 14 it may even fail.
AC_CACHE_CHECK([whether feupdateenv works],
[gl_cv_func_feupdateenv_works],
[case "$host" in
# Guess no on glibc/riscv.
riscv*-*-*-gnu*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
]],
[[return feupdateenv (FE_DFL_ENV) != 0;
]])
],
[gl_cv_func_feupdateenv_works=yes],
[gl_cv_func_feupdateenv_works=no],
[gl_cv_func_feupdateenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
# Guess no on glibc/hppa and NetBSD/powerpc64.
hppa*-*-*-gnu* | powerpc*-*-netbsd*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
]],
[[fenv_t env;
feclearexcept (FE_ALL_EXCEPT);
feenableexcept (FE_INVALID);
fegetenv (&env);
fesetenv (FE_DFL_ENV);
feraiseexcept (FE_INVALID);
feupdateenv (&env);
return 0;
]])
],
[gl_cv_func_feupdateenv_works=no],
[gl_cv_func_feupdateenv_works="guessing yes"],
[gl_cv_func_feupdateenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
# Guess no on glibc ≤ 2.5/{i386,x86_64,ia64}.
*86*-*-*-gnu* | *86*-*-gnu* | ia64*-*-*-gnu*)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <string.h> /* for __GNU_LIBRARY__ */
#ifdef __GNU_LIBRARY__
#include <features.h>
#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 5
Unlucky user
#endif
#endif
]],
[])],
[gl_cv_func_feupdateenv_works="guessing yes"],
[gl_cv_func_feupdateenv_works="guessing no"])
;;
i?86-*-*-musl* | x86_64-*-*-musl* | \
s390*-*-*-musl*)
dnl This is only needed when the module 'fenv-exceptions-trapping' is
dnl in use.
m4_ifdef([g][l_FENV_EXCEPTIONS_TRAPPING], [
gl_cv_func_feupdateenv_works="guessing no"
], [gl_cv_func_feupdateenv_works="guessing yes"])
;;
*-*-aix*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
#include <fptrap.h>
]],
[[fenv_t env;
feclearexcept (FE_ALL_EXCEPT);
if (fegetenv (&env) == 0)
{
fp_enable (TRP_DIV_BY_ZERO);
if (!fp_is_enabled (TRP_DIV_BY_ZERO))
return 1;
if (feupdateenv (&env) == 0
&& fp_is_enabled (TRP_DIV_BY_ZERO))
return 2;
}
return 0;
]])
],
[gl_cv_func_feupdateenv_works="guessing yes"],
[gl_cv_func_feupdateenv_works=no],
[gl_cv_func_feupdateenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
*-*-solaris*)
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
#include <ieeefp.h>
]],
[[fenv_t env1, env2;
feclearexcept (FE_ALL_EXCEPT);
if (fegetenv (&env1) == 0)
{
fpsetmask (FP_X_DZ);
if (fegetenv (&env2) == 0)
{
if (fpgetmask () != FP_X_DZ)
return 1;
if (feupdateenv (&env1) == 0)
{
if (fpgetmask () != 0)
return 2;
fpsetmask (FP_X_INV);
if (fpgetmask () != FP_X_INV)
return 3;
if (feupdateenv (&env2) == 0)
{
if (fpgetmask () != FP_X_DZ)
return 4;
}
}
}
}
return 0;
]])
],
[gl_cv_func_feupdateenv_works="guessing yes"],
[gl_cv_func_feupdateenv_works=no],
[gl_cv_func_feupdateenv_works="guessing no"])
LIBS="$saved_LIBS"
;;
# Guess no on Mac OS X/{i386,x86_64}.
*86*-*-darwin*)
gl_cv_func_feupdateenv_works="guessing no"
;;
# Guess no on mingw and MSVC.
*86*-*-mingw* | *86*-*-windows*)
gl_cv_func_feupdateenv_works="guessing no"
;;
*)
dnl This test fails on FreeBSD 12.2/arm64.
dnl Here we test only the rounding mode restoration, but the function
dnl is more broken than that.
saved_LIBS="$LIBS"
LIBS="$LIBS $FENV_ENVIRONMENT_LIBM"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <fenv.h>
]],
[[fenv_t env;
return (fesetround (FE_TOWARDZERO) == 0
&& fegetenv (&env) == 0
&& fesetround (FE_TONEAREST) == 0
&& feupdateenv (&env) == 0
&& fegetround () != FE_TOWARDZERO);
]])
],
[gl_cv_func_feupdateenv_works="guessing yes"],
[gl_cv_func_feupdateenv_works=no],
[gl_cv_func_feupdateenv_works="guessing yes"])
LIBS="$saved_LIBS"
;;
esac
])
case "$gl_cv_func_feupdateenv_works" in
*yes) ;;
*) REPLACE_FEUPDATEENV=1 ;;
esac
dnl Two functions are in the same compilation unit.
if test $REPLACE_FEGETENV = 1 || test $REPLACE_FESETENV = 1; then
REPLACE_FEGETENV=1
REPLACE_FESETENV=1
fi
dnl On AIX, feholdexcept, like fegetenv, does not save the exception trap
dnl bits.
case "$host_os" in
aix*)
if test $REPLACE_FEGETENV = 1; then
REPLACE_FEHOLDEXCEPT=1
fi
;;
esac
else
HAVE_FEGETENV=0
HAVE_FESETENV=0
HAVE_FEUPDATEENV=0
HAVE_FEHOLDEXCEPT=0
dnl It needs linking with -lm on platforms which define FE_DFL_ENV as the
dnl address of a global variable.
case "$host" in
powerpc*-*-linux*-gnu* | \
*-*-freebsd* | *-*-dragonfly* | \
*-*-netbsd* | \
*-*-openbsd* | \
*-*-solaris* )
FENV_ENVIRONMENT_LIBM=-lm ;;
*) FENV_ENVIRONMENT_LIBM= ;;
esac
fi
AC_SUBST([FENV_ENVIRONMENT_LIBM])
])