Skip to content

Commit e0f3ebd

Browse files
committed
configury: convert legacy AC_TRY_* macros
Convert AC_TRY_COMPILE, AC_TRY_LINK, and AC_TRY_RUN to AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE, respectively. Using the legacy macros emits warnings in Autoconf >= v2.70. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 4dbcff8 commit e0f3ebd

9 files changed

+56
-62
lines changed

config/ompi_interix.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dnl
33
dnl Copyright (c) 2008 The University of Tennessee and The University
44
dnl of Tennessee Research Foundation. All rights
55
dnl reserved.
6+
dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved.
67
dnl $COPYRIGHT$
78
dnl
89
dnl Additional copyrights may follow
@@ -24,10 +25,10 @@ dnl
2425
AC_DEFUN([OMPI_INTERIX],[
2526

2627
AC_MSG_CHECKING(for Interix environment)
27-
AC_TRY_COMPILE([],
28+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
2829
[#if !defined(__INTERIX)
2930
#error Normal Unix environment
30-
#endif],
31+
#endif])],
3132
is_interix=yes,
3233
is_interix=no)
3334
AC_MSG_RESULT([$is_interix])

config/ompi_microsoft.m4

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dnl
33
dnl Copyright (c) 2004-2007 The University of Tennessee and The University
44
dnl of Tennessee Research Foundation. All rights
55
dnl reserved.
6+
dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved.
67
dnl $COPYRIGHT$
78
dnl
89
dnl Additional copyrights may follow
@@ -39,17 +40,17 @@ AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
3940

4041
# The atomic functions are defined in a very unuasual manner.
4142
# Some of them are intrinsic defined in windows.h others are
42-
# exported by kernel32.dll. If we force the usage of AC_TRY_RUN
43+
# exported by kernel32.dll. If we force the usage of AC RUN_IFELSE
4344
# here we will check for both in same time: compilation and run.
4445

4546
AC_MSG_CHECKING(for working InterlockedCompareExchange)
46-
AC_TRY_RUN( [#include <windows.h>
47+
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <windows.h>
4748
int main() {
4849
LONG dest = 1, exchange = 0, comperand = 1;
4950
SetErrorMode(SEM_FAILCRITICALERRORS);
5051
InterlockedCompareExchange( &dest, exchange, comperand );
5152
return (int)dest;
52-
}],
53+
}])],
5354
[AC_MSG_RESULT(yes)
5455
ompi_windows_have_support_for_32_bits_atomic=1],
5556
[AC_MSG_RESULT(no)
@@ -59,13 +60,13 @@ AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
5960
[Whether we support 32 bits atomic operations on Windows])
6061

6162
AC_MSG_CHECKING(for working InterlockedCompareExchangeAcquire)
62-
AC_TRY_RUN( [#include <windows.h>
63+
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <windows.h>
6364
int main() {
6465
LONG dest = 1, exchange = 0, comperand = 1;
6566
SetErrorMode(SEM_FAILCRITICALERRORS);
6667
InterlockedCompareExchangeAcquire( &dest, exchange, comperand );
6768
return (int)dest;
68-
}],
69+
}])],
6970
[AC_MSG_RESULT(yes)
7071
ompi_windows_have_support_for_32_bits_atomic=1],
7172
[AC_MSG_RESULT(no)
@@ -75,13 +76,13 @@ AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
7576
[Whether we support 32 bits atomic operations on Windows])
7677

7778
AC_MSG_CHECKING(for working InterlockedCompareExchangeRelease)
78-
AC_TRY_RUN( [#include <windows.h>
79+
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <windows.h>
7980
int main() {
8081
LONG dest = 1, exchange = 0, comperand = 1;
8182
SetErrorMode(SEM_FAILCRITICALERRORS);
8283
InterlockedCompareExchangeRelease( &dest, exchange, comperand );
8384
return (int)dest;
84-
}],
85+
}])],
8586
[AC_MSG_RESULT(yes)
8687
ompi_windows_have_support_for_32_bits_atomic=1],
8788
[AC_MSG_RESULT(no)
@@ -91,13 +92,13 @@ AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
9192
[Whether we support 32 bits atomic operations on Windows])
9293

9394
AC_MSG_CHECKING(for working InterlockedCompareExchange64)
94-
AC_TRY_RUN( [#include <windows.h>
95+
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <windows.h>
9596
int main() {
9697
LONGLONG dest = 1, exchange = 0, comperand = 1;
9798
SetErrorMode(SEM_FAILCRITICALERRORS);
9899
InterlockedCompareExchange64( &dest, exchange, comperand );
99100
return (int)dest;
100-
}],
101+
}])],
101102
[AC_MSG_RESULT(yes)
102103
ompi_windows_have_support_for_64_bits_atomic=1],
103104
[AC_MSG_RESULT(no)

config/opal_check_attributes.m4

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
14-
dnl Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
14+
dnl Copyright (c) 2010-2021 Cisco Systems, Inc. All rights reserved
1515
dnl Copyright (c) 2013 Mellanox Technologies, Inc.
1616
dnl All rights reserved.
1717
dnl Copyright (c) 2015 Research Organization for Information Science
@@ -64,7 +64,7 @@ AC_DEFUN([_OPAL_CHECK_SPECIFIC_ATTRIBUTE], [
6464
#
6565
# Try to compile using the C compiler, then C++
6666
#
67-
AC_TRY_COMPILE([$2],[],
67+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$2],[])],
6868
[
6969
#
7070
# In case we did succeed: Fine, but was this due to the
@@ -82,10 +82,10 @@ AC_DEFUN([_OPAL_CHECK_SPECIFIC_ATTRIBUTE], [
8282
m4_ifdef([project_ompi],
8383
[if test "$opal_cv___attribute__[$1]" = "1" ; then
8484
AC_LANG_PUSH(C++)
85-
AC_TRY_COMPILE([
85+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
8686
extern "C" {
8787
$2
88-
}],[],
88+
}],[])],
8989
[
9090
opal_cv___attribute__[$1]=1
9191
_OPAL_ATTRIBUTE_FAIL_SEARCH([$1])
@@ -103,11 +103,11 @@ AC_DEFUN([_OPAL_CHECK_SPECIFIC_ATTRIBUTE], [
103103
CFLAGS_safe=$CFLAGS
104104
CFLAGS="$CFLAGS [$4]"
105105

106-
AC_TRY_COMPILE([$3],
106+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$3],
107107
[
108108
int i=4711;
109109
i=usage(&i);
110-
],
110+
])],
111111
[opal_cv___attribute__[$1]=0],
112112
[
113113
#
@@ -161,29 +161,29 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
161161
AC_MSG_CHECKING(for __attribute__)
162162

163163
AC_CACHE_VAL(opal_cv___attribute__, [
164-
AC_TRY_COMPILE(
164+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
165165
[#include <stdlib.h>
166166
/* Check for the longest available __attribute__ (since gcc-2.3) */
167167
struct foo {
168168
char a;
169169
int x[2] __attribute__ ((__packed__));
170170
};
171171
],
172-
[],
172+
[])],
173173
[opal_cv___attribute__=1],
174174
[opal_cv___attribute__=0],
175175
)
176176

177177
if test "$opal_cv___attribute__" = "1" ; then
178-
AC_TRY_COMPILE(
178+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
179179
[#include <stdlib.h>
180180
/* Check for the longest available __attribute__ (since gcc-2.3) */
181181
struct foo {
182182
char a;
183183
int x[2] __attribute__ ((__packed__));
184184
};
185185
],
186-
[],
186+
[])],
187187
[opal_cv___attribute__=1],
188188
[opal_cv___attribute__=0],
189189
)

config/opal_check_cflags.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2021 IBM Corporation. All rights reserved.
4+
dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved.
45
dnl
56
dnl $COPYRIGHT$
67
dnl
@@ -24,7 +25,7 @@ AC_MSG_CHECKING(if $CC supports ([$1]))
2425
CFLAGS_orig=$CFLAGS
2526
CFLAGS="$CFLAGS $1"
2627
AC_CACHE_VAL(opal_cv_cc_[$2], [
27-
AC_TRY_COMPILE([], [$3],
28+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [$3])],
2829
[
2930
opal_cv_cc_[$2]=1
3031
_OPAL_CFLAGS_FAIL_SEARCH("ignored\|not recognized\|not supported\|not compatible\|unrecognized\|unknown", [$2])
@@ -55,7 +56,7 @@ AC_MSG_CHECKING(if $CXX supports ([$1]))
5556
CXXFLAGS_orig=$CXXFLAGS
5657
CXXFLAGS="$CXXFLAGS $1"
5758
AC_CACHE_VAL(opal_cv_cxx_[$2], [
58-
AC_TRY_COMPILE([], [$3],
59+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [$3])],
5960
[
6061
opal_cv_cxx_[$2]=1
6162
_OPAL_CXXFLAGS_FAIL_SEARCH("ignored\|not recognized\|not supported\|not compatible\|unrecognized\|unknown", [$2])

config/opal_check_compiler_version.m4

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
4+
dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved.
45
dnl
56
dnl $COPYRIGHT$
67
dnl
@@ -31,20 +32,16 @@ AC_DEFUN([OPAL_CHECK_COMPILER], [
3132
[
3233
CPPFLAGS_orig=$CPPFLAGS
3334
CPPFLAGS="-I${OPAL_TOP_SRCDIR}/opal/include/opal $CPPFLAGS"
34-
AC_TRY_RUN([
35+
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3536
#include <stdio.h>
3637
#include <stdlib.h>
3738
#include "opal_portable_platform.h"
38-
39-
int main (int argc, char * argv[])
40-
{
39+
]],[[
4140
FILE * f;
4241
f=fopen("conftestval", "w");
4342
if (!f) exit(1);
4443
fprintf (f, "%d", PLATFORM_COMPILER_$1);
45-
return 0;
46-
}
47-
], [
44+
]])], [
4845
eval opal_cv_compiler_$1=`cat conftestval`;
4946
], [
5047
eval opal_cv_compiler_$1=0
@@ -63,20 +60,16 @@ AC_DEFUN([OPAL_CHECK_COMPILER_STRING], [
6360
[
6461
CPPFLAGS_orig=$CPPFLAGS
6562
CPPFLAGS="-I${OPAL_TOP_SRCDIR}/opal/include/opal $CPPFLAGS"
66-
AC_TRY_RUN([
63+
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6764
#include <stdio.h>
6865
#include <stdlib.h>
6966
#include "opal_portable_platform.h"
70-
71-
int main (int argc, char * argv[])
72-
{
67+
]],[[
7368
FILE * f;
7469
f=fopen("conftestval", "w");
7570
if (!f) exit(1);
7671
fprintf (f, "%s", PLATFORM_COMPILER_$1);
77-
return 0;
78-
}
79-
], [
72+
]])], [
8073
eval opal_cv_compiler_$1=`cat conftestval`;
8174
], [
8275
eval opal_cv_compiler_$1=UNKNOWN
@@ -96,20 +89,16 @@ AC_DEFUN([OPAL_CHECK_COMPILER_STRINGIFY], [
9689
[
9790
CPPFLAGS_orig=$CPPFLAGS
9891
CPPFLAGS="-I${OPAL_TOP_SRCDIR}/opal/include/opal $CPPFLAGS"
99-
AC_TRY_RUN([
92+
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
10093
#include <stdio.h>
10194
#include <stdlib.h>
10295
#include "opal_portable_platform.h"
103-
104-
int main (int argc, char * argv[])
105-
{
96+
]],[[
10697
FILE * f;
10798
f=fopen("conftestval", "w");
10899
if (!f) exit(1);
109100
fprintf (f, "%s", _STRINGIFY(PLATFORM_COMPILER_$1));
110-
return 0;
111-
}
112-
], [
101+
]])], [
113102
eval opal_cv_compiler_$1=`cat conftestval`;
114103
], [
115104
eval opal_cv_compiler_$1=UNKNOWN

config/opal_check_icc.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
14+
dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved.
1415
dnl $COPYRIGHT$
1516
dnl
1617
dnl Additional copyrights may follow
@@ -24,7 +25,7 @@ dnl On EM64T, icc-8.1 before version 8.1.027 segfaulted, since
2425
dnl va_start was miscompiled...
2526
dnl
2627
AC_MSG_CHECKING([whether icc-8.1 for EM64T works with variable arguments])
27-
AC_TRY_RUN([
28+
AC_RUN_IFELSE([AC_LANG_PROGRAM([
2829
#include <stdarg.h>
2930
#include <stdio.h>
3031
#include <stdlib.h>
@@ -46,7 +47,7 @@ int main ()
4647
return 0;
4748
}
4849

49-
],[opal_ac_icc_varargs=`test -f conftestval`],[opal_ac_icc_varargs=1],[opal_ac_icc_varargs=1])
50+
])],[opal_ac_icc_varargs=`test -f conftestval`],[opal_ac_icc_varargs=1],[opal_ac_icc_varargs=1])
5051

5152
if test "$opal_ac_icc_varargs" = "1"; then
5253
AC_MSG_WARN([*** Problem running configure test!])

config/opal_config_asm.m4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
99
dnl University of Stuttgart. All rights reserved.
1010
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1111
dnl All rights reserved.
12-
dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
12+
dnl Copyright (c) 2008-2021 Cisco Systems, Inc. All rights reserved.
1313
dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
1414
dnl Copyright (c) 2015-2018 Research Organization for Information Science
1515
dnl and Technology (RIST). All rights reserved.
@@ -334,15 +334,15 @@ AC_DEFUN([OPAL_CHECK_GCC_ATOMIC_BUILTINS], [
334334
if test -z "$opal_cv_have___atomic" ; then
335335
AC_MSG_CHECKING([for 32-bit GCC built-in atomics])
336336
337-
AC_TRY_LINK([
337+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
338338
#include <stdint.h>
339339
uint32_t tmp, old = 0;
340340
uint64_t tmp64, old64 = 0;], [
341341
__atomic_thread_fence(__ATOMIC_SEQ_CST);
342342
__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
343343
__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED);
344344
__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
345-
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);],
345+
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);])],
346346
[opal_cv_have___atomic=yes],
347347
[opal_cv_have___atomic=no])
348348
@@ -351,11 +351,11 @@ __atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);],
351351
if test $opal_cv_have___atomic = "yes" ; then
352352
AC_MSG_CHECKING([for 64-bit GCC built-in atomics])
353353
354-
AC_TRY_LINK([
354+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
355355
#include <stdint.h>
356356
uint64_t tmp64, old64 = 0;], [
357357
__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
358-
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);],
358+
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);])],
359359
[opal_cv_have___atomic_64=yes],
360360
[opal_cv_have___atomic_64=no])
361361
@@ -1194,14 +1194,14 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
11941194
AS_IF([test "$opal_cv_asm_arch" = "X86_64" || test "$opal_cv_asm_arch" = "IA32"],
11951195
[AC_MSG_CHECKING([for RDTSCP assembly support])
11961196
AC_LANG_PUSH([C])
1197-
AC_TRY_RUN([[
1197+
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
11981198
int main(int argc, char* argv[])
11991199
{
12001200
unsigned int rax, rdx;
12011201
__asm__ __volatile__ ("rdtscp\n": "=a" (rax), "=d" (rdx):: "%rax", "%rdx");
12021202
return 0;
12031203
}
1204-
]],
1204+
]])],
12051205
[result=1
12061206
AC_MSG_RESULT([yes])],
12071207
[AC_MSG_RESULT([no])],

0 commit comments

Comments
 (0)