Blame m4/fpieee.m4

Packit Service fdd496
# fpieee.m4 serial 2  -*- coding: utf-8 -*-
Packit Service fdd496
dnl Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
Packit Service fdd496
dnl This file is free software; the Free Software Foundation
Packit Service fdd496
dnl gives unlimited permission to copy and/or distribute it,
Packit Service fdd496
dnl with or without modifications, as long as this notice is preserved.
Packit Service fdd496
Packit Service fdd496
dnl IEEE 754 standardized three items:
Packit Service fdd496
dnl - The formats of single-float and double-float - nowadays commonly
Packit Service fdd496
dnl   available as 'float' and 'double' in C and C++.
Packit Service fdd496
dnl   No autoconf test needed.
Packit Service fdd496
dnl - The overflow and division by zero behaviour: The result are values
Packit Service fdd496
dnl   '±Inf' and 'NaN', rather than exceptions as it was before.
Packit Service fdd496
dnl   This file provides an autoconf macro for ensuring this behaviour of
Packit Service fdd496
dnl   floating-point operations.
Packit Service fdd496
dnl - A set of conditions (overflow, underflow, inexact, etc.) which can
Packit Service fdd496
dnl   be configured to trigger an exception.
Packit Service fdd496
dnl   This cannot be done in a portable way: it depends on the compiler,
Packit Service fdd496
dnl   libc, kernel, and CPU.  No autoconf macro is provided for this.
Packit Service fdd496
Packit Service fdd496
dnl Ensure non-trapping behaviour of floating-point overflow and
Packit Service fdd496
dnl floating-point division by zero.
Packit Service fdd496
dnl (For integer overflow, see gcc's -ftrapv option; for integer division by
Packit Service fdd496
dnl zero, see the autoconf macro in intdiv0.m4.)
Packit Service fdd496
Packit Service fdd496
AC_DEFUN([gl_FP_IEEE],
Packit Service fdd496
[
Packit Service fdd496
  AC_REQUIRE([AC_PROG_CC])
Packit Service fdd496
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit Service fdd496
  # IEEE behaviour is the default on all CPUs except Alpha and SH
Packit Service fdd496
  # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
Packit Service fdd496
  # and the GCC 4.1.2 manual).
Packit Service fdd496
  case "$host_cpu" in
Packit Service fdd496
    alpha*)
Packit Service fdd496
      # On Alpha systems, a compiler option provides the behaviour.
Packit Service fdd496
      # See the ieee(3) manual page, also available at
Packit Service fdd496
      # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM>
Packit Service fdd496
      if test -n "$GCC"; then
Packit Service fdd496
        # GCC has the option -mieee.
Packit Service fdd496
        # For full IEEE compliance (rarely needed), use option -mieee-with-inexact.
Packit Service fdd496
        CPPFLAGS="$CPPFLAGS -mieee"
Packit Service fdd496
      else
Packit Service fdd496
        # Compaq (ex-DEC) C has the option -ieee, equivalent to -ieee_with_no_inexact.
Packit Service fdd496
        # For full IEEE compliance (rarely needed), use option -ieee_with_inexact.
Packit Service fdd496
        CPPFLAGS="$CPPFLAGS -ieee"
Packit Service fdd496
      fi
Packit Service fdd496
      ;;
Packit Service fdd496
    sh*)
Packit Service fdd496
      if test -n "$GCC"; then
Packit Service fdd496
        # GCC has the option -mieee.
Packit Service fdd496
        CPPFLAGS="$CPPFLAGS -mieee"
Packit Service fdd496
      fi
Packit Service fdd496
      ;;
Packit Service fdd496
  esac
Packit Service fdd496
])