xref: /netbsd-src/external/gpl3/binutils.old/dist/config/dfp.m4 (revision e992f068c547fd6e84b3f104dc2340adcc955732)
1# Copyright (C) 2010-2022 Free Software Foundation, Inc.
2
3# This file is part of GCC.
4
5# GCC is free software; you can redistribute it and/or modify it under
6# the terms of the GNU General Public License as published by the Free
7# Software Foundation; either version 3, or (at your option) any
8# later version.
9
10# GCC is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13# License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with GCC; see the file COPYING3.  If not see
17# <http://www.gnu.org/licenses/>.
18
19dnl @synopsis GCC_AC_ENABLE_DECIMAL_FLOAT([target triplet])
20dnl
21dnl Enable C extension for decimal float if target supports it.
22dnl
23dnl @author Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
24
25AC_DEFUN([GCC_AC_ENABLE_DECIMAL_FLOAT],
26[
27AC_ARG_ENABLE(decimal-float,
28[  --enable-decimal-float={no,yes,bid,dpd}
29			enable decimal float extension to C.  Selecting 'bid'
30			or 'dpd' choses which decimal floating point format
31			to use],
32[
33  case $enable_decimal_float in
34    yes | no | bid | dpd) default_decimal_float=$enable_decimal_float ;;
35    *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float.
36Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
37  esac
38],
39[
40  case $1 in
41    aarch64* | \
42    powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
43    i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \
44    i?86*-*-mingw* | x86_64*-*-mingw* | \
45    i?86*-*-cygwin* | x86_64*-*-cygwin*)
46      enable_decimal_float=yes
47      ;;
48    *)
49      AC_MSG_WARN([decimal float is not supported for this target, ignored])
50      enable_decimal_float=no
51      ;;
52  esac
53])
54
55# x86's use BID format instead of DPD
56case x$enable_decimal_float in
57  xyes)
58    case $1 in
59      aarch64* | i?86*-*-* | x86_64*-*-*)
60	enable_decimal_float=bid
61	;;
62      *)
63	enable_decimal_float=dpd
64	;;
65    esac
66    default_decimal_float=$enable_decimal_float
67    ;;
68  xno)
69    # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper
70    # dependency on libdecnumber.
71    default_decimal_float=dpd
72    ;;
73esac
74AC_SUBST(enable_decimal_float)
75
76])
77