1
1
dnl -* - shell-script -* -
2
2
dnl
3
- dnl Copyright (c) 2018-2020 FUJITSU LIMITED. All rights reserved.
3
+ dnl Copyright (c) 2018-2021 FUJITSU LIMITED. All rights reserved.
4
4
dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
5
- dnl Copyright (c) 2021 Triad National Security, LLC. All rights
6
- dnl reserved.
7
5
dnl $COPYRIGHT $
8
6
dnl
9
7
dnl Additional copyrights may follow
@@ -16,16 +14,7 @@ dnl Check whether the user wants to use an alternate type of C 'short float'.
16
14
dnl OPAL_CHECK_ALT_SHORT_FLOAT
17
15
dnl ------------------------------------------------------------
18
16
AC_DEFUN([OPAL_CHECK_ALT_SHORT_FLOAT], [
19
- dnl
20
- dnl Testing for this without checking if compiler generates warnings makes for a messy build.
21
- dnl Hence the twiddling of the CFLAGS
22
- dnl
23
- OPAL_VAR_SCOPE_PUSH([CFLAGS_save])
24
- CFLAGS_save=$CFLAGS
25
- CFLAGS=" -Werror $CFLAGS "
26
17
AC_CHECK_TYPES(_Float16)
27
- CFLAGS=$CFLAGS_save
28
- OPAL_VAR_SCOPE_POP
29
18
AC_MSG_CHECKING([if want alternate C type of short float])
30
19
AC_ARG_ENABLE([alt-short-float],
31
20
[AS_HELP_STRING([--enable-alt-short-float= TYPE],
58
47
# automagically add that flag -- we'll just emit a warning and
59
48
# point the user to a README where more information is
60
49
# available.
61
- AC_MSG_CHECKING([if compiler supports arithmetic operations on $opal_short_float_type ])
62
50
AS_IF([test $opal_alt_short_float_exists -eq 1],
63
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
51
+ [AC_MSG_CHECKING([if compiler supports arithmetic operations on $opal_short_float_type ])
52
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
64
53
static $opal_short_float_type a = 2.5, b = 3.8;
65
54
a += b; ]])],
66
55
[AC_MSG_RESULT([yes])
@@ -85,6 +74,29 @@ a += b;]])],
85
74
AC_CHECK_SIZEOF(opal_short_float_t)
86
75
AC_CHECK_SIZEOF(opal_short_float_complex_t)
87
76
OPAL_C_GET_ALIGNMENT(opal_short_float_t, OPAL_ALIGNMENT_OPAL_SHORT_FLOAT_T)
77
+
78
+ # Some versions of GCC (around 9.1.0?) emit a warning for _Float16
79
+ # when compiling with -pedantic. Using __extension__ can suppress
80
+ # the warning. The warning can be detected by -Werror in configure.
81
+ # See https://github.com/open-mpi/ompi/issues/8840
82
+ AC_MSG_CHECKING([if $opal_short_float_type needs __extension__ keyword])
83
+ opal_alt_short_float_needs_extension=0
84
+ OPAL_VAR_SCOPE_PUSH([CFLAGS_save])
85
+ CFLAGS_save=$CFLAGS
86
+ CFLAGS=" -Werror $CFLAGS "
87
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$opal_short_float_type a; ])],
88
+ [AC_MSG_RESULT([no])],
89
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([__extension__ $opal_short_float_type a; ])],
90
+ [opal_alt_short_float_needs_extension= 1
91
+ AC_MSG_RESULT([yes])],
92
+ [AC_MSG_RESULT([no])])])
93
+ CFLAGS=$CFLAGS_save
94
+ OPAL_VAR_SCOPE_POP
95
+ AC_DEFINE_UNQUOTED(OPAL_SHORT_FLOAT_TYPE, [[$opal_short_float_type ]],
96
+ [User-selected alternate C type of short float (used to redefine opal_short_float_t in opal_bottom.h)])
97
+ AC_DEFINE_UNQUOTED(OPAL_SHORT_FLOAT_NEEDS_EXTENSION,
98
+ [$opal_alt_short_float_needs_extension ],
99
+ [Whether $opal_short_float_type needs __extension__ keyword])
88
100
elif test " $enable_alt_short_float " ! = " " ; then
89
101
AC_MSG_ERROR([Alternate C type of short float $opal_short_float_type requested but not available. Aborting])
90
102
fi
0 commit comments