@@ -14,8 +14,8 @@ dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
14
14
dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
15
15
dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
16
16
dnl reserved.
17
- dnl Copyright (c) 2015 Research Organization for Information Science
18
- dnl and Technology (RIST). All rights reserved.
17
+ dnl Copyright (c) 2015-2018 Research Organization for Information Science
18
+ dnl and Technology (RIST). All rights reserved.
19
19
dnl $COPYRIGHT $
20
20
dnl
21
21
dnl Additional copyrights may follow
@@ -24,52 +24,44 @@ dnl $HEADER$
24
24
dnl
25
25
26
26
AC_DEFUN([OPAL_CC_HELPER],[
27
- OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper_tmp ])
27
+ OPAL_VAR_SCOPE_PUSH([opal_cc_helper_result ])
28
28
AC_MSG_CHECKING([$1 ])
29
29
30
- opal_prog_cc_c11_helper_tmp= 0
30
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([$3 ],[$4 ])],
31
+ [$2 = 1
32
+ opal_cc_helper_result= yes],
33
+ [$2 = 0
34
+ opal_cc_helper_result= no])
31
35
32
- AC_LINK_IFELSE([AC_LANG_PROGRAM([$3 ],[$4 ])],[
33
- $2 = yes
34
- opal_prog_cc_c11_helper_tmp= 1], [$2 = no])
35
-
36
- AC_DEFINE_UNQUOTED([$5 ], [$opal_prog_cc_c11_helper_tmp ], [$6 ])
37
-
38
- AC_MSG_RESULT([$$ 2])
36
+ AC_MSG_RESULT([$opal_cc_helper_result ])
39
37
OPAL_VAR_SCOPE_POP
40
38
])
41
39
42
40
43
41
AC_DEFUN([OPAL_PROG_CC_C11_HELPER],[
44
- OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper_CFLAGS_save opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available ])
42
+ OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper_CFLAGS_save])
45
43
46
44
opal_prog_cc_c11_helper_CFLAGS_save= $CFLAGS
47
45
CFLAGS= " $CFLAGS $1 "
48
46
49
47
OPAL_CC_HELPER([if $CC $1 supports C11 _Thread_local], [opal_prog_cc_c11_helper__Thread_local_available],
50
- [],[[static _Thread_local int foo = 1; ++foo; ]], [OPAL_C_HAVE__THREAD_LOCAL],
51
- [Whether C compiler supports __Thread_local])
48
+ [],[[static _Thread_local int foo = 1; ++foo; ]])
52
49
53
50
OPAL_CC_HELPER([if $CC $1 supports C11 atomic variables], [opal_prog_cc_c11_helper_atomic_var_available],
54
- [[# include <stdatomic.h>]], [[static atomic_long foo = 1;++foo;]], [OPAL_C_HAVE_ATOMIC_CONV_VAR],
55
- [Whether C compiler support atomic convenience variables in stdatomic.h])
51
+ [[# include <stdatomic.h>]], [[static atomic_long foo = 1;++foo;]])
56
52
57
53
OPAL_CC_HELPER([if $CC $1 supports C11 _Atomic keyword], [opal_prog_cc_c11_helper__Atomic_available],
58
- [[# include <stdatomic.h>]],[[static _Atomic long foo = 1;++foo;]], [OPAL_C_HAVE__ATOMIC],
59
- [Whether C compiler supports __Atomic keyword])
54
+ [[# include <stdatomic.h>]],[[static _Atomic long foo = 1;++foo;]])
60
55
61
56
OPAL_CC_HELPER([if $CC $1 supports C11 _Generic keyword], [opal_prog_cc_c11_helper__Generic_available],
62
- [[# define FOO(x) (_Generic (x, int: 1))]], [[static int x, y; y = FOO(x);]], [OPAL_C_HAVE__GENERIC],
63
- [Whether C compiler supports __Generic keyword])
57
+ [[# define FOO(x) (_Generic (x, int: 1))]], [[static int x, y; y = FOO(x);]])
64
58
65
59
OPAL_CC_HELPER([if $CC $1 supports C11 _Static_assert], [opal_prog_cc_c11_helper__static_assert_available],
66
- [[# include <stdint.h>]],[[_Static_assert(sizeof(int64_t) == 8, "WTH");]], [OPAL_C_HAVE__STATIC_ASSERT],
67
- [Whether C compiler support _Static_assert keyword])
60
+ [[# include <stdint.h>]],[[_Static_assert(sizeof(int64_t) == 8, "WTH");]])
68
61
69
- dnl At this time Open MPI only needs thread local and the atomic convenience types for C11 support. These
70
- dnl will likely be required in the future.
71
- AS_IF([test " x$opal_prog_cc_c11_helper__Thread_local_available " = " xyes" && test " x$opal_prog_cc_c11_helper_atomic_var_available " = " xyes" ],
72
- [$2 ], [$3 ])
62
+ AS_IF([test $opal_prog_cc_c11_helper__Thread_local_available -eq 1 && test $opal_prog_cc_c11_helper_atomic_var_available -eq 1],
63
+ [$2 ],
64
+ [$3 ])
73
65
74
66
CFLAGS= $opal_prog_cc_c11_helper_CFLAGS_save
75
67
@@ -135,6 +127,8 @@ AC_DEFUN([OPAL_SETUP_CC],[
135
127
AC_REQUIRE([_OPAL_PROG_CC])
136
128
AC_REQUIRE([AM_PROG_CC_C_O])
137
129
130
+ OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc__thread_available])
131
+
138
132
# AC_PROG_CC_C99 changes CC (instead of CFLAGS) so save CC (without c99
139
133
# flags) for use in our wrappers.
140
134
WRAPPER_CC= " $CC "
@@ -157,15 +151,35 @@ AC_DEFUN([OPAL_SETUP_CC],[
157
151
158
152
# Get the correct result for C11 support flags now that the compiler flags have
159
153
# changed
160
- OPAL_PROG_CC_C11_HELPER([],[],[])
154
+ OPAL_PROG_CC_C11_HELPER([], [], [])
161
155
fi
162
156
163
157
# Check if compiler support __thread
164
- OPAL_VAR_SCOPE_PUSH([opal_prog_cc__thread_available])
165
158
OPAL_CC_HELPER([if $CC $1 supports __thread], [opal_prog_cc__thread_available],
166
- [],[[static __thread int foo = 1; ++foo; ]], [OPAL_C_HAVE___THREAD],
167
- [Whether C compiler supports __thread])
168
- OPAL_VAR_SCOPE_POP
159
+ [],[[static __thread int foo = 1; ++foo; ]])
160
+
161
+ OPAL_CC_HELPER([if $CC $1 supports C11 _Thread_local], [opal_prog_cc_c11_helper__Thread_local_available],
162
+ [],[[static _Thread_local int foo = 1; ++foo; ]])
163
+
164
+ dnl At this time Open MPI only needs thread local and the atomic convenience types for C11 support. These
165
+ dnl will likely be required in the future.
166
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE__THREAD_LOCAL], [$opal_prog_cc_c11_helper__Thread_local_available ],
167
+ [Whether C compiler supports __Thread_local])
168
+
169
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE_ATOMIC_CONV_VAR], [$opal_prog_cc_c11_helper_atomic_var_available ],
170
+ [Whether C compiler support atomic convenience variables in stdatomic.h])
171
+
172
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE__ATOMIC], [$opal_prog_cc_c11_helper__Atomic_available ],
173
+ [Whether C compiler supports __Atomic keyword])
174
+
175
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE__GENERIC], [$opal_prog_cc_c11_helper__Generic_available ],
176
+ [Whether C compiler supports __Generic keyword])
177
+
178
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE__STATIC_ASSERT], [$opal_prog_cc_c11_helper__static_assert_available ],
179
+ [Whether C compiler support _Static_assert keyword])
180
+
181
+ AC_DEFINE_UNQUOTED([OPAL_C_HAVE___THREAD], [$opal_prog_cc__thread_available ],
182
+ [Whether C compiler supports __thread])
169
183
170
184
OPAL_C_COMPILER_VENDOR([opal_c_vendor])
171
185
@@ -462,6 +476,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
462
476
OPAL_ENSURE_CONTAINS_OPTFLAGS([" $CFLAGS " ])
463
477
AC_MSG_RESULT([$co_result ])
464
478
CFLAGS=" $co_result "
479
+ OPAL_VAR_SCOPE_POP
465
480
])
466
481
467
482
0 commit comments