Debian Codegraph @

m4/fpieee.m4

raw
1 # fpieee.m4
2 # serial 2
3 dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 dnl IEEE 754 standardized three items:
10 dnl - The formats of single-float and double-float - nowadays commonly
11 dnl available as 'float' and 'double' in C and C++.
12 dnl No autoconf test needed.
13 dnl - The overflow and division by zero behaviour: The result are values
14 dnl '±Inf' and 'NaN', rather than exceptions as it was before.
15 dnl This file provides an autoconf macro for ensuring this behaviour of
16 dnl floating-point operations.
17 dnl - A set of conditions (overflow, underflow, inexact, etc.) which can
18 dnl be configured to trigger an exception.
19 dnl This cannot be done in a portable way: it depends on the compiler,
20 dnl libc, kernel, and CPU. No autoconf macro is provided for this.
21
22 dnl Ensure non-trapping behaviour of floating-point overflow and
23 dnl floating-point division by zero.
24 dnl (For integer overflow, see gcc's -ftrapv option; for integer division by
25 dnl zero, see the autoconf macro in intdiv0.m4.)
26
27 AC_DEFUN([gl_FP_IEEE],
28 [
29 AC_REQUIRE([AC_PROG_CC])
30 AC_REQUIRE([AC_CANONICAL_HOST])
31 # IEEE behaviour is the default on all CPUs except Alpha and SH
32 # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
33 # and the GCC 4.1.2 manual).
34 case "$host_cpu" in
35 alpha*)
36 # On Alpha systems, a compiler option provides the behaviour.
37 # See the ieee(3) manual page, also available at
38 # <https://backdrift.org/man/tru64/man3/ieee.3.html>
39 if test -n "$GCC"; then
40 # GCC has the option -mieee.
41 # For full IEEE compliance (rarely needed), use option -mieee-with-inexact.
42 CPPFLAGS="$CPPFLAGS -mieee"
43 else
44 # Compaq (ex-DEC) C has the option -ieee, equivalent to -ieee_with_no_inexact.
45 # For full IEEE compliance (rarely needed), use option -ieee_with_inexact.
46 CPPFLAGS="$CPPFLAGS -ieee"
47 fi
48 ;;
49 sh*)
50 if test -n "$GCC"; then
51 # GCC has the option -mieee.
52 CPPFLAGS="$CPPFLAGS -mieee"
53 fi
54 ;;
55 esac
56 ])