From b3c4954942873674477c7b498c4a3e4e94f37a1f6728ba83e9ffbc3cff1f6dd3 Mon Sep 17 00:00:00 2001 From: Nicolas Morey Date: Tue, 20 Feb 2024 16:46:06 +0000 Subject: [PATCH] Accepting request 1148143 from home:NMorey:branches:science:HPC - Update to v3.0 GA - Cleanup spec file - standard flavour has been removed and has been replaced by the ucx flavour - Drop 32b arch support - Disable static libraries for non-HPC build - No need to pull ucx nor libfabric-devel for mvapich3-devel - Replace 0001-fix-control-reaches-end-of-non-void-function.patch with upstream: - mpi-coll-missing-return.patch - mpl-warnings-missing-return.patch - Add: - mvapich3-s390_get_cycles.patch for s390 support - pass-correct-size-to-snprintf.patch to fix potential overflows - autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch to fix libfabric sub dependencies being unnecessary pulled - config-replace-AC_TRY_-COMPILE-LINK-RUN.patch to replace osolete autoconf macros OBS-URL: https://build.opensuse.org/request/show/1148143 OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich3?expand=0&rev=4 --- ...rol-reaches-end-of-non-void-function.patch | 28 - _multibuild | 9 +- ...-and-not-static-libs-from-pkg-config.patch | 27 + config-replace-AC_TRY_-COMPILE-LINK-RUN.patch | 2968 +++++++++++++++++ mpi-coll-missing-return.patch | 24 + mpl-warnings-missing-return.patch | 20 + mvapich-3.0.tar.gz | 3 + mvapich-3.0b.tar.gz | 3 - mvapich3-s390_get_cycles.patch | 27 + mvapich3.changes | 20 + mvapich3.spec | 201 +- pass-correct-size-to-snprintf.patch | 261 ++ 12 files changed, 3423 insertions(+), 168 deletions(-) delete mode 100644 0001-fix-control-reaches-end-of-non-void-function.patch create mode 100644 autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch create mode 100644 config-replace-AC_TRY_-COMPILE-LINK-RUN.patch create mode 100644 mpi-coll-missing-return.patch create mode 100644 mpl-warnings-missing-return.patch create mode 100644 mvapich-3.0.tar.gz delete mode 100644 mvapich-3.0b.tar.gz create mode 100644 mvapich3-s390_get_cycles.patch create mode 100644 pass-correct-size-to-snprintf.patch diff --git a/0001-fix-control-reaches-end-of-non-void-function.patch b/0001-fix-control-reaches-end-of-non-void-function.patch deleted file mode 100644 index cdef6fb..0000000 --- a/0001-fix-control-reaches-end-of-non-void-function.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3b99a0cda07e6836f5316e9b1ea2ed4e1d625e0e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= -Date: Sun, 23 Jul 2023 11:24:13 +0200 -Subject: [PATCH] fix: control reaches end of non-void function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Klaus Kämpf ---- - src/mpl/src/sock/mpl_sockaddr.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/mpl/src/sock/mpl_sockaddr.c b/src/mpl/src/sock/mpl_sockaddr.c -index c0e991c..dac43fe 100644 ---- a/src/mpl/src/sock/mpl_sockaddr.c -+++ b/src/mpl/src/sock/mpl_sockaddr.c -@@ -141,6 +141,7 @@ int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr) - } else { - assert(0); - } -+ return 1; - } - - int MPL_get_sockaddr_iface(const char *s_iface, MPL_sockaddr_t * p_addr) --- -2.41.0 - diff --git a/_multibuild b/_multibuild index 5295285..69eb764 100644 --- a/_multibuild +++ b/_multibuild @@ -1,9 +1,8 @@ - standard - testsuite ofi ofi-testsuite - gnu-hpc - gnu-hpc-testsuite - gnu-hpc-ofi-testsuite + ucx + ucx-testsuite + gnu-hpc-ofi + gnu-hpc-ucx diff --git a/autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch b/autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch new file mode 100644 index 0000000..348b718 --- /dev/null +++ b/autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch @@ -0,0 +1,27 @@ +commit ec98a7804ec492d8af7f84472baedb23ec49fb3b +Author: Nicolas Morey-Chaisemartin +Date: Thu Apr 1 10:11:45 2021 +0200 + + autoconf: pull dynamic and not static libs from pkg-config + + Signed-off-by: Nicolas Morey-Chaisemartin + +diff --git confdb/aclocal_libs.m4 confdb/aclocal_libs.m4 +index 77f0ed0ce9c7..8d41939a2458 100644 +--- confdb/aclocal_libs.m4 ++++ confdb/aclocal_libs.m4 +@@ -199,12 +199,12 @@ dnl PAC_LIB_DEPS(library_name, library_pc_path) + dnl library_pc_path is the path to the library pkg-config directory + AC_DEFUN([PAC_LIB_DEPS],[ + if test "x$2" != "x"; then +- ac_lib$1_deps=`pkg-config --static --libs $2/lib$1.pc 2>/dev/null` ++ ac_lib$1_deps=`pkg-config --libs $2/lib$1.pc 2>/dev/null` + # remove the library itself in case it is embedded + ac_lib$1_deps=`echo $ac_lib$1_deps | sed 's/-l$1//'` + else + # use system default +- ac_lib$1_deps=`pkg-config --static --libs lib$1 2>/dev/null` ++ ac_lib$1_deps=`pkg-config --libs lib$1 2>/dev/null` + fi + ]) + diff --git a/config-replace-AC_TRY_-COMPILE-LINK-RUN.patch b/config-replace-AC_TRY_-COMPILE-LINK-RUN.patch new file mode 100644 index 0000000..55d689f --- /dev/null +++ b/config-replace-AC_TRY_-COMPILE-LINK-RUN.patch @@ -0,0 +1,2968 @@ +commit 241a53df04b9914bc897671773c06f522ea79764 +Author: Hui Zhou +Date: Sun Apr 11 14:06:22 2021 -0500 + + config: replace AC_TRY_{COMPILE,LINK,RUN} + + AC_TRY_{COMPILE,LINK,RUN} are obsolete, replace with AC_{COMPILE,LINK,RUN}_IFELSE. + + Format the code for better readability. + +diff --git confdb/aclocal_cc.m4 confdb/aclocal_cc.m4 +index 207f7ca4040e..0637353a248f 100644 +--- confdb/aclocal_cc.m4 ++++ confdb/aclocal_cc.m4 +@@ -154,30 +154,28 @@ dnl Notes: + dnl 'action-if-unknown' is used in the case of cross-compilation. + dnl D*/ + AC_DEFUN([PAC_PROG_C_UNALIGNED_DOUBLES],[ +-AC_CACHE_CHECK([whether C compiler allows unaligned doubles], +-pac_cv_prog_c_unaligned_doubles,[ +-AC_TRY_RUN([ +-void fetch_double( v ) +-double *v; +-{ +-*v = 1.0; +-} +-int main( argc, argv ) +-int argc; +-char **argv; +-{ +-int p[4]; +-double *p_val; +-fetch_double( (double *)&(p[0]) ); +-p_val = (double *)&(p[0]); +-if (*p_val != 1.0) return 1; +-fetch_double( (double *)&(p[1]) ); +-p_val = (double *)&(p[1]); +-if (*p_val != 1.0) return 1; +-return 0; +-} +-],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no", +-pac_cv_prog_c_unaligned_doubles="unknown")]) ++AC_CACHE_CHECK([whether C compiler allows unaligned doubles], pac_cv_prog_c_unaligned_doubles,[ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ void fetch_double(double *v) { ++ *v = 1.0; ++ } ++ int main(int argc, char **argv) { ++ int p[4]; ++ double *p_val; ++ ++ fetch_double( (double *)&(p[0]) ); ++ p_val = (double *)&(p[0]); ++ if (*p_val != 1.0) return 1; ++ ++ fetch_double( (double *)&(p[1]) ); ++ p_val = (double *)&(p[1]); ++ if (*p_val != 1.0) return 1; ++ ++ return 0; ++ } ++ ]])],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no", ++ pac_cv_prog_c_unaligned_doubles="unknown") ++]) + ifelse($1,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "yes" ; then + $1 + fi) +@@ -215,16 +213,17 @@ dnl + dnl D*/ + AC_DEFUN([PAC_PROG_C_WEAK_SYMBOLS],[ + pragma_extra_message="" +-AC_CACHE_CHECK([for type of weak symbol alias support], +-pac_cv_prog_c_weak_symbols,[ ++AC_CACHE_CHECK([for type of weak symbol alias support], pac_cv_prog_c_weak_symbols,[ + # Test for weak symbol support... + # We can't put # in the message because it causes autoconf to generate + # incorrect code +-AC_TRY_LINK([ +-extern int PFoo(int); +-#pragma weak PFoo = Foo +-int Foo(int a) { return a; } +-],[return PFoo(1);],has_pragma_weak=yes) ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ extern int PFoo(int); ++ #pragma weak PFoo = Foo ++ int Foo(int a) { return a; } ++]],[[ ++ return PFoo(1); ++]])],,has_pragma_weak=yes) + # + # Some systems (Linux ia64 and ecc, for example), support weak symbols + # only within a single object file! This tests that case. +@@ -273,19 +272,23 @@ return Foo(0);} + fi + dnl + if test -z "$pac_cv_prog_c_weak_symbols" ; then +- AC_TRY_LINK([ +-extern int PFoo(int); +-#pragma _HP_SECONDARY_DEF Foo PFoo +-int Foo(int a) { return a; } +-],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF") ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ extern int PFoo(int); ++ #pragma _HP_SECONDARY_DEF Foo PFoo ++ int Foo(int a) { return a; } ++ ]],[[ ++ return PFoo(1); ++ ]])],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF") + fi + dnl + if test -z "$pac_cv_prog_c_weak_symbols" ; then +- AC_TRY_LINK([ +-extern int PFoo(int); +-#pragma _CRI duplicate PFoo as Foo +-int Foo(int a) { return a; } +-],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y") ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ extern int PFoo(int); ++ #pragma _CRI duplicate PFoo as Foo ++ int Foo(int a) { return a; } ++ ]],[[ ++ return PFoo(1); ++ ]])],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y") + fi + dnl + if test -z "$pac_cv_prog_c_weak_symbols" ; then +@@ -309,26 +312,27 @@ if test "$pac_cv_prog_c_weak_symbols" != "no" ; then + ;; + esac + fi +-AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed], +-pac_cv_attr_weak,[ +-AC_TRY_COMPILE([int foo(int) __attribute__ ((weak));],[int a;], +-pac_cv_attr_weak=yes,pac_cv_attr_weak=no)]) ++AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed], pac_cv_attr_weak,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int) __attribute__ ((weak));]],[[int a;]])], ++ pac_cv_attr_weak=yes,pac_cv_attr_weak=no) ++]) + # Note that being able to compile with weak_import doesn't mean that + # it works. +-AC_CACHE_CHECK([whether __attribute__ ((weak_import)) allowed], +-pac_cv_attr_weak_import,[ +-AC_TRY_COMPILE([int foo(int) __attribute__ ((weak_import));],[int a;], +-pac_cv_attr_weak_import=yes,pac_cv_attr_weak_import=no)]) ++AC_CACHE_CHECK([whether __attribute__ ((weak_import)) allowed], pac_cv_attr_weak_import,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int) __attribute__ ((weak_import));]],[[int a;]])], ++ pac_cv_attr_weak_import=yes,pac_cv_attr_weak_import=no) ++]) + # Check if the alias option for weak attributes is allowed +-AC_CACHE_CHECK([whether __attribute__((weak,alias(...))) allowed], +-pac_cv_attr_weak_alias,[ +-PAC_PUSH_FLAG([CFLAGS]) +-# force an error exit if the weak attribute isn't understood +-CFLAGS=-Werror +-AC_TRY_COMPILE([int __foo(int a){return 0;} int foo(int) __attribute__((weak,alias("__foo")));],[int a;], +-pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no) +-# Restore original CFLAGS +-PAC_POP_FLAG([CFLAGS])]) ++AC_CACHE_CHECK([whether __attribute__((weak,alias(...))) allowed], pac_cv_attr_weak_alias,[ ++ PAC_PUSH_FLAG([CFLAGS]) ++ # force an error exit if the weak attribute isn't understood ++ CFLAGS=-Werror ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int __foo(int a){return 0;} int foo(int) __attribute__((weak,alias("__foo")));]],[[int a;]])], ++ pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no) ++ # Restore original CFLAGS ++ PAC_POP_FLAG([CFLAGS]) ++]) ++ + if test "$pac_cv_attr_weak_alias" = "yes" ; then + AC_DEFINE(HAVE_WEAK_ATTRIBUTE,1,[Attribute style weak pragma]) + fi +@@ -353,7 +357,7 @@ AC_DEFUN([PAC_PROG_CC_WORKS], + AC_MSG_CHECKING([whether the C compiler sets its return status correctly]) + AC_LANG_SAVE + AC_LANG_C +-AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes) ++AC_COMPILE_IFELSE([AC_LANG_SOURCE([],[[int a = bzzzt;]])],notbroken=no,notbroken=yes) + AC_MSG_RESULT($notbroken) + if test "$notbroken" = "no" ; then + AC_MSG_ERROR([installation or configuration problem: C compiler does not +@@ -371,30 +375,23 @@ dnl + dnl + dnl D*/ + AC_DEFUN([PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS],[ +-AC_CACHE_CHECK([for multiple weak symbol support], +-pac_cv_prog_c_multiple_weak_symbols,[ +-# Test for multiple weak symbol support... +-PAC_COMPLINK_IFELSE([ +- AC_LANG_SOURCE([ +-extern int PFoo(int); +-extern int PFoo_(int); +-extern int pfoo_(int); +-#pragma weak PFoo = Foo +-#pragma weak PFoo_ = Foo +-#pragma weak pfoo_ = Foo +-int Foo(int); +-int Foo(a) { return a; } +- ]) +-],[ +- AC_LANG_SOURCE([ +-extern int PFoo(int), PFoo_(int), pfoo_(int); +-int main() { +-return PFoo(0) + PFoo_(1) + pfoo_(2);} +- ]) +-],[ +- pac_cv_prog_c_multiple_weak_symbols="yes" +-]) +-dnl ++AC_CACHE_CHECK([for multiple weak symbol support], pac_cv_prog_c_multiple_weak_symbols,[ ++ # Test for multiple weak symbol support... ++ PAC_COMPLINK_IFELSE([AC_LANG_SOURCE([[ ++ extern int PFoo(int); ++ extern int PFoo_(int); ++ extern int pfoo_(int); ++ #pragma weak PFoo = Foo ++ #pragma weak PFoo_ = Foo ++ #pragma weak pfoo_ = Foo ++ int Foo(int); ++ int Foo(a) { return a; } ++ ]])],[AC_LANG_SOURCE([[ ++ extern int PFoo(int), PFoo_(int), pfoo_(int); ++ int main() { ++ return PFoo(0) + PFoo_(1) + pfoo_(2);} ++ ]])], ++ [pac_cv_prog_c_multiple_weak_symbols="yes"]) + ]) + if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" ; then + ifelse([$1],,:,[$1]) +@@ -667,7 +664,7 @@ dnl return is possible. + AC_DEFUN([PAC_C_MAX_INTEGER_ALIGN],[ + AC_CACHE_CHECK([for max C struct integer alignment], + pac_cv_c_max_integer_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -689,7 +686,7 @@ int main( int argc, char *argv[] ) + int size, extent, extent2; + + /* assume max integer alignment isn't 8 if we don't have +- * an eight-byte value :) ++ * an eight-byte value + */ + #ifdef HAVE_LONG_LONG_INT + if (sizeof(int) < 8 && sizeof(long) < 8 && sizeof(long long int) < 8) +@@ -772,7 +769,7 @@ int main( int argc, char *argv[] ) + } + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_max_integer_align=`cat ctest.out`, + pac_cv_c_max_integer_align="unknown", + pac_cv_c_max_integer_align="$CROSS_ALIGN_STRUCT_INT") +@@ -798,7 +795,7 @@ dnl return is possible. + AC_DEFUN([PAC_C_MAX_FP_ALIGN],[ + AC_CACHE_CHECK([for max C struct floating point alignment], + pac_cv_c_max_fp_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -887,7 +884,7 @@ int main( int argc, char *argv[] ) + } + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_max_fp_align=`cat ctest.out`, + pac_cv_c_max_fp_align="unknown", + pac_cv_c_max_fp_align="$CROSS_ALIGN_STRUCT_FP") +@@ -912,7 +909,7 @@ dnl return is possible. + AC_DEFUN([PAC_C_MAX_DOUBLE_FP_ALIGN],[ + AC_CACHE_CHECK([for max C struct alignment of structs with doubles], + pac_cv_c_max_double_fp_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -970,10 +967,10 @@ int main( int argc, char *argv[] ) + } + fclose( cf ); + return 0; +-}], +-pac_cv_c_max_double_fp_align=`cat ctest.out`, +-pac_cv_c_max_double_fp_align="unknown", +-pac_cv_c_max_double_fp_align="$CROSS_ALIGN_STRUCT_DOUBLE_FP") ++}]])], ++ pac_cv_c_max_double_fp_align=`cat ctest.out`, ++ pac_cv_c_max_double_fp_align="unknown", ++ pac_cv_c_max_double_fp_align="$CROSS_ALIGN_STRUCT_DOUBLE_FP") + rm -f ctest.out + ]) + if test -z "$pac_cv_c_max_double_fp_align" ; then +@@ -983,7 +980,7 @@ fi + AC_DEFUN([PAC_C_MAX_LONGDOUBLE_FP_ALIGN],[ + AC_CACHE_CHECK([for max C struct floating point alignment with long doubles], + pac_cv_c_max_longdouble_fp_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -1042,7 +1039,7 @@ int main( int argc, char *argv[] ) + } + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_max_longdouble_fp_align=`cat ctest.out`, + pac_cv_c_max_longdouble_fp_align="unknown", + pac_cv_c_max_longdouble_fp_align="$CROSS_ALIGN_STRUCT_LONGDOUBLE_FP") +@@ -1070,7 +1067,7 @@ dnl + AC_DEFUN([PAC_C_DOUBLE_ALIGNMENT_EXCEPTION],[ + AC_CACHE_CHECK([if double alignment breaks rules, find actual alignment], + pac_cv_c_double_alignment_exception,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -1100,7 +1097,7 @@ int main( int argc, char *argv[] ) + + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_double_alignment_exception=`cat ctest.out`, + pac_cv_c_double_alignment_exception="unknown", + pac_cv_c_double_alignment_exception="$CROSS_ALIGN_DOUBLE_EXCEPTION") +@@ -1122,7 +1119,7 @@ dnl + AC_DEFUN([PAC_C_DOUBLE_POS_ALIGN],[ + AC_CACHE_CHECK([if alignment of structs with doubles is based on position], + pac_cv_c_double_pos_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -1143,7 +1140,7 @@ int main( int argc, char *argv[] ) + + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_double_pos_align=`cat ctest.out`, + pac_cv_c_double_pos_align="unknown", + pac_cv_c_double_pos_align="$CROSS_ALIGN_DOUBLE_POS") +@@ -1165,7 +1162,7 @@ dnl + AC_DEFUN([PAC_C_LLINT_POS_ALIGN],[ + AC_CACHE_CHECK([if alignment of structs with long long ints is based on position], + pac_cv_c_llint_pos_align,[ +-AC_TRY_RUN([ ++AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #define DBG(a,b,c) + int main( int argc, char *argv[] ) +@@ -1188,7 +1185,7 @@ int main( int argc, char *argv[] ) + + fclose( cf ); + return 0; +-}], ++}]])], + pac_cv_c_llint_pos_align=`cat ctest.out`, + pac_cv_c_llint_pos_align="unknown", + pac_cv_c_llint_pos_align="$CROSS_ALIGN_LLINT_POS") +@@ -1221,11 +1218,11 @@ dnl compilers (notably clang-3.2) only produce a warning in this case. + dnl + dnl D*/ + AC_DEFUN([PAC_FUNC_NEEDS_DECL],[ +-AC_CACHE_CHECK([whether $2 needs a declaration], +-pac_cv_func_decl_$2,[ +-AC_TRY_COMPILE([$1 +-void (*fptr)(void) = (void(*)(void))$2;],[], +-pac_cv_func_decl_$2=no,pac_cv_func_decl_$2=yes)]) ++AC_CACHE_CHECK([whether $2 needs a declaration], pac_cv_func_decl_$2,[ ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$1 ++ void (*fptr)(void) = (void(*)(void))$2;], ++ [])], pac_cv_func_decl_$2=no,pac_cv_func_decl_$2=yes) ++]) + if test "$pac_cv_func_decl_$2" = "yes" ; then + changequote(<<,>>)dnl + define(<>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnl +@@ -1251,14 +1248,14 @@ dnl + AC_DEFUN([PAC_C_GNU_ATTRIBUTE],[ + AC_REQUIRE([AC_PROG_CC_GNU]) + if test "$ac_cv_prog_gcc" = "yes" ; then +- AC_CACHE_CHECK([whether __attribute__ allowed], +-pac_cv_gnu_attr_pure,[ +-AC_TRY_COMPILE([int foo(int) __attribute__ ((pure));],[int a;], +-pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no)]) +-AC_CACHE_CHECK([whether __attribute__((format)) allowed], +-pac_cv_gnu_attr_format,[ +-AC_TRY_COMPILE([int foo(char *,...) __attribute__ ((format(printf,1,2)));],[int a;], +-pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)]) ++ AC_CACHE_CHECK([whether __attribute__ allowed], pac_cv_gnu_attr_pure,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int) __attribute__ ((pure));]],[[int a;]])], ++ pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no) ++ ]) ++ AC_CACHE_CHECK([whether __attribute__((format)) allowed], pac_cv_gnu_attr_format,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(char *,...) __attribute__ ((format(printf,1,2)));]],[[int a;]])], ++ pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no) ++ ]) + if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE,1,[Define if GNU __attribute__ is supported]) + fi +@@ -1277,117 +1274,105 @@ fi + # HAVE__FUNCTION__ (if __FUNCTION__ defined) + # + AC_DEFUN([PAC_CC_FUNCTION_NAME_SYMBOL],[ +-AC_CACHE_CHECK([whether the compiler defines __func__], +-pac_cv_have__func__,[ +-tmp_am_cross=no +-AC_RUN_IFELSE([ +-AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__func__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +-]) +-], pac_cv_have__func__=yes, pac_cv_have__func__=no,tmp_am_cross=yes) +-if test "$tmp_am_cross" = yes ; then +- AC_LINK_IFELSE([ +- AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__func__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +- ]) +-], pac_cv_have__func__=yes, pac_cv_have__func__=no) +-fi ++AC_CACHE_CHECK([whether the compiler defines __func__], pac_cv_have__func__,[ ++ tmp_am_cross=no ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__func__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have__func__=yes, pac_cv_have__func__=no,tmp_am_cross=yes) ++ ++ if test "$tmp_am_cross" = yes ; then ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__func__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have__func__=yes, pac_cv_have__func__=no) ++ fi + ]) + + if test "$pac_cv_have__func__" = "yes" ; then + AC_DEFINE(HAVE__FUNC__,,[define if the compiler defines __func__]) + fi + +-AC_CACHE_CHECK([whether the compiler defines __FUNC__], +-pac_cv_have_cap__func__,[ +-tmp_am_cross=no +-AC_RUN_IFELSE([ +-AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__FUNC__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +-]) +-], pac_cv_have_cap__func__=yes, pac_cv_have_cap__func__=no,tmp_am_cross=yes) +-if test "$tmp_am_cross" = yes ; then +- AC_LINK_IFELSE([ +- AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__FUNC__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +- ]) +-], pac_cv_have__func__=yes, pac_cv_have__func__=no) +-fi ++AC_CACHE_CHECK([whether the compiler defines __FUNC__], pac_cv_have_cap__func__,[ ++ tmp_am_cross=no ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__FUNC__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have_cap__func__=yes, pac_cv_have_cap__func__=no,tmp_am_cross=yes) ++ ++ if test "$tmp_am_cross" = yes ; then ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__FUNC__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have__func__=yes, pac_cv_have__func__=no) ++ fi + ]) + + if test "$pac_cv_have_cap__func__" = "yes" ; then + AC_DEFINE(HAVE_CAP__FUNC__,,[define if the compiler defines __FUNC__]) + fi + +-AC_CACHE_CHECK([whether the compiler sets __FUNCTION__], +-pac_cv_have__function__,[ +-tmp_am_cross=no +-AC_RUN_IFELSE([ +-AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__FUNCTION__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +-]) +-], pac_cv_have__function__=yes, pac_cv_have__function__=no,tmp_am_cross=yes) +-if test "$tmp_am_cross" = yes ; then +- AC_LINK_IFELSE([ +- AC_LANG_SOURCE([ +-#include +-int foo(void); +-int foo(void) +-{ +- return (strcmp(__FUNCTION__, "foo") == 0); +-} +-int main(int argc, char ** argv) +-{ +- return (foo() ? 0 : 1); +-} +- ]) +-], pac_cv_have__func__=yes, pac_cv_have__func__=no) +-fi ++AC_CACHE_CHECK([whether the compiler sets __FUNCTION__], pac_cv_have__function__,[ ++ tmp_am_cross=no ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__FUNCTION__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have__function__=yes, pac_cv_have__function__=no,tmp_am_cross=yes) ++ ++ if test "$tmp_am_cross" = yes ; then ++ AC_LINK_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int foo(void); ++ int foo(void) ++ { ++ return (strcmp(__FUNCTION__, "foo") == 0); ++ } ++ int main(int argc, char ** argv) ++ { ++ return (foo() ? 0 : 1); ++ } ++ ]])], pac_cv_have__func__=yes, pac_cv_have__func__=no) ++ fi + ]) + + if test "$pac_cv_have__function__" = "yes" ; then +@@ -1407,7 +1392,7 @@ AC_DEFUN([PAC_STRUCT_ALIGNMENT],[ + is_largest=1 + + # See if long double exists +- AC_TRY_COMPILE(,[long double a;],have_long_double=yes,have_long_double=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[long double a;]])],have_long_double=yes,have_long_double=no) + + # Get sizes of regular types + AC_CHECK_SIZEOF(char) +@@ -1582,9 +1567,9 @@ AC_DEFUN([PAC_C_MACRO_VA_ARGS],[ + AC_DEFUN([PAC_C_BUILTIN_EXPECT],[ + AC_MSG_CHECKING([if C compiler supports __builtin_expect]) + +-AC_TRY_LINK(, [ ++AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[ + return __builtin_expect(1, 1) ? 1 : 0 +-], [ ++]])], [ + have_builtin_expect=yes + AC_MSG_RESULT([yes]) + ], [ +@@ -1623,18 +1608,19 @@ dnl will AC_DEFINE([TLS]) to a compiler supported TLS keyword + dnl + AC_DEFUN([PAC_CC_CHECK_TLS], [ + AC_CACHE_CHECK([for thread local storage], [pac_cv_tls], [ +- if test -z $pac_cv_tls ; then +- AC_LINK_IFELSE([AC_LANG_PROGRAM([_Thread_local int foo=0;],[foo=1])], +- [pac_cv_tls=_Thread_local]) +- fi +- if test -z $pac_cv_tls ; then +- AC_LINK_IFELSE( [AC_LANG_PROGRAM([__thread int foo=0;],[foo=1])], +- [pac_cv_tls=__thread]) +- fi +- if test -z $pac_cv_tls ; then +- AC_LINK_IFELSE( [AC_LANG_PROGRAM([__declspec(thread) int foo=0;],[foo=1])], +- [pac_cv_tls="__declspec(thread)"]) +- fi]) ++ if test -z $pac_cv_tls ; then ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([_Thread_local int foo=0;],[foo=1])], ++ [pac_cv_tls=_Thread_local]) ++ fi ++ if test -z $pac_cv_tls ; then ++ AC_LINK_IFELSE( [AC_LANG_PROGRAM([__thread int foo=0;],[foo=1])], ++ [pac_cv_tls=__thread]) ++ fi ++ if test -z $pac_cv_tls ; then ++ AC_LINK_IFELSE( [AC_LANG_PROGRAM([__declspec(thread) int foo=0;],[foo=1])], ++ [pac_cv_tls="__declspec(thread)"]) ++ fi ++ ]) + if test -z $pac_cv_tls ; then + AC_MSG_WARN([Compiler does not support thread local storage]) + else +@@ -1646,19 +1632,18 @@ dnl Test whether pointers can be aligned on a int boundary or require + dnl a pointer boundary. + AC_DEFUN([PAC_CHECK_PTR_ALIGN]), [ + AC_MSG_CHECKING([for alignment restrictions on pointers]) +- AC_TRY_RUN( +- changequote(<<,>>) +- struct foo { int a; void *b; }; +- int main() { +- int buf[10]; +- struct foo *p1; +- p1=(struct foo*)&buf[0]; +- p1->b = (void *)0; +- p1=(struct foo*)&buf[1]; +- p1->b = (void *)0; +- return 0; +- changequote([,]) +- },pac_cv_pointers_have_int_alignment=yes,pac_cv_pointers_have_int_alignment=no,pac_cv_pointers_have_int_alignment=unknown) ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ struct foo { int a; void *b; }; ++ int main() { ++ int buf[10]; ++ struct foo *p1; ++ p1=(struct foo*)&buf[0]; ++ p1->b = (void *)0; ++ p1=(struct foo*)&buf[1]; ++ p1->b = (void *)0; ++ return 0; ++ } ++ ]])],pac_cv_pointers_have_int_alignment=yes,pac_cv_pointers_have_int_alignment=no,pac_cv_pointers_have_int_alignment=unknown) + + if test "$pac_cv_pointers_have_int_alignment" != "yes" ; then + AC_DEFINE(NEEDS_POINTER_ALIGNMENT_ADJUST,1,[define if pointers must be aligned on pointer boundaries]) +diff --git confdb/aclocal_cxx.m4 confdb/aclocal_cxx.m4 +index 6c902af2c531..36ac86a6ef9e 100644 +--- confdb/aclocal_cxx.m4 ++++ confdb/aclocal_cxx.m4 +@@ -6,12 +6,12 @@ AC_DEFUN([AX_CXX_BOOL], + ac_cv_cxx_bool, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS +- AC_TRY_COMPILE([ +-int f(int x){return 1;} +-int f(char x){return 1;} +-int f(bool x){return 1;} +-],[bool b = true; return f(b);], +- ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ int f(int x){return 1;} ++ int f(char x){return 1;} ++ int f(bool x){return 1;} ++ ]],[[bool b = true; return f(b);]])], ++ ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) + AC_LANG_RESTORE + ]) + if test "$ac_cv_cxx_bool" != yes; then +@@ -26,8 +26,8 @@ AC_DEFUN([AX_CXX_EXCEPTIONS], + ac_cv_cxx_exceptions, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS +- AC_TRY_COMPILE(,[try { throw 1; } catch (int i) { return i; }], +- ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[try { throw 1; } catch (int i) { return i; }]])], ++ ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no) + AC_LANG_RESTORE + ]) + if test "$ac_cv_cxx_exceptions" = yes; then +@@ -42,9 +42,12 @@ AC_DEFUN([AX_CXX_NAMESPACES], + ac_cv_cxx_namespaces, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS +- AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], +- [using namespace Outer::Inner; return i;], +- ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ namespace Outer { namespace Inner { int i = 0; }} ++ ]],[[ ++ using namespace Outer::Inner; return i; ++ ]])], ++ ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE + ]) + if test "$ac_cv_cxx_namespaces" = yes; then +@@ -62,11 +65,13 @@ ac_cv_cxx_namespace_std, + if test "$ac_cv_cxx_namespaces" = yes ; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +- AC_TRY_COMPILE([ +-#include +-using namespace std;], +- [cout << "message\n";], +- ac_cv_cxx_namespace_std=yes, ac_cv_cxx_namespace_std=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ using namespace std; ++ ]],[[ ++ cout << "message\n"; ++ ]])], ++ ac_cv_cxx_namespace_std=yes, ac_cv_cxx_namespace_std=no) + AC_LANG_RESTORE + fi + ]) +diff --git confdb/aclocal_f77.m4 confdb/aclocal_f77.m4 +index f44151074604..fe4ed696e255 100644 +--- confdb/aclocal_f77.m4 ++++ confdb/aclocal_f77.m4 +@@ -387,7 +387,7 @@ dnl Check whether '!' may be used to begin comments in Fortran. + dnl + dnl This macro requires a version of autoconf `after` 2.13; the 'acgeneral.m4' + dnl file contains an error in the handling of Fortran programs in +-dnl 'AC_TRY_COMPILE' (fixed in our local version). ++dnl 'AC_COMPILE_IFELSE' (fixed in our local version). + dnl + dnl D*/ + AC_DEFUN([PAC_PROG_F77_EXCLAIM_COMMENTS],[ +diff --git confdb/ax_check_posix_regcomp.m4 confdb/ax_check_posix_regcomp.m4 +index e5ba61ce2d92..e2090e75344f 100644 +--- confdb/ax_check_posix_regcomp.m4 ++++ confdb/ax_check_posix_regcomp.m4 +@@ -27,18 +27,18 @@ AU_ALIAS([AG_CHECK_POSIX_REGCOMP], [AX_CHECK_POSIX_REGCOMP]) + AC_DEFUN([AX_CHECK_POSIX_REGCOMP],[ + AC_MSG_CHECKING([whether POSIX compliant regcomp()/regexec()]) + AC_CACHE_VAL([ax_cv_posix_regcomp],[ +- AC_TRY_RUN([ +-#include +-#include +-int main() { +- int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE; +- regex_t re; +- if (regcomp( &re, "^.*$", flags ) != 0) +- return 1; +- return regcomp( &re, "yes.*|no.*", flags ); +-}], +- [ax_cv_posix_regcomp=yes],[ax_cv_posix_regcomp=no],[ax_cv_posix_regcomp=no] +- ) # end of TRY_RUN]) # end of CACHE_VAL ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #include ++ int main() { ++ int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE; ++ regex_t re; ++ if (regcomp( &re, "^.*$", flags ) != 0) ++ return 1; ++ return regcomp( &re, "yes.*|no.*", flags ); ++ } ++ ]])], [ax_cv_posix_regcomp=yes],[ax_cv_posix_regcomp=no],[ax_cv_posix_regcomp=no]) ++ ]) + + AC_MSG_RESULT([$ax_cv_posix_regcomp]) + if test "$ax_cv_posix_regcomp" = "yes"; then +diff --git configure.ac configure.ac +index 4669608bbbf2..51ddb3952c4b 100644 +--- configure.ac ++++ configure.ac +@@ -2761,14 +2761,15 @@ if test "$enable_cxx" = "yes" ; then + AC_CACHE_CHECK([whether the C++ compiler $CXX can build an executable], + pac_cv_cxx_builds_exe,[ + AC_LANG_PUSH([C++]) +- AC_TRY_LINK([ +-class mytest { +- int a; +-public: +- mytest(void) : a(1) {} +- ~mytest(void) {} +-};],[mytest a;], +- pac_cv_cxx_builds_exe=yes, pac_cv_cxx_builds_exe=no) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ class mytest { ++ int a; ++ public: ++ mytest(void) : a(1) {} ++ ~mytest(void) {} ++ }; ++ ]],[[mytest a;]])], ++ pac_cv_cxx_builds_exe=yes, pac_cv_cxx_builds_exe=no) + AC_LANG_POP([C++]) + ]) + if test "$pac_cv_cxx_builds_exe" != yes ; then +@@ -2778,7 +2779,8 @@ public: + # The Intel icpc 10.x compiler fails with if gcc 4.2 is installed. + AC_CACHE_CHECK([whether C++ compiler works with string],pac_cv_cxx_compiles_string,[ + AC_LANG_PUSH([C++]) +- AC_TRY_COMPILE([#include ],[return 0;],pac_cv_cxx_compiles_string=yes,pac_cv_cxx_compiles_string=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[return 0;]])], ++ pac_cv_cxx_compiles_string=yes,pac_cv_cxx_compiles_string=no) + AC_LANG_POP([C++]) + ]) + if test "$pac_cv_cxx_compiles_string" != yes ; then +@@ -2799,15 +2801,13 @@ public: + fi + # iostream and math are needed for examples/cxx/cxxpi.cxx + AC_CACHE_CHECK([whether available],pac_cv_cxx_has_iostream,[ +- AC_TRY_COMPILE([ +-#include +-],[using namespace std;],pac_cv_cxx_has_iostream=yes,pac_cv_cxx_has_iostream=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[using namespace std;]])], ++ pac_cv_cxx_has_iostream=yes,pac_cv_cxx_has_iostream=no)]) + AX_CXX_NAMESPACE_STD + + AC_CACHE_CHECK([whether available],pac_cv_cxx_has_math,[ +- AC_TRY_COMPILE([ +-#include +-],[using namespace std;],pac_cv_cxx_has_math=yes,pac_cv_cxx_has_math=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[using namespace std;]])], ++ pac_cv_cxx_has_math=yes,pac_cv_cxx_has_math=no)]) + + # GNU changed the calling conventions between minor releases (!!!) + # This is too hard to detect, but we should be able to detect +@@ -2832,20 +2832,21 @@ public: + "$GNUCXX_VERSION" = 0 -a "$GNUCXX_MINORVERSION" = 0 ; then + ac_vals="" + AC_MSG_CHECKING([for GNU g++ version]) +- AC_TRY_RUN([#include +-int main() { +- int v = -1, m = -1; +- FILE *fp = fopen("conftest.out","w"); +-#ifdef __GNUC_MINOR__ +- m = __GNUC_MINOR__; +-#endif +-#ifdef __GNUC__ +- v = __GNUC__; +-#endif +- fprintf( fp, "v=%d, m=%d\n", v, m ); +- fclose( fp ); +- return 0; +-}],ac_vals=`cat conftest.out`) ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ int main() { ++ int v = -1, m = -1; ++ FILE *fp = fopen("conftest.out","w"); ++ #ifdef __GNUC_MINOR__ ++ m = __GNUC_MINOR__; ++ #endif ++ #ifdef __GNUC__ ++ v = __GNUC__; ++ #endif ++ fprintf( fp, "v=%d, m=%d\n", v, m ); ++ fclose( fp ); ++ return 0; ++ }]])],ac_vals=`cat conftest.out`) + if test -n "$ac_vals" ; then + v=`echo "$ac_vals" | sed -e 's/v=\(.*\),.*/\1/'` + m=`echo "$ac_vals" | sed -e 's/.*m=\(.*\)/\1/'` +@@ -3189,15 +3190,15 @@ You may need to specify an additional argument to your C compiler to + force it to allow unaligned accesses.)]) + fi + # Check for __func__ (defined in C99) or __FUNCTION__ (defined in older GCC) +-AC_CACHE_CHECK([whether $CC supports __func__],pac_cv_cc_has___func__, +-[AC_TRY_COMPILE([], +- [const char *cp = __func__; ],pac_cv_cc_has___func__=yes, +-pac_cv_cc_has___func__=no)]) ++AC_CACHE_CHECK([whether $CC supports __func__],pac_cv_cc_has___func__, [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *cp = __func__;]])], ++ pac_cv_cc_has___func__=yes, pac_cv_cc_has___func__=no) ++]) + if test "$pac_cv_cc_has___func__" != "yes" ; then +- AC_CACHE_CHECK([whether $CC supports __FUNCTION__],pac_cv_cc_has___FUNCTION__, +-[AC_TRY_COMPILE([], +- [const char *cp = __FUNCTION__;],pac_cv_cc_has___FUNCTION__=yes, +-pac_cv_cc_has___FUNCTION__=no)]) ++ AC_CACHE_CHECK([whether $CC supports __FUNCTION__],pac_cv_cc_has___FUNCTION__,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *cp = __FUNCTION__;]])], ++ pac_cv_cc_has___FUNCTION__=yes, pac_cv_cc_has___FUNCTION__=no) ++ ]) + fi + + # ---------------------------------------------------------------------------- +@@ -3209,8 +3210,8 @@ fi + if test "$MPID_NO_LONG_DOUBLE" != "yes" && test "X$enable_long_double" != "Xno" ; then + AC_CACHE_CHECK([whether long double is supported], + pac_cv_have_long_double,[ +- AC_TRY_COMPILE(,[long double a;], +- pac_cv_have_long_double=yes,pac_cv_have_long_double=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[long double a;]])], ++ pac_cv_have_long_double=yes,pac_cv_have_long_double=no)]) + if test "$pac_cv_have_long_double" = "yes" ; then + AC_DEFINE(HAVE_LONG_DOUBLE,1,[Define if long double is supported]) + fi +@@ -3218,8 +3219,8 @@ fi + if test "$MPID_NO_LONG_LONG" != "yes" ; then + AC_CACHE_CHECK([whether long long is supported], + pac_cv_have_long_long,[ +- AC_TRY_COMPILE(,[long long a;], +- pac_cv_have_long_long=yes,pac_cv_have_long_long=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[long long a;]])], ++ pac_cv_have_long_long=yes,pac_cv_have_long_long=no)]) + if test "$pac_cv_have_long_long" = "yes" ; then + AC_DEFINE(HAVE_LONG_LONG_INT,1,[Define if long long is supported]) + fi +@@ -4736,13 +4737,15 @@ AC_SUBST([MPI_F77_CXX_LONG_DOUBLE_COMPLEX]) + # therefore, they must be also be activated/deavtivated there + PAC_PUSH_FLAG([CFLAGS]) + PAC_C_CHECK_COMPILER_OPTION([-Werror],[CFLAGS="$CFLAGS -Werror"]) +-AC_TRY_COMPILE([ +-typedef int TEST_Datatype; +-#define TEST_INT ((TEST_Datatype)0x44) +-static const TEST_Datatype test_int __attribute__((type_tag_for_datatype(TEST,int))) = TEST_INT; +-void test(const void* buffer, TEST_Datatype datatype)__attribute__((pointer_with_type_tag(TEST,1,2)));],[ +-const int buf[10]; +-test(buf, TEST_INT);],ac_attr_support=yes, ac_attr_support=no) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ typedef int TEST_Datatype; ++ #define TEST_INT ((TEST_Datatype)0x44) ++ static const TEST_Datatype test_int __attribute__((type_tag_for_datatype(TEST,int))) = TEST_INT; ++ void test(const void* buffer, TEST_Datatype datatype)__attribute__((pointer_with_type_tag(TEST,1,2))); ++ ]],[[ ++ const int buf[10]; ++ test(buf, TEST_INT); ++ ]])],ac_attr_support=yes, ac_attr_support=no) + if test "$ac_attr_support" = yes + then + DISABLE_TAG_SUPPORT="#undef NO_TAGS_WITH_MODIFIERS" +@@ -4770,29 +4773,29 @@ if test "$ac_cv_c_int64_t" != "no" -o -n "$INT64_T" ; then + fi + # We use the type that we're going use for int64. + AC_CACHE_CHECK([for alignment restrictions on $INT64_T],pac_cv_int64_t_alignment,[ +- AC_TRY_RUN([ +-#include +-#include +-int main(int argc, char **argv ) +-{ +- $INT64_T *p1, v; +- char *buf_p = (char *)malloc( 64 ), *bp; +- bp = buf_p; +- /* Make bp aligned on 4, not 8 bytes */ +- if (!( (long)bp & 0x7 ) ) bp += 4; +- p1 = ($INT64_T *)bp; +- v = -1; +- *p1 = v; +- if (!( (long)bp & 0x3 ) ) bp += 2; +- p1 = ($INT64_T *)bp; +- *p1 = 1; +- if (!( (long)bp & 0x1 ) ) bp += 1; +- p1 = ($INT64_T *)bp; +- *p1 = 1; +- return 0; +-} +-],pac_cv_int64_t_alignment=no,pac_cv_int64_t_alignment=yes,pac_cv_int64_t_alignment=$default_int64_t_alignment) +-]) ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #include ++ int main(int argc, char **argv ) ++ { ++ $INT64_T *p1, v; ++ char *buf_p = (char *)malloc( 64 ), *bp; ++ bp = buf_p; ++ /* Make bp aligned on 4, not 8 bytes */ ++ if (!( (long)bp & 0x7 ) ) bp += 4; ++ p1 = ($INT64_T *)bp; ++ v = -1; ++ *p1 = v; ++ if (!( (long)bp & 0x3 ) ) bp += 2; ++ p1 = ($INT64_T *)bp; ++ *p1 = 1; ++ if (!( (long)bp & 0x1 ) ) bp += 1; ++ p1 = ($INT64_T *)bp; ++ *p1 = 1; ++ return 0; ++ } ++ ]])],pac_cv_int64_t_alignment=no,pac_cv_int64_t_alignment=yes,pac_cv_int64_t_alignment=$default_int64_t_alignment) ++ ]) + if test "$pac_cv_int64_t_alignment" = "no" ; then + AC_DEFINE(HAVE_ANY_INT64_T_ALIGNMENT,1,[Define if int64_t works with any alignment]) + fi +@@ -4809,29 +4812,29 @@ if test "$ac_cv_int32_t" != "no" ; then + fi + + AC_CACHE_CHECK([for alignment restrictions on int32_t],pac_cv_int32_t_alignment,[ +- AC_TRY_RUN([ +-#include +-#include +-int main(int argc, char **argv ) +-{ +- $INT32_T *p1, v; +- char *buf_p = (char *)malloc( 64 ), *bp; +- bp = buf_p; +- /* Make bp aligned on 4, not 8 bytes */ +- if (!( (long)bp & 0x7 ) ) bp += 4; +- p1 = ($INT32_T *)bp; +- v = -1; +- *p1 = v; +- if (!( (long)bp & 0x3 ) ) bp += 2; +- p1 = ($INT32_T *)bp; +- *p1 = 1; +- if (!( (long)bp & 0x1 ) ) bp += 1; +- p1 = ($INT32_T *)bp; +- *p1 = 1; +- return 0; +-} +-],pac_cv_int32_t_alignment=no,pac_cv_int32_t_alignment=yes,pac_cv_int32_t_alignment=$default_int32_t_alignment) +-]) ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #include ++ int main(int argc, char **argv ) ++ { ++ $INT32_T *p1, v; ++ char *buf_p = (char *)malloc( 64 ), *bp; ++ bp = buf_p; ++ /* Make bp aligned on 4, not 8 bytes */ ++ if (!( (long)bp & 0x7 ) ) bp += 4; ++ p1 = ($INT32_T *)bp; ++ v = -1; ++ *p1 = v; ++ if (!( (long)bp & 0x3 ) ) bp += 2; ++ p1 = ($INT32_T *)bp; ++ *p1 = 1; ++ if (!( (long)bp & 0x1 ) ) bp += 1; ++ p1 = ($INT32_T *)bp; ++ *p1 = 1; ++ return 0; ++ } ++ ]])],pac_cv_int32_t_alignment=no,pac_cv_int32_t_alignment=yes,pac_cv_int32_t_alignment=$default_int32_t_alignment) ++ ]) + if test "$pac_cv_int32_t_alignment" = "no" ; then + AC_DEFINE(HAVE_ANY_INT32_T_ALIGNMENT,1,[Define if int32_t works with any alignment]) + fi +@@ -4851,10 +4854,13 @@ AC_HEADER_STDC + # stddef.h is sometimes needed for types like wchar_t + AC_CHECK_HEADERS(stdlib.h stdarg.h sys/types.h string.h inttypes.h limits.h stddef.h errno.h sys/socket.h sys/time.h unistd.h endian.h assert.h sys/param.h) + AC_CACHE_CHECK([for sys/uio.h],ac_cv_header_sys_uio_h,[ +-AC_TRY_COMPILE([ +-#include +-#include +-],[int a;],ac_cv_header_sys_uio_h=yes,ac_cv_header_sys_uio_h=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[ ++ int a; ++ ]])],ac_cv_header_sys_uio_h=yes,ac_cv_header_sys_uio_h=no) ++]) + if test "$ac_cv_header_sys_uio_h" = yes ; then + AC_DEFINE(HAVE_SYS_UIO_H,1,[Define if you have the header file.]) + fi +@@ -4895,31 +4901,33 @@ AC_CHECK_FUNCS([qsort]) + # debugging routine. We may want to withdraw this (saving the + # test in confdb/aclocal_cc.m4). + AC_CACHE_CHECK([for va_copy],pac_cv_func_va_copy,[ +-AC_TRY_LINK([ +-#include +-void foo1( char *fmt, ... ) { +- va_list ap, list; +- va_start(ap,fmt); +- va_copy(list,ap); +- va_end(list); +- va_end(ap); +-} +-],[foo1("a test %d", 3);],pac_cv_func_va_copy=yes,pac_cv_func_va_copy=no)]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ void foo1( char *fmt, ... ) { ++ va_list ap, list; ++ va_start(ap,fmt); ++ va_copy(list,ap); ++ va_end(list); ++ va_end(ap); ++ } ++ ]],[[foo1("a test %d", 3);]])],pac_cv_func_va_copy=yes,pac_cv_func_va_copy=no) ++]) + + if test "$pac_cv_func_va_copy" = "yes" ; then + AC_DEFINE(HAVE_VA_COPY,1,[Define if we have va_copy]) + else + AC_CACHE_CHECK([for __va_copy],pac_cv_func___va_copy,[ +- AC_TRY_LINK([ +-#include +-void foo1( char *fmt, ... ) { +- va_list ap, list; +- va_start(ap,fmt); +- __va_copy(list,ap); +- va_end(list); +- va_end(ap); +-} +-],[foo1("a test %d", 3);],pac_cv_func___va_copy=yes,pac_cv_func___va_copy=no)]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ void foo1( char *fmt, ... ) { ++ va_list ap, list; ++ va_start(ap,fmt); ++ __va_copy(list,ap); ++ va_end(list); ++ va_end(ap); ++ } ++ ]],[[foo1("a test %d", 3);]])],pac_cv_func___va_copy=yes,pac_cv_func___va_copy=no) ++ ]) + if test "$pac_cv_func___va_copy" = "yes" ; then + AC_DEFINE(HAVE___VA_COPY,1,[Define if we have __va_copy]) + fi +@@ -5108,16 +5116,15 @@ AC_CHECK_FUNCS(sched_setaffinity sched_getaffinity bindprocessor thread_policy_s + if test "$ac_cv_func_sched_setaffinity" = "yes" ; then + # Test for the cpu process set type + AC_CACHE_CHECK([whether cpu_set_t available],pac_cv_have_cpu_set_t,[ +- AC_TRY_COMPILE( [ +-#include ],[ cpu_set_t t; ],pac_cv_have_cpu_set_t=yes,pac_cv_have_cpu_set_t=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[cpu_set_t t;]])], ++ pac_cv_have_cpu_set_t=yes,pac_cv_have_cpu_set_t=no)]) + if test "$pac_cv_have_cpu_set_t" = yes ; then + AC_DEFINE(HAVE_CPU_SET_T,1,[Define if cpu_set_t is defined in sched.h]) + + AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined], + pac_cv_cpu_set_defined,[ +- AC_TRY_LINK( [ +-#include ],[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ], +- pac_cv_cpu_set_defined=yes,pac_cv_cpu_set_defined=no)]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t);]])], ++ pac_cv_cpu_set_defined=yes,pac_cv_cpu_set_defined=no)]) + if test "$pac_cv_cpu_set_defined" = "yes" ; then + AC_DEFINE(HAVE_CPU_SET_MACROS,1,[Define if CPU_SET and CPU_ZERO defined]) + fi +@@ -5126,13 +5133,16 @@ if test "$ac_cv_func_sched_setaffinity" = "yes" ; then + fi + fi + if test "$ac_cv_func_thread_policy_set" = yes ; then +- AC_CACHE_CHECK([whether thread affinity macros defined], +- pac_cv_have_thread_affinity_policy,[ +- AC_TRY_COMPILE([#include ],[ +-#if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL) +- :'thread macros not defined +-],pac_cv_have_thread_affinity_policy=yes, +- pac_cv_have_thread_affinity_policy=no)]) ++ AC_CACHE_CHECK([whether thread affinity macros defined], pac_cv_have_thread_affinity_policy,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ #if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL) ++ :'thread macros not defined ++ ]])], ++ pac_cv_have_thread_affinity_policy=yes, ++ pac_cv_have_thread_affinity_policy=no) ++ ]) + if test "$pac_cv_have_thread_affinity_policy" = yes ; then + AC_DEFINE(HAVE_OSX_THREAD_AFFINITY,1,[Define is the OSX thread affinity policy macros defined]) + fi +diff --git src/mpi/romio/configure.ac src/mpi/romio/configure.ac +index 546c1bcf5139..47ed4ce10f64 100644 +--- src/mpi/romio/configure.ac ++++ src/mpi/romio/configure.ac +@@ -722,23 +722,23 @@ AM_CONDITIONAL([BUILD_F77_TESTS],[test "x$NOF77" != "x1"]) + # + # Check whether the MPI Offset type is compatible with struct flock + AC_MSG_CHECKING([whether struct flock compatible with MPI_Offset]) +-AC_TRY_COMPILE([#include ], +-[struct flock l; +- $MPI_OFFSET_TYPE a=1; +- l.l_start = a; +- l.l_len = a; +-],pac_cv_struct_flock_and_mpi_offset=yes,pac_cv_struct_flock_and_mpi_offset=no) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ ++ struct flock l; ++ $MPI_OFFSET_TYPE a=1; ++ l.l_start = a; ++ l.l_len = a; ++ ]])],pac_cv_struct_flock_and_mpi_offset=yes,pac_cv_struct_flock_and_mpi_offset=no) + AC_MSG_RESULT($pac_cv_struct_flock_and_mpi_offset) + # FIXME: We should look for struct flock64 and the F_SETLK64/F_GETLK64 + # ADIOI_GEN_SetLock. could use these instead. + if test "$pac_cv_struct_flock_and_mpi_offset" = no ; then + AC_MSG_CHECKING([whether struct flock compatible with int]) +- AC_TRY_COMPILE([#include ], +-[struct flock l; +- int a=1; +- l.l_start = a; +- l.l_len = a; +-],pac_cv_struct_flock_and_int=yes,pac_cv_struct_flock_and_int=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ ++ struct flock l; ++ int a=1; ++ l.l_start = a; ++ l.l_len = a; ++ ]])],pac_cv_struct_flock_and_int=yes,pac_cv_struct_flock_and_int=no) + AC_MSG_RESULT($pac_cv_struct_flock_and_int) + if test "$pac_cv_struct_flock_and_int" = yes ; then + AC_DEFINE(NEEDS_INT_CAST_WITH_FLOCK,1,[Define if l_start and l_len data should be cast as int]) +@@ -946,32 +946,30 @@ AM_CONDITIONAL([LUSTRE_LOCKAHEAD],[test "$lustre_lockahead" = "yes"]) + if test -n "$file_system_xfs"; then + AC_DEFINE(ROMIO_XFS,1,[Define for ROMIO with XFS]) + # Check for memalign value +- AC_CACHE_CHECK([for memory alignment needed for direct I/O], +- pac_cv_memalignval, +- [ +- rm -f confmemalignval +- rm -f /tmp/romio_tmp.bin +- AC_TRY_RUN([ +-#include +-#include +-#include +-#include +-int main(int argc, char **argv) { +- struct dioattr st; +- int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); +- FILE *f=fopen("confmemalignval","w"); +- if (fd == -1) exit(1); +- if (!f) exit(1); +- fcntl(fd, F_DIOINFO, &st); +- fprintf( f, "%u\n", st.d_mem); +- exit(0); +- } +- ], +- pac_cv_memalignval=`cat confmemalignval`, +- pac_cv_memalignval="unknown",pac_cv_memalignval="unknown" +- ) +- rm -f confmemalignval +- rm -f /tmp/romio_tmp.bin ++ AC_CACHE_CHECK([for memory alignment needed for direct I/O], pac_cv_memalignval,[ ++ rm -f confmemalignval ++ rm -f /tmp/romio_tmp.bin ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #include ++ #include ++ #include ++ int main(int argc, char **argv) { ++ struct dioattr st; ++ int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); ++ FILE *f=fopen("confmemalignval","w"); ++ if (fd == -1) exit(1); ++ if (!f) exit(1); ++ fcntl(fd, F_DIOINFO, &st); ++ fprintf( f, "%u\n", st.d_mem); ++ exit(0); ++ } ++ ]])], ++ pac_cv_memalignval=`cat confmemalignval`, ++ pac_cv_memalignval="unknown",pac_cv_memalignval="unknown" ++ ) ++ rm -f confmemalignval ++ rm -f /tmp/romio_tmp.bin + ]) + if test -n "$pac_cv_memalignval" -a "$pac_cv_memalignval" != 0 -a \ + "$pac_cv_memalignval" != "unknown" ; then +@@ -1085,24 +1083,24 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x + # actually use the aio_write interface). Note that this will + # fail for some pre-POSIX implementations of the aio interface + # (an old IBM interface needs an fd argument as well) +- AC_TRY_RUN([ +-#include +-#ifdef HAVE_SIGNAL_H +-#include +-#endif +-#ifdef HAVE_AIO_H +-#include +-#endif +-#ifdef HAVE_SYS_AIO_H +-#include +-#endif ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #ifdef HAVE_SIGNAL_H ++ #include ++ #endif ++ #ifdef HAVE_AIO_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_AIO_H ++ #include ++ #endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_write(aiocbp); + return 0; + } +- ], ++ ]])], + aio_runs=yes + AC_MSG_RESULT(yes), + aio_runs=no +@@ -1125,17 +1123,17 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x + # aio_read correctly + + AC_MSG_CHECKING([for obsolete two-argument aio_write]) +- AC_TRY_RUN([ +-#include +-#ifdef HAVE_SIGNAL_H +-#include +-#endif +-#ifdef HAVE_AIO_H +-#include +-#endif +-#ifdef HAVE_SYS_AIO_H +-#include +-#endif ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #ifdef HAVE_SIGNAL_H ++ #include ++ #endif ++ #ifdef HAVE_AIO_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_AIO_H ++ #include ++ #endif + int main(int argc, char **argv) + { + int fd; +@@ -1143,7 +1141,7 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x + if (argc > 10) aio_write(fd, aiocbp); + return 0; + } +- ], ++ ]])], + aio_two_arg_write=yes + AC_MSG_RESULT(yes), + aio_two_arg_write=no +@@ -1158,24 +1156,24 @@ if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" -o "x + fi + + AC_MSG_CHECKING([for obsolete two-argument aio_suspend]) +- AC_TRY_RUN([ +-#include +-#ifdef HAVE_SIGNAL_H +-#include +-#endif +-#ifdef HAVE_AIO_H +-#include +-#endif +-#ifdef HAVE_SYS_AIO_H +-#include +-#endif ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ #include ++ #ifdef HAVE_SIGNAL_H ++ #include ++ #endif ++ #ifdef HAVE_AIO_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_AIO_H ++ #include ++ #endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_suspend(1, &aiocbp); + return 0; + } +- ], ++ ]])], + aio_two_arg_suspend=yes + AC_MSG_RESULT(yes), + aio_two_arg_suspend=no +@@ -1239,22 +1237,22 @@ AS_CASE([$host_os], + AC_CHECK_HEADERS(sys/vfs.h sys/param.h sys/mount.h sys/statvfs.h) + AC_CHECK_FUNCS([statfs]) + AC_MSG_CHECKING([whether struct statfs properly defined]) +-AC_TRY_COMPILE([ +-#ifdef HAVE_SYS_VFS_H +-#include +-#endif +-#ifdef HAVE_SYS_STATVFS_H +-#include +-#endif +-#ifdef HAVE_SYS_PARAM_H +-#include +-#endif +-#ifdef HAVE_SYS_MOUNT_H +-#include +-#endif +- ],[ ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_VFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_STATVFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_PARAM_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_MOUNT_H ++ #include ++ #endif ++ ]],[[ + struct statfs f; +- ], ++ ]])], + pac_cv_have_statfs=yes,pac_cv_have_statfs=no + ) + AC_MSG_RESULT($pac_cv_have_statfs) +@@ -1266,27 +1264,27 @@ if test "$pac_cv_have_statfs" = yes ; then + AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if struct statfs can be compiled]) + fi + AC_MSG_CHECKING([for f_type member of statfs structure]) +-AC_TRY_COMPILE([ +-#ifdef HAVE_SYS_VFS_H +-#include +-#endif +-#ifdef HAVE_SYS_STATVFS_H +-#include +-#endif +-#ifdef HAVE_SYS_PARAM_H +-#include +-#endif +-#ifdef HAVE_SYS_MOUNT_H +-#include +-#endif +-#ifdef HAVE_STRING_H +-#include +-#endif +- ],[ ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_VFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_STATVFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_PARAM_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_MOUNT_H ++ #include ++ #endif ++ #ifdef HAVE_STRING_H ++ #include ++ #endif ++ ]],[[ + struct statfs f; + memset(&f, 0, sizeof(f)); + f.f_type = 0; +- ], ++ ]])], + pac_cv_have_statfs_f_type=yes, + pac_cv_have_statfs_f_type=no + ) +@@ -1297,27 +1295,27 @@ fi + + + AC_MSG_CHECKING([for f_fstypename member of statfs structure]) +-AC_TRY_COMPILE([ +-#ifdef HAVE_SYS_VFS_H +-#include +-#endif +-#ifdef HAVE_SYS_STATVFS_H +-#include +-#endif +-#ifdef HAVE_SYS_PARAM_H +-#include +-#endif +-#ifdef HAVE_SYS_MOUNT_H +-#include +-#endif +-#ifdef HAVE_STRING_H +-#include +-#endif +- ],[ ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_VFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_STATVFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_PARAM_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_MOUNT_H ++ #include ++ #endif ++ #ifdef HAVE_STRING_H ++ #include ++ #endif ++ ]],[[ + struct statfs f; + memset(&f, 0, sizeof(f)); + strncmp("nfs", f.f_fstypename, 3); +- ], ++ ]])], + pac_cv_have_statfs_f_fstypename=yes, + pac_cv_have_statfs_f_fstypename=no + ) +@@ -1333,21 +1331,20 @@ AC_CHECK_HEADERS(sys/stat.h sys/types.h unistd.h) + AC_CHECK_FUNCS(stat, + AC_DEFINE(HAVE_STAT, 1, Define if stat function is present) + AC_MSG_CHECKING([for st_fstype member of stat structure]) +- AC_TRY_COMPILE([ +-#ifdef HAVE_SYS_TYPES_H +-#include +-#endif +-#ifdef HAVE_SYS_STAT_H +-#include +-#endif +-#ifdef HAVE_UNISTD_H +-#include +-#endif +- ],[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_TYPES_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_STAT_H ++ #include ++ #endif ++ #ifdef HAVE_UNISTD_H ++ #include ++ #endif ++ ]],[[ + struct stat s; +- + s.st_fstype = NULL; +- ], ++ ]])], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE, 1, Define if struct stat has a st_fstype member), + AC_MSG_RESULT(no) +@@ -1361,21 +1358,20 @@ AC_CHECK_HEADERS(sys/types.h sys/statvfs.h sys/vfs.h) + AC_CHECK_FUNCS(statvfs, + AC_DEFINE(HAVE_STATVFS, 1, Define if statvfs function is present) + AC_MSG_CHECKING([for f_basetype member of statvfs structure]) +- AC_TRY_COMPILE([ +-#ifdef HAVE_SYS_TYPES_H +-#include +-#endif +-#ifdef HAVE_SYS_VFS_H +-#include +-#endif +-#ifdef HAVE_SYS_STATVFS_H +-#include +-#endif +- ], [[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_TYPES_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_VFS_H ++ #include ++ #endif ++ #ifdef HAVE_SYS_STATVFS_H ++ #include ++ #endif ++ ]], [[ + struct statvfs foo; +- + foo.f_basetype[0] = 'a'; +- ]], ++ ]])], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE, 1, defined if struct statvfs has a f_basetype member), + AC_MSG_RESULT(no) +diff --git src/mpid/ch3/channels/nemesis/subconfigure.m4 src/mpid/ch3/channels/nemesis/subconfigure.m4 +index 3cf998d4eb68..d1fbbf375e21 100644 +--- src/mpid/ch3/channels/nemesis/subconfigure.m4 ++++ src/mpid/ch3/channels/nemesis/subconfigure.m4 +@@ -44,11 +44,12 @@ AC_MSG_NOTICE([RUNNING CONFIGURE FOR ch3:nemesis]) + ##fi + + dnl AC_CHECK_HEADER(net/if.h) fails on Solaris; extra header files needed +-AC_TRY_COMPILE([ +-#include +-#include +-#include +-],,lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ #include ++ ]],[])], ++ lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no) + + echo "checking for net/if.h... $lac_cv_header_net_if_h" + +@@ -77,12 +78,15 @@ AC_CHECK_HEADERS([ \ + # other headers. 2.57 changes the syntax (!) of check_headers to allow + # additional headers. + AC_CACHE_CHECK([for netinet/in.h],ac_cv_header_netinet_in_h,[ +-AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H +-#include +-#endif +-#include ],[int a=0;], +- ac_cv_header_netinet_in_h=yes, +- ac_cv_header_netinet_in_h=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_TYPES_H ++ #include ++ #endif ++ #include ++ ]],[[int a=0;]])], ++ ac_cv_header_netinet_in_h=yes, ++ ac_cv_header_netinet_in_h=no) ++]) + if test "$ac_cv_header_netinet_in_h" = yes ; then + AC_DEFINE(HAVE_NETINET_IN_H,1,[Define if netinet/in.h exists]) + fi +@@ -194,27 +198,30 @@ AC_DEFINE(USE_FASTBOX,1,[Define to use the fastboxes in Nemesis code]) + + # We may need this only for tcp and related netmodules + # Check for h_addr or h_addr_list +-AC_CACHE_CHECK([whether struct hostent contains h_addr_list], +-pac_cv_have_haddr_list,[ +-AC_TRY_COMPILE([ +-#include ],[struct hostent hp;hp.h_addr_list[0]=0;], +-pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)]) ++AC_CACHE_CHECK([whether struct hostent contains h_addr_list], pac_cv_have_haddr_list,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct hostent hp;hp.h_addr_list[0]=0; ++ ]])], pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no) ++]) + if test "$pac_cv_have_haddr_list" = "yes" ; then + AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list]) + fi + + # If we need the socket code, see if we can use struct ifconf + # sys/socket.h is needed on Solaris +-AC_CACHE_CHECK([whether we can use struct ifconf], +-pac_cv_have_struct_ifconf,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#include +-],[struct ifconf conftest; int s; s = sizeof(conftest);], +-pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)]) ++AC_CACHE_CHECK([whether we can use struct ifconf], pac_cv_have_struct_ifconf,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #include ++ ]],[[ ++ struct ifconf conftest; int s; s = sizeof(conftest); ++ ]])], pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no) ++]) + + # Intentionally not testing whether _SVID_SOURCE or _POSIX_C_SOURCE affects + # ifconf availability. Making those sort of modifications at this stage +@@ -225,16 +232,17 @@ if test "$pac_cv_have_struct_ifconf" = "yes" ; then + AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used]) + fi + +-AC_CACHE_CHECK([whether we can use struct ifreq], +-pac_cv_have_struct_ifreq,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#include +-],[struct ifreq conftest; int s; s = sizeof(conftest);], +-pac_cv_have_struct_ifreq=yes,pac_cv_have_struct_ifreq=no)]) ++AC_CACHE_CHECK([whether we can use struct ifreq], pac_cv_have_struct_ifreq,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #include ++ ]],[[ ++ struct ifreq conftest; int s; s = sizeof(conftest); ++ ]])], pac_cv_have_struct_ifreq=yes,pac_cv_have_struct_ifreq=no) ++]) + + if test "$pac_cv_have_struct_ifreq" = "yes" ; then + AC_DEFINE(HAVE_STRUCT_IFREQ,1,[Define if struct ifreq can be used]) +diff --git src/mpid/ch3/channels/sock/subconfigure.m4 src/mpid/ch3/channels/sock/subconfigure.m4 +index 3ca6912bcadf..d8a8491d5d27 100644 +--- src/mpid/ch3/channels/sock/subconfigure.m4 ++++ src/mpid/ch3/channels/sock/subconfigure.m4 +@@ -88,58 +88,58 @@ AC_CHECK_HEADERS([assert.h errno.h fcntl.h limits.h netdb.h netinet/in.h netinet + AC_CHECK_HEADERS([poll.h stdlib.h sys/param.h sys/poll.h sys/types.h sys/uio.h unistd.h]) + + AC_MSG_CHECKING([if struct poll is defined]); +-AC_TRY_COMPILE([ +-#if defined(HAVE_POLL_H) +-#include +-#endif +-#if defined(HAVE_SYS_POLL_H) +-#include +-#endif +-],[ +-struct pollfd pollfd; +-pollfd.fd = -1; +-],[ +-AC_MSG_RESULT([yes]) +-],[ +-AC_MSG_RESULT([no]) +-AC_MSG_ERROR([This device requires the poll function]) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #if defined(HAVE_POLL_H) ++ #include ++ #endif ++ #if defined(HAVE_SYS_POLL_H) ++ #include ++ #endif ++ ]],[[ ++ struct pollfd pollfd; ++ pollfd.fd = -1; ++ ]])],[ ++ AC_MSG_RESULT([yes]) ++ ],[ ++ AC_MSG_RESULT([no]) ++ AC_MSG_ERROR([This device requires the poll function]) + ]) + + AC_MSG_CHECKING([if a simple program using poll() can be compiled]); +-AC_TRY_COMPILE([ +-#if defined(HAVE_POLL_H) +-#include +-#endif +-#if defined(HAVE_SYS_POLL_H) +-#include +-#endif +-],[ +-struct pollfd pollfds[2]; +-int n_fds; +-pollfds[0].fd = -1; +-pollfds[1].fd = -1; +-n_fds = poll(pollfds, 2, -1); +-],[ +-AC_MSG_RESULT([yes]) +-],[ +-AC_MSG_RESULT([no]) +-AC_MSG_ERROR([This device requires the poll function]) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #if defined(HAVE_POLL_H) ++ #include ++ #endif ++ #if defined(HAVE_SYS_POLL_H) ++ #include ++ #endif ++ ]],[[ ++ struct pollfd pollfds[2]; ++ int n_fds; ++ pollfds[0].fd = -1; ++ pollfds[1].fd = -1; ++ n_fds = poll(pollfds, 2, -1); ++ ]])],[ ++ AC_MSG_RESULT([yes]) ++ ],[ ++ AC_MSG_RESULT([no]) ++ AC_MSG_ERROR([This device requires the poll function]) + ]) + + dnl + dnl needed on AIX + dnl + AC_MSG_CHECKING([whether bit fields work in ip.h]); +-AC_TRY_COMPILE([ +-#include +-],[ +-int i; +-],[ +-AC_MSG_RESULT([yes]) +-bit_fields=yes +-],[ +-AC_MSG_RESULT([no]) +-bit_fields=no ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ int i; ++ ]])],[ ++ AC_MSG_RESULT([yes]) ++ bit_fields=yes ++ ],[ ++ AC_MSG_RESULT([no]) ++ bit_fields=no + ]) + if test "$bit_fields" = "no" ; then + AC_MSG_RESULT([Adding -D_NO_BITFIELDS to CFLAGS]) +@@ -158,31 +158,32 @@ AC_SEARCH_LIBS([gethostbyname],[nsl]) + + # Check first for sys/socket.h . We check not only for existence but whether + # it can be compiled (!), as we have seen some problems with this. +-AC_TRY_COMPILE([ +-#include +-#include +-],[int a;],ac_cv_header_sys_socket_h=yes,ac_cv_header_sys_socket_h=no) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[int a;]])], ++ ac_cv_header_sys_socket_h=yes,ac_cv_header_sys_socket_h=no) + if test "$ac_cv_header_sys_socket_h" = yes ; then + AC_DEFINE(HAVE_SYS_SOCKET_H,1,[Define if you have the header file.]) + fi + # Check for socklen_t . If undefined, define it as int + # (note the conditional inclusion of sys/socket.h) +-AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], +-pac_cv_have_socklen_t,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-typedef struct { double a; int b; } socklen_t;], +-[socklen_t a;a.a=1.0;], +-[pac_cv_have_socklen_t=no], +-[pac_cv_have_socklen_t=yes])]) ++AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], pac_cv_have_socklen_t,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ typedef struct { double a; int b; } socklen_t; ++ ]],[[socklen_t a;a.a=1.0;]])], ++ [pac_cv_have_socklen_t=no], ++ [pac_cv_have_socklen_t=yes]) ++]) + if test "X$pac_cv_have_socklen_t" = Xno ; then + AC_DEFINE([socklen_t],[int],[Define if socklen_t is not defined]) + fi + +- ]) ++ ]) dnl IF BUILD_CH3_SOCK + ])dnl + dnl + dnl _BODY handles the former role of configure in the subsystem +@@ -192,11 +193,11 @@ AC_MSG_NOTICE([RUNNING CONFIGURE FOR ch3:sock]) + # code that formerly lived in configure.ac + + dnl AC_CHECK_HEADER(net/if.h) fails on Solaris; extra header files needed +-AC_TRY_COMPILE([ +-#include +-#include +-#include +-],,lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no) ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ #include ++ ]],[])],lac_cv_header_net_if_h=yes,lac_cv_header_net_if_h=no) + + # FIXME why doesn't this use the proper machinery? + echo "checking for net/if.h... $lac_cv_header_net_if_h" +@@ -219,12 +220,15 @@ AC_CHECK_HEADERS( \ + # other headers. 2.57 changes the syntax (!) of check_headers to allow + # additional headers. + AC_CACHE_CHECK([for netinet/in.h],ac_cv_header_netinet_in_h,[ +-AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H +-#include +-#endif +-#include ],[int a=0;], +- ac_cv_header_netinet_in_h=yes, +- ac_cv_header_netinet_in_h=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #ifdef HAVE_SYS_TYPES_H ++ #include ++ #endif ++ #include ++ ]],[[int a=0;]])], ++ ac_cv_header_netinet_in_h=yes, ++ ac_cv_header_netinet_in_h=no) ++]) + if test "$ac_cv_header_netinet_in_h" = yes ; then + AC_DEFINE(HAVE_NETINET_IN_H,1,[Define if netinet/in.h exists]) + fi +diff --git src/mpid/ch3/util/sock/subconfigure.m4 src/mpid/ch3/util/sock/subconfigure.m4 +index 994bf6a92512..b310744690dc 100644 +--- src/mpid/ch3/util/sock/subconfigure.m4 ++++ src/mpid/ch3/util/sock/subconfigure.m4 +@@ -30,31 +30,35 @@ AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[ + + # If we need the socket code, see if we can use struct ifconf + # sys/socket.h is needed on Solaris +- AC_CACHE_CHECK([whether we can use struct ifconf], +- pac_cv_have_struct_ifconf,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#include +-],[struct ifconf conftest;], +-pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)]) ++ AC_CACHE_CHECK([whether we can use struct ifconf], pac_cv_have_struct_ifconf,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #include ++ ]],[[ ++ struct ifconf conftest; ++ ]])], pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no) ++ ]) + + if test "$pac_cv_have_struct_ifconf" = "no" ; then + # Try again with _SVID_SOURCE + AC_CACHE_CHECK([whether we can use struct ifconf with _SVID_SOURCE], + [pac_cv_have_struct_ifconf_with_svid],[ +-AC_TRY_COMPILE([ +-#define _SVID_SOURCE +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#include +-],[struct ifconf conftest;], +- pac_cv_have_struct_ifconf_with_svid=yes, +- pac_cv_have_struct_ifconf_with_svid=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _SVID_SOURCE ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #include ++ ]],[[ ++ struct ifconf conftest; ++ ]])], ++ pac_cv_have_struct_ifconf_with_svid=yes, ++ pac_cv_have_struct_ifconf_with_svid=no) ++ ]) + if test "$pac_cv_have_struct_ifconf_with_svid" = yes ; then + AC_DEFINE(USE_SVIDSOURCE_FOR_IFCONF,1,[Define if _SVID_SOURCE needs to be defined for struct ifconf]) + fi +@@ -64,17 +68,20 @@ AC_TRY_COMPILE([ + "$pac_cv_have_struct_ifconf_with_svid" = "no" ; then + # Try again with undef _POSIX_C_SOURCE + AC_CACHE_CHECK([whether we can use struct ifconf without _POSIX_C_SOURCE], +-pac_cv_have_struct_ifconf_without_posix,[ +-AC_TRY_COMPILE([ +-#undef _POSIX_C_SOURCE +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#include +-],[struct ifconf conftest;], +-pac_cv_have_struct_ifconf_without_posix=yes, +-pac_cv_have_struct_ifconf_without_posix=no)]) ++ pac_cv_have_struct_ifconf_without_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #undef _POSIX_C_SOURCE ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ #include ++ ]],[[ ++ struct ifconf conftest; ++ ]])], ++ pac_cv_have_struct_ifconf_without_posix=yes, ++ pac_cv_have_struct_ifconf_without_posix=no) ++ ]) + if test "$pac_cv_have_struct_ifconf_without_posix" = yes ; then + AC_DEFINE(USE_NOPOSIX_FOR_IFCONF,1,[Define if _POSIX_C_SOURCE needs to be undefined for struct ifconf]) + fi +diff --git src/mpl/configure.ac src/mpl/configure.ac +index 0d24c86fa917..c212200f9388 100644 +--- src/mpl/configure.ac ++++ src/mpl/configure.ac +@@ -311,10 +311,12 @@ if test -z "$timer_type" ; then + # do arithmetic with hrtime_t . + AC_CACHE_CHECK([that hrtime_t is properly defined for gethrtime], + pac_cv_hrtime_works,[ +- AC_TRY_COMPILE([ +-#include +-],[hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2;], +-pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ hrtime_t t1, t2; t1 = 1; t2 = 2; t1 = t1 + t2; ++ ]])], ++ pac_cv_hrtime_works=yes,pac_cv_hrtime_works=no)]) + # A more ambitious test would look to see if casting an + # hrtime_t to int64_t works, and even more ambitious + # would check whether long or long long was 64 bits (or even +@@ -363,21 +365,27 @@ case "$timer_type" in + # Make sure that we can use struct timespec + AC_CACHE_CHECK([whether struct timespec is defined in time.h], + pac_cv_struct_timespec_defined,[ +- AC_TRY_COMPILE([ +-#include ],[ +- struct timespec t;],pac_cv_struct_timespec_defined=yes, +- pac_cv_struct_timespec_defined=no) +-]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct timespec t; ++ ]])], ++ pac_cv_struct_timespec_defined=yes, ++ pac_cv_struct_timespec_defined=no) ++ ]) + if test "$pac_cv_struct_timespec_defined" != "yes" ; then + # Try again, but with -D_XOPEN_SOURCE=500 (works for AIX) + AC_CACHE_CHECK([whether struct timespec is defined in time.h with _XOPEN_SOURCE=500], + pac_cv_struct_timespec_defined_with_xopen500,[ +- AC_TRY_COMPILE([ +-#define _XOPEN_SOURCE 500 +-#include ],[ +- struct timespec t;],pac_cv_struct_timespec_defined_with_xopen500=yes, +- pac_cv_struct_timespec_defined_with_xopen500=no) +-]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _XOPEN_SOURCE 500 ++ #include ++ ]],[[ ++ struct timespec t; ++ ]])], ++ pac_cv_struct_timespec_defined_with_xopen500=yes, ++ pac_cv_struct_timespec_defined_with_xopen500=no) ++ ]) + if test "$pac_cv_struct_timespec_defined_with_xopen500" = "yes" ; then + # We need to define _XOPEN_SOURCE=500, but we need to ensure that + # this is done before any include files are loaded. At +@@ -391,19 +399,26 @@ case "$timer_type" in + # time.h is required (see pages 45 and 46 in the POSIX standard). + # See if we can compile + AC_CACHE_CHECK([for CLOCK_REALTIME defined in time.h],pac_cv_posix_clock_realtime,[ +- AC_TRY_COMPILE([ +-#include ],[ +- clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes, +-pac_cv_posix_clock_realtime=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ clockid_t cid = CLOCK_REALTIME; ++ ]])], ++ pac_cv_posix_clock_realtime=yes, ++ pac_cv_posix_clock_realtime=no) ++ ]) + if test "$pac_cv_posix_clock_realtime" = "no" ; then + AC_MSG_WARN([POSIX timer requires definitions in time.h]) + # Check for the definition in sys/time.h, which is where + # OpenBSD and FreeBSD have put it by mistake +- AC_TRY_COMPILE([ +-#include +-#include ],[ +- clockid_t cid = CLOCK_REALTIME;],pac_cv_posix_clock_realtime=yes, +-pac_cv_posix_clock_realtime=no) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[ ++ clockid_t cid = CLOCK_REALTIME; ++ ]])], ++ pac_cv_posix_clock_realtime=yes, ++ pac_cv_posix_clock_realtime=no) + if test "$pac_cv_posix_clock_realtime" = yes ; then + AC_MSG_WARN([sys/time.h required for POSIX timer]) + AC_DEFINE(NEEDS_SYS_TIME_H,1,[Define if sys/time.h is required to get timer definitions]) +@@ -426,76 +441,73 @@ pac_cv_posix_clock_realtime=no) + + linux86_cycle|linux86_cycle_2) + +-# The following AC_TRY_RUN statements are needed because x86_64 compilers ++# The following AC_RUN_IFELSE statements are needed because x86_64 compilers + # usually know about rdtscp but the cpu may or may not actually implement the + # feature. This is not cross-compile safe, unfortunately. In the long run we + # should allow the user to override this with a configure flag. +- AC_CACHE_CHECK([that linux86 cycle counter is available], +- pac_cv_linux86_cycle, +- AC_TRY_RUN([ +-int main() +-{ +- /* rdtscp */ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); +- return 0; +-} +- ],pac_cv_linux86_cycle=rdtscp, +- AC_TRY_RUN([[ +-int main() +-{ +- /* cpuid 64 */ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); +- return 0; +-} +- ]],pac_cv_linux86_cycle=cpuid_rdtsc64, +- AC_TRY_RUN([[[ +-int main() +-{ +- /* cpuid 32 */ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); +- return 0; +-} +- ]]],pac_cv_linux86_cycle=cpuid_rdtsc32, +- AC_TRY_RUN([[[[ +-int main() +-{ +- /* simple */ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); +- return 0; +-} +- ]]]],pac_cv_linux86_cycle=rdtsc, +- pac_cv_linux86_cycle=no) +- ) +- ), +-dnl The if-cross-compiling clause from the first AC_TRY_RUN. Hope that if the +-dnl compiler knows about the instruction then it's supported by the target +-dnl platform. +- AC_TRY_COMPILE(,[[ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); +- ]],pac_cv_linux86_cycle=rdtscp, +- AC_TRY_COMPILE(,[[[ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); +- ]]],pac_cv_linux86_cycle=cpuid_rdtsc64, +- AC_TRY_COMPILE(,[[[[ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); +- ]]]],pac_cv_linux86_cycle=cpuid_rdtsc32, +- AC_TRY_COMPILE(,[[[[[ +- long long var, *var_ptr=&var; +- __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); +- ]]]]],pac_cv_linux86_cycle=rdtsc, +- pac_cv_linux86_cycle=no) +- ) +- ) +- ) +- ) +- ) ++ AC_CACHE_CHECK([that linux86 cycle counter is available], pac_cv_linux86_cycle, [ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ int main() ++ { ++ /* rdtscp */ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); ++ return 0; ++ } ++ ]])],pac_cv_linux86_cycle=rdtscp,[ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ int main() ++ { ++ /* cpuid 64 */ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); ++ return 0; ++ } ++ ]])],pac_cv_linux86_cycle=cpuid_rdtsc64,[ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ int main() ++ { ++ /* cpuid 32 */ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); ++ return 0; ++ } ++ ]])],pac_cv_linux86_cycle=cpuid_rdtsc32,[ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++ int main() ++ { ++ /* simple */ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); ++ return 0; ++ } ++ ]])],pac_cv_linux86_cycle=rdtsc, ++ pac_cv_linux86_cycle=no) ++ ])])], dnl closing the last 3 AC_RUN_IFELSE ++ [ ++ dnl The if-cross-compiling clause from the first AC_RUN_IFELSE. Hope that if the ++ dnl compiler knows about the instruction then it's supported by the target ++ dnl platform. ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); ++ ]])],pac_cv_linux86_cycle=rdtscp,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("push %%rbx ; cpuid ; rdtsc ; pop %%rbx ; shl $32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); ++ ]])],pac_cv_linux86_cycle=cpuid_rdtsc64,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); ++ ]])],pac_cv_linux86_cycle=cpuid_rdtsc32,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ long long var, *var_ptr=&var; ++ __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); ++ ]])],pac_cv_linux86_cycle=rdtsc, ++ pac_cv_linux86_cycle=no ++ )])])]) dnl closing the 4 AC_COMPILE_IFELSE ++ ]) dnl end of first AC_RUN_IFELSE ++ ]) dnl end of AC_CACHE_CHECK + + case "$pac_cv_linux86_cycle" in + "rdtscp") +@@ -522,47 +534,45 @@ dnl platform. + ;; + + gcc_ia64_cycle) +- AC_CACHE_CHECK([that IPF timer is available], +-pac_cv_ia64_cycle,[ +- AC_TRY_COMPILE(,[ +- long var, *var_ptr=&var; +-#ifdef __INTEL_COMPILER +-#include "ia64regs.h" +- var=__getReg(_IA64_REG_AR_ITC); +-#else +- __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr)); +-#endif +-],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)]) +- if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then +- AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler]) +- fi +- MPL_TIMER_TYPE="long" +- ;; ++ AC_CACHE_CHECK([that IPF timer is available], pac_cv_ia64_cycle,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ long var, *var_ptr=&var; ++ #ifdef __INTEL_COMPILER ++ #include "ia64regs.h" ++ var=__getReg(_IA64_REG_AR_ITC); ++ #else ++ __asm__ __volatile__("mov %0=ar.itc" : "=r" (var_ptr)); ++ #endif ++ ]])],pac_cv_gcc_ia64_cycle=yes,pac_cv_gcc_ia64_cycle=no)]) ++ if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then ++ AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler]) ++ fi ++ MPL_TIMER_TYPE="long" ++ ;; + + mach_absolute_time) +- AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])]) +- AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])]) +- MPL_TIMER_TYPE="uint64_t" +- ;; ++ AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])]) ++ AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])]) ++ MPL_TIMER_TYPE="uint64_t" ++ ;; + + ppc64_cycle) +- AC_CACHE_CHECK([that ppc64 timebase cycle counter is available], +- pac_cv_ppc64_cycle,[ +- AC_TRY_COMPILE([ +- ],[ +- unsigned temp; +- asm volatile ("mfspr %0,%1" : "=r" (temp) : "i" (0x10D)); +- ],pac_cv_ppc64_cycle=yes, +- pac_cv_ppc64_cycle=no) +- ]) +- if test "$pac_cv_ppc64_cycle" != "yes" ; then +- AC_MSG_ERROR([The PPC64 cycle counter is not available on this system and or with the $CC compiler]) +- fi +- MPL_TIMER_TYPE="uint64_t" +- ;; ++ AC_CACHE_CHECK([that ppc64 timebase cycle counter is available], pac_cv_ppc64_cycle,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[ ++ unsigned temp; ++ asm volatile ("mfspr %0,%1" : "=r" (temp) : "i" (0x10D)); ++ ]])], ++ pac_cv_ppc64_cycle=yes, ++ pac_cv_ppc64_cycle=no) ++ ]) ++ if test "$pac_cv_ppc64_cycle" != "yes" ; then ++ AC_MSG_ERROR([The PPC64 cycle counter is not available on this system and or with the $CC compiler]) ++ fi ++ MPL_TIMER_TYPE="uint64_t" ++ ;; + *) +- AC_MSG_ERROR([Invalid timer type $timer_type]) +- ;; ++ AC_MSG_ERROR([Invalid timer type $timer_type]) ++ ;; + esac + # Convert timer type to upper case + timer_type=`echo $timer_type | \ +@@ -800,16 +810,14 @@ if test "${with_thread_package}" = "pthreads" -o "${with_proc_mutex_package}" = + # Check for PTHREAD_MUTEX_ERRORCHECK_NP and PTHREAD_MUTEX_ERRORCHECK + AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK_NP], + pac_cv_has_pthread_mutex_errorcheck_np,[ +- AC_TRY_COMPILE([#include ], +- [int a=PTHREAD_MUTEX_ERRORCHECK_NP;], ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[int a=PTHREAD_MUTEX_ERRORCHECK_NP;]])], + pac_cv_has_pthread_mutex_errorcheck_np=yes, + pac_cv_has_pthread_mutex_errorcheck_np=no)]) +- AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK], +- pac_cv_has_pthread_mutex_errorcheck,[ +- AC_TRY_COMPILE([#include ], +- [int a=PTHREAD_MUTEX_ERRORCHECK;], ++ AC_CACHE_CHECK([whether pthread.h defines PTHREAD_MUTEX_ERRORCHECK], pac_cv_has_pthread_mutex_errorcheck,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[int a=PTHREAD_MUTEX_ERRORCHECK;]])], + pac_cv_has_pthread_mutex_errorcheck=yes, +- pac_cv_has_pthread_mutex_errorcheck=no)]) ++ pac_cv_has_pthread_mutex_errorcheck=no) ++ ]) + + if test "$pac_cv_has_pthread_mutex_errorcheck" = yes ; then + AC_DEFINE(PTHREAD_MUTEX_ERRORCHECK_VALUE,PTHREAD_MUTEX_ERRORCHECK, +diff --git src/pm/gforker/subconfigure.m4 src/pm/gforker/subconfigure.m4 +index ab9d70ac25ea..a5265187e255 100644 +--- src/pm/gforker/subconfigure.m4 ++++ src/pm/gforker/subconfigure.m4 +@@ -61,17 +61,23 @@ AC_CHECK_FUNCS([sigaction signal sigset]) + sigaction_ok=no + if test "$ac_cv_func_sigaction" = "yes" ; then + AC_CACHE_CHECK([for struct sigaction],pac_cv_struct_sigaction,[ +- AC_TRY_COMPILE([#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT );], +- pac_cv_struct_sigaction="yes",pac_cv_struct_sigaction="no")]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ ]])], pac_cv_struct_sigaction="yes",pac_cv_struct_sigaction="no") ++ ]) + if test "$pac_cv_struct_sigaction" = "no" ; then +- AC_CACHE_CHECK([for struct sigaction with _POSIX_SOURCE], +- pac_cv_struct_sigaction_needs_posix,[ +- AC_TRY_COMPILE([#define _POSIX_SOURCE +-#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT );], +- pac_cv_struct_sigaction_needs_posix="yes", +- pac_cv_struct_sigaction_needs_posix="no")]) ++ AC_CACHE_CHECK([for struct sigaction with _POSIX_SOURCE], pac_cv_struct_sigaction_needs_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _POSIX_SOURCE ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ ]])], ++ pac_cv_struct_sigaction_needs_posix="yes", ++ pac_cv_struct_sigaction_needs_posix="no") ++ ]) + if test "$pac_cv_struct_sigaction_needs_posix" = "yes" ; then + sigaction_ok=yes + fi +diff --git src/pm/hydra/configure.ac src/pm/hydra/configure.ac +index 68207b4a4615..ec7829134f4e 100644 +--- src/pm/hydra/configure.ac ++++ src/pm/hydra/configure.ac +@@ -204,26 +204,30 @@ if test "$ac_cv_func_killpg" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include ],killpg) + fi + +-AC_TRY_LINK([ +- #include +- #include +- #include +- ], +- [return getifaddrs(NULL);], +- [AC_DEFINE([HAVE_GETIFADDRS],1,[Define to '1' if getifaddrs is present and usable])]) ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ #include ++ ]],[[ ++ return getifaddrs(NULL); ++ ]])],[ ++ AC_DEFINE([HAVE_GETIFADDRS],1,[Define to '1' if getifaddrs is present and usable]) ++]) + + # Check what we need to do about the environ extern +-AC_CACHE_CHECK([for environ in unistd.h],pac_cv_environ_in_unistd, +- [AC_TRY_COMPILE([#include ],[char **x = environ;], +- pac_cv_environ_in_unistd=yes,pac_cv_environ_in_unistd=no)]) ++AC_CACHE_CHECK([for environ in unistd.h],pac_cv_environ_in_unistd, [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[char **x = environ;]])], ++ pac_cv_environ_in_unistd=yes,pac_cv_environ_in_unistd=no) ++]) + if test "$pac_cv_environ_in_unistd" = "yes" ; then + # We have environ defined in unistd.h; we are done + AC_DEFINE(HAVE_EXTERN_ENVIRON,1,[Define if environ extern is available]) + else + # See if we can declare it +- AC_CACHE_CHECK([for manually declared extern environ], pac_cv_manual_extern_environ, +- [AC_TRY_LINK([#include ],[extern char ** environ; char **x = environ;], +- pac_cv_manual_extern_environ=yes,pac_cv_manual_extern_environ=no)]) ++ AC_CACHE_CHECK([for manually declared extern environ], pac_cv_manual_extern_environ, [ ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[extern char ** environ; char **x = environ;]])], ++ pac_cv_manual_extern_environ=yes,pac_cv_manual_extern_environ=no) ++ ]) + if test "$pac_cv_manual_extern_environ" = "yes" ; then + # We can manually declare the extern + AC_DEFINE(MANUAL_EXTERN_ENVIRON,1,[Define if environ decl needed]) +@@ -655,22 +659,28 @@ AC_CHECK_FUNCS(sigaction signal sigset) + sigaction_ok=no + if test "$ac_cv_func_sigaction" = "yes" ; then + # Make sure that the fields that we need in sigaction are defined +- AC_CACHE_CHECK([for struct sigaction and sa_handler], +- pac_cv_struct_sigaction_with_sa_handler,[ +- AC_TRY_COMPILE([#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler=yes, +- pac_cv_struct_sigaction_with_sa_handler=no)]) ++ AC_CACHE_CHECK([for struct sigaction and sa_handler], pac_cv_struct_sigaction_with_sa_handler,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler=yes, ++ pac_cv_struct_sigaction_with_sa_handler=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler" = "no" ; then +- AC_CACHE_CHECK([for struct sigaction and sa_handler with _POSIX_SOURCE], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ +- AC_TRY_COMPILE([#define _POSIX_SOURCE +-#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=no)]) ++ AC_CACHE_CHECK([for struct sigaction and sa_handler with _POSIX_SOURCE], pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _POSIX_SOURCE ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler_needs_posix" = "yes" ; then + sigaction_ok=yes + fi +diff --git src/pm/hydra2/configure.ac src/pm/hydra2/configure.ac +index 5e8b09bf481a..9d2504cb85b7 100644 +--- src/pm/hydra2/configure.ac ++++ src/pm/hydra2/configure.ac +@@ -207,26 +207,30 @@ if test "$ac_cv_func_putenv" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include ],putenv) + fi + +-AC_TRY_LINK([ +- #include +- #include +- #include +- ], +- [return getifaddrs(NULL);], +- [AC_DEFINE([HAVE_GETIFADDRS],1,[Define to '1' if getifaddrs is present and usable])]) ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ #include ++ ]],[[ ++ return getifaddrs(NULL); ++ ]])],[ ++ AC_DEFINE([HAVE_GETIFADDRS],1,[Define to '1' if getifaddrs is present and usable]) ++]) + + # Check what we need to do about the environ extern +-AC_CACHE_CHECK([for environ in unistd.h],pac_cv_environ_in_unistd, +- [AC_TRY_COMPILE([#include ],[char **x = environ;], +- pac_cv_environ_in_unistd=yes,pac_cv_environ_in_unistd=no)]) ++AC_CACHE_CHECK([for environ in unistd.h],pac_cv_environ_in_unistd, [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[char **x = environ;]])], ++ pac_cv_environ_in_unistd=yes,pac_cv_environ_in_unistd=no) ++]) + if test "$pac_cv_environ_in_unistd" = "yes" ; then + # We have environ defined in unistd.h; we are done + AC_DEFINE(HAVE_EXTERN_ENVIRON,1,[Define if environ extern is available]) + else + # See if we can declare it +- AC_CACHE_CHECK([for manually declared extern environ], pac_cv_manual_extern_environ, +- [AC_TRY_LINK([#include ],[extern char ** environ; char **x = environ;], +- pac_cv_manual_extern_environ=yes,pac_cv_manual_extern_environ=no)]) ++ AC_CACHE_CHECK([for manually declared extern environ], pac_cv_manual_extern_environ, [ ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[extern char ** environ; char **x = environ;]])], ++ pac_cv_manual_extern_environ=yes,pac_cv_manual_extern_environ=no) ++ ]) + if test "$pac_cv_manual_extern_environ" = "yes" ; then + # We can manually declare the extern + AC_DEFINE(MANUAL_EXTERN_ENVIRON,1,[Define if environ decl needed]) +@@ -460,21 +464,29 @@ sigaction_ok=no + if test "$ac_cv_func_sigaction" = "yes" ; then + # Make sure that the fields that we need in sigaction are defined + AC_CACHE_CHECK([for struct sigaction and sa_handler], +- pac_cv_struct_sigaction_with_sa_handler,[ +- AC_TRY_COMPILE([#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler=yes, +- pac_cv_struct_sigaction_with_sa_handler=no)]) ++ pac_cv_struct_sigaction_with_sa_handler,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler=yes, ++ pac_cv_struct_sigaction_with_sa_handler=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler" = "no" ; then + AC_CACHE_CHECK([for struct sigaction and sa_handler with _POSIX_SOURCE], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ +- AC_TRY_COMPILE([#define _POSIX_SOURCE +-#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=no)]) ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _POSIX_SOURCE ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler_needs_posix" = "yes" ; then + sigaction_ok=yes + fi +diff --git src/pm/remshell/subconfigure.m4 src/pm/remshell/subconfigure.m4 +index c4ed507cdef5..ecc9dccb4a7d 100644 +--- src/pm/remshell/subconfigure.m4 ++++ src/pm/remshell/subconfigure.m4 +@@ -75,17 +75,23 @@ AC_CHECK_FUNCS([sigaction signal sigset]) + sigaction_ok=no + if test "$ac_cv_func_sigaction" = "yes" ; then + AC_CACHE_CHECK([for struct sigaction],pac_cv_struct_sigaction,[ +- AC_TRY_COMPILE([#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT );], +- pac_cv_struct_sigaction="yes",pac_cv_struct_sigaction="no")]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ ]])], pac_cv_struct_sigaction="yes",pac_cv_struct_sigaction="no") ++ ]) + if test "$pac_cv_struct_sigaction" = "no" ; then +- AC_CACHE_CHECK([for struct sigaction with _POSIX_SOURCE], +- pac_cv_struct_sigaction_needs_posix,[ +- AC_TRY_COMPILE([#define _POSIX_SOURCE +-#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT );], +- pac_cv_struct_sigaction_needs_posix="yes", +- pac_cv_struct_sigaction_needs_posix="no")]) ++ AC_CACHE_CHECK([for struct sigaction with _POSIX_SOURCE], pac_cv_struct_sigaction_needs_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _POSIX_SOURCE ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ ]])], ++ pac_cv_struct_sigaction_needs_posix="yes", ++ pac_cv_struct_sigaction_needs_posix="no") ++ ]) + if test "$pac_cv_struct_sigaction_needs_posix" = "yes" ; then + sigaction_ok=yes + fi +@@ -117,12 +123,14 @@ AC_CHECK_FUNCS([ptrace]) + # It isn't enough to find ptrace. We also need the ptrace + # parameters, which some systems, such as IRIX, do not define. + if test "$ac_cv_func_ptrace" = yes ; then +- AC_CACHE_CHECK([for ptrace named parameters], +-[pac_cv_has_ptrace_parms],[ +- AC_TRY_COMPILE([ +-#include +-#include ],[int i = PTRACE_CONT;],[pac_cv_has_ptrace_parms=yes], +-[pac_cv_has_ptrace_parms=no])]) ++ AC_CACHE_CHECK([for ptrace named parameters], [pac_cv_has_ptrace_parms],[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[ ++ int i = PTRACE_CONT; ++ ]])],[pac_cv_has_ptrace_parms=yes], [pac_cv_has_ptrace_parms=no]) ++ ]) + if test "$pac_cv_has_ptrace_parms" = "yes" ; then + AC_DEFINE([HAVE_PTRACE_CONT],[],[Define if ptrace parameters available]) + fi +diff --git src/pm/util/subconfigure.m4 src/pm/util/subconfigure.m4 +index 2bf2d73c2c05..ef756235da4b 100644 +--- src/pm/util/subconfigure.m4 ++++ src/pm/util/subconfigure.m4 +@@ -31,12 +31,14 @@ if test "$enable_onsig" = "yes" ; then + # It isn't enough to find ptrace. We also need the ptrace + # parameters, which some systems, such as IRIX, do not define. + if test "$ac_cv_func_ptrace" = yes ; then +- AC_CACHE_CHECK([for ptrace named parameters], +-pac_cv_has_ptrace_parms,[ +- AC_TRY_COMPILE([ +-#include +-#include ],[int i = PTRACE_CONT;],pac_cv_has_ptrace_parms=yes, +-pac_cv_has_ptrace_parms=no)]) ++ AC_CACHE_CHECK([for ptrace named parameters], pac_cv_has_ptrace_parms,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[ ++ int i = PTRACE_CONT; ++ ]])],pac_cv_has_ptrace_parms=yes, pac_cv_has_ptrace_parms=no) ++ ]) + if test "$pac_cv_has_ptrace_parms" = "yes" ; then + AC_DEFINE(HAVE_PTRACE_CONT,,[Define if ptrace parameters available]) + fi +@@ -76,15 +78,16 @@ fi + + # Look for alternatives. Is environ in unistd.h? + AC_CACHE_CHECK([for environ in unistd.h],pac_cv_has_environ_in_unistd,[ +-AC_TRY_COMPILE([#include ],[char **ep = environ;], +-pac_cv_has_environ_in_unistd=yes,pac_cv_has_environ_in_unistd=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[char **ep = environ;]])], ++ pac_cv_has_environ_in_unistd=yes,pac_cv_has_environ_in_unistd=no) ++]) + + if test "$pac_cv_has_environ_in_unistd" != "yes" ; then + # Can we declare it and use it? +- AC_CACHE_CHECK([for extern environ in runtime], +- pac_cv_has_extern_environ,[ +- AC_TRY_LINK([extern char **environ;],[char **ep = environ;], +- pac_cv_has_extern_environ=yes,pac_cv_has_extern_environ=no)]) ++ AC_CACHE_CHECK([for extern environ in runtime], pac_cv_has_extern_environ,[ ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char **environ;]],[[char **ep = environ;]])], ++ pac_cv_has_extern_environ=yes,pac_cv_has_extern_environ=no) ++ ]) + if test "$pac_cv_has_extern_environ" = "yes" ; then + AC_DEFINE(NEEDS_ENVIRON_DECL,1,[Define if environ decl needed] ) + fi +@@ -107,11 +110,14 @@ dnl Check for a specific header + AC_CHECK_HEADERS(sys/types.h signal.h sys/ptrace.h sys/uio.h unistd.h) + if test "$ac_cv_header_sys_uio_h" = "yes" ; then + # Test for iovec defined +- AC_CACHE_CHECK([whether struct iovec is defined in sys/uio.h], +- pac_cv_has_struct_iovec,[ +- AC_TRY_COMPILE([#include +-#include ],[struct iovec v],pac_cv_has_struct_iovec=yes, +-pac_cv_has_struct_iovec=no)]) ++ AC_CACHE_CHECK([whether struct iovec is defined in sys/uio.h], pac_cv_has_struct_iovec,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #include ++ ]],[[ ++ struct iovec v; ++ ]])], pac_cv_has_struct_iovec=yes, pac_cv_has_struct_iovec=no) ++ ]) + if test "$pac_cv_has_struct_iovec" = "yes" ; then + AC_DEFINE(HAVE_IOVEC_DEFINITION,1,[Define if struct iovec defined in sys/uio.h]) + fi +@@ -132,20 +138,28 @@ if test "$ac_cv_func_sigaction" = "yes" ; then + # Make sure that the fields that we need in sigaction are defined + AC_CACHE_CHECK([for struct sigaction and sa_handler], + pac_cv_struct_sigaction_with_sa_handler,[ +- AC_TRY_COMPILE([#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler=yes, +- pac_cv_struct_sigaction_with_sa_handler=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler=yes, ++ pac_cv_struct_sigaction_with_sa_handler=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler" = "no" ; then + AC_CACHE_CHECK([for struct sigaction and sa_handler with _POSIX_SOURCE], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ +- AC_TRY_COMPILE([#define _POSIX_SOURCE +-#include ],[ +-struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); +-act.sa_handler = SIG_IGN;], +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, +- pac_cv_struct_sigaction_with_sa_handler_needs_posix=no)]) ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #define _POSIX_SOURCE ++ #include ++ ]],[[ ++ struct sigaction act; sigaddset( &act.sa_mask, SIGINT ); ++ act.sa_handler = SIG_IGN; ++ ]])], ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=yes, ++ pac_cv_struct_sigaction_with_sa_handler_needs_posix=no) ++ ]) + if test "$pac_cv_struct_sigaction_with_sa_handler_needs_posix" = "yes" ; then + sigaction_ok=yes + fi +@@ -197,8 +211,9 @@ else + # (sys/select.h is POSIX) + if test "$ac_cv_header_sys_select_h" = yes ; then + AC_CACHE_CHECK([whether FD_ZERO works],pac_cv_fdzero_works,[ +- AC_TRY_LINK([#include ],[fd_set v; FD_ZERO(&v)], +- pac_cv_fdzero_works=yes,pac_cv_fdzero_works=no)]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[fd_set v; FD_ZERO(&v)]])], ++ pac_cv_fdzero_works=yes,pac_cv_fdzero_works=no) ++ ]) + if test "$pac_cv_fdzero_works" != yes ; then + AC_MSG_ERROR([Programs with FD_ZERO cannot be linked (check your system includes)]) + fi +@@ -214,16 +229,21 @@ AC_CHECK_FUNCS([sched_setaffinity sched_getaffinity bindprocessor thread_policy_ + if test "$ac_cv_func_sched_setaffinity" = "yes" ; then + # Test for the cpu process set type + AC_CACHE_CHECK([whether cpu_set_t available],pac_cv_have_cpu_set_t,[ +- AC_TRY_COMPILE( [ +-#include ],[ cpu_set_t t; ],pac_cv_have_cpu_set_t=yes,pac_cv_have_cpu_set_t=no)]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[cpu_set_t t;]])], ++ pac_cv_have_cpu_set_t=yes,pac_cv_have_cpu_set_t=no) ++ ]) + if test "$pac_cv_have_cpu_set_t" = yes ; then + AC_DEFINE(HAVE_CPU_SET_T,1,[Define if cpu_set_t is defined in sched.h]) + +- AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined], +- pac_cv_cpu_set_defined,[ +- AC_TRY_LINK( [ +-#include ],[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ], +- pac_cv_cpu_set_defined=yes,pac_cv_cpu_set_defined=no)]) ++ AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined], pac_cv_cpu_set_defined,[ ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ cpu_set_t t; ++ CPU_ZERO(&t); ++ CPU_SET(1,&t); ++ ]])], pac_cv_cpu_set_defined=yes,pac_cv_cpu_set_defined=no) ++ ]) + if test "$pac_cv_cpu_set_defined" = "yes" ; then + AC_DEFINE(HAVE_CPU_SET_MACROS,1,[Define if CPU_SET and CPU_ZERO defined]) + fi +@@ -232,13 +252,14 @@ if test "$ac_cv_func_sched_setaffinity" = "yes" ; then + fi + fi + if test "$ac_cv_func_thread_policy_set" = yes ; then +- AC_CACHE_CHECK([whether thread affinity macros defined], +- pac_cv_have_thread_affinity_policy,[ +- AC_TRY_COMPILE([#include ],[ +-#if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL) +- :'thread macros not defined +-],[pac_cv_have_thread_affinity_policy=yes], +- [pac_cv_have_thread_affinity_policy=no])]) ++ AC_CACHE_CHECK([whether thread affinity macros defined], pac_cv_have_thread_affinity_policy,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ ]],[[ ++ #if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL) ++ :'thread macros not defined ++ ]])],[pac_cv_have_thread_affinity_policy=yes], [pac_cv_have_thread_affinity_policy=no]) ++ ]) + if test "$pac_cv_have_thread_affinity_policy" = yes ; then + AC_DEFINE(HAVE_OSX_THREAD_AFFINITY,1,[Define is the OSX thread affinity policy macros defined]) + fi +@@ -248,17 +269,17 @@ AC_CHECK_HEADERS([string.h sys/time.h time.h stdlib.h sys/socket.h wait.h errno. + AC_CHECK_FUNCS(time) + # Check for socklen_t . + # (note the conditional inclusion of sys/socket.h) +-AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], +-pac_cv_have_socklen_t,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-typedef struct { double a; int b; } socklen_t;], +-[socklen_t a;a.a=1.0;], +-[pac_cv_have_socklen_t=no], +-[pac_cv_have_socklen_t=yes])]) ++AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], pac_cv_have_socklen_t,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ typedef struct { double a; int b; } socklen_t; ++ ]],[[ ++ socklen_t a;a.a=1.0; ++ ]])],[pac_cv_have_socklen_t=no],[pac_cv_have_socklen_t=yes]) ++]) + if test "$pac_cv_have_socklen_t" = yes ; then + AC_DEFINE([HAVE_SOCKLEN_T],1,[Define if socklen_t is available]) + fi +diff --git src/pmi/pmi2/simple/subconfigure.m4 src/pmi/pmi2/simple/subconfigure.m4 +index bae0cd8ba7e4..abea266f0adf 100644 +--- src/pmi/pmi2/simple/subconfigure.m4 ++++ src/pmi/pmi2/simple/subconfigure.m4 +@@ -58,24 +58,25 @@ fi + + # Check for socklen_t . If undefined, define it as int + # (note the conditional inclusion of sys/socket.h) +-AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], +-pac_cv_have_socklen_t,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-] +-typedef struct { double a; int b; } socklen_t;,[socklen_t a;a.a=1.0;],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes)]) ++AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], pac_cv_have_socklen_t,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ typedef struct { double a; int b; } socklen_t; ++ ]],[[ ++ socklen_t a;a.a=1.0; ++ ]])],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes) ++]) + if test "$pac_cv_have_socklen_t" = no ; then + AC_DEFINE(socklen_t,int,[Define if socklen_t is not defined]) + fi + # Check for h_addr or h_addr_list +-AC_CACHE_CHECK([whether struct hostent contains h_addr_list], +-pac_cv_have_haddr_list,[ +-AC_TRY_COMPILE([ +-#include ],[struct hostent hp;hp.h_addr_list[0]=0;], +-pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)]) ++AC_CACHE_CHECK([whether struct hostent contains h_addr_list], pac_cv_have_haddr_list,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[struct hostent hp;hp.h_addr_list[0]=0;]])], ++ pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no) ++]) + if test "$pac_cv_have_haddr_list" = "yes" ; then + AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list]) + fi +diff --git src/pmi/pmi2/subconfigure.m4 src/pmi/pmi2/subconfigure.m4 +index cf961d79adf0..23889eb4b69d 100644 +--- src/pmi/pmi2/subconfigure.m4 ++++ src/pmi/pmi2/subconfigure.m4 +@@ -61,24 +61,25 @@ fi + + # Check for socklen_t . If undefined, define it as int + # (note the conditional inclusion of sys/socket.h) +-AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], +-pac_cv_have_socklen_t,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-] +-typedef struct { double a; int b; } socklen_t;,[socklen_t a;a.a=1.0;],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes)]) ++AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], pac_cv_have_socklen_t,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ typedef struct { double a; int b; } socklen_t; ++ ]],[[ ++ socklen_t a;a.a=1.0; ++ ]])],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes) ++]) + if test "$pac_cv_have_socklen_t" = no ; then + AC_DEFINE(socklen_t,int,[Define if socklen_t is not defined]) + fi + # Check for h_addr or h_addr_list +-AC_CACHE_CHECK([whether struct hostent contains h_addr_list], +-pac_cv_have_haddr_list,[ +-AC_TRY_COMPILE([ +-#include ],[struct hostent hp;hp.h_addr_list[0]=0;], +-pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)]) ++AC_CACHE_CHECK([whether struct hostent contains h_addr_list], pac_cv_have_haddr_list,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[struct hostent hp;hp.h_addr_list[0]=0;]])], ++ pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no) ++]) + if test "$pac_cv_have_haddr_list" = "yes" ; then + AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list]) + fi +diff --git src/pmi/simple/subconfigure.m4 src/pmi/simple/subconfigure.m4 +index 30351791a748..ea8e55011fc6 100644 +--- src/pmi/simple/subconfigure.m4 ++++ src/pmi/simple/subconfigure.m4 +@@ -55,24 +55,26 @@ fi + + # Check for socklen_t . If undefined, define it as int + # (note the conditional inclusion of sys/socket.h) +-AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], +-pac_cv_have_socklen_t,[ +-AC_TRY_COMPILE([ +-#include +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-] +-typedef struct { double a; int b; } socklen_t;,[socklen_t a;a.a=1.0;],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes)]) ++AC_CACHE_CHECK([whether socklen_t is defined (in sys/socket.h if present)], pac_cv_have_socklen_t,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ #ifdef HAVE_SYS_SOCKET_H ++ #include ++ #endif ++ ++ typedef struct { double a; int b; } socklen_t; ++ ]],[[ ++ socklen_t a;a.a=1.0; ++ ]])],pac_cv_have_socklen_t=no,pac_cv_have_socklen_t=yes) ++]) + if test "$pac_cv_have_socklen_t" = no ; then + AC_DEFINE(socklen_t,int,[Define if socklen_t is not defined]) + fi + # Check for h_addr or h_addr_list +-AC_CACHE_CHECK([whether struct hostent contains h_addr_list], +-pac_cv_have_haddr_list,[ +-AC_TRY_COMPILE([ +-#include ],[struct hostent hp;hp.h_addr_list[0]=0;], +-pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no)]) ++AC_CACHE_CHECK([whether struct hostent contains h_addr_list], pac_cv_have_haddr_list,[ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[struct hostent hp;hp.h_addr_list[0]=0;]])], ++ pac_cv_have_haddr_list=yes,pac_cv_have_haddr_list=no) ++]) + if test "$pac_cv_have_haddr_list" = "yes" ; then + AC_DEFINE(HAVE_H_ADDR_LIST,1,[Define if struct hostent contains h_addr_list]) + fi diff --git a/mpi-coll-missing-return.patch b/mpi-coll-missing-return.patch new file mode 100644 index 0000000..e5381e3 --- /dev/null +++ b/mpi-coll-missing-return.patch @@ -0,0 +1,24 @@ +commit 1e07f003ee3733b81f2de405a525214b12b597fc +Author: Nicolas Morey +Date: Tue Nov 21 13:20:55 2023 +0100 + + mpi: coll: missing return + + Change to void to avoid: + src/mpi/coll/shmem/mvp_shmem_coll.c:1802:1: error: no return statement in function returning non-void [-Werror=return-type] + + Signed-off-by: Nicolas Morey + +diff --git src/mpi/coll/shmem/mvp_shmem_coll.c src/mpi/coll/shmem/mvp_shmem_coll.c +index 48ab6d3b1e52..5c5d071081eb 100644 +--- src/mpi/coll/shmem/mvp_shmem_coll.c ++++ src/mpi/coll/shmem/mvp_shmem_coll.c +@@ -1765,7 +1765,7 @@ fn_fail: + } + + /* Change the values set inside the array by the one define by the user */ +-static inline int tuning_runtime_init() ++static inline void tuning_runtime_init() + { + int i; + diff --git a/mpl-warnings-missing-return.patch b/mpl-warnings-missing-return.patch new file mode 100644 index 0000000..930025d --- /dev/null +++ b/mpl-warnings-missing-return.patch @@ -0,0 +1,20 @@ +commit 39096ab6d56d4c84eb5195ed59e5575b50212d99 +Author: Hui Zhou +Date: Thu Aug 13 14:28:10 2020 -0500 + + mpl/warnings: missing return + + warning by pgi compiler + +diff --git src/mpl/src/sock/mpl_sockaddr.c src/mpl/src/sock/mpl_sockaddr.c +index c0e991c68d85..d459684e4c6a 100644 +--- src/mpl/src/sock/mpl_sockaddr.c ++++ src/mpl/src/sock/mpl_sockaddr.c +@@ -140,6 +140,7 @@ int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr) + return 0; + } else { + assert(0); ++ return -1; + } + } + diff --git a/mvapich-3.0.tar.gz b/mvapich-3.0.tar.gz new file mode 100644 index 0000000..7cc7dd0 --- /dev/null +++ b/mvapich-3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee076c4e672d18d6bf8dd2250e4a91fa96aac1db2c788e4572b5513d86936efb +size 38303499 diff --git a/mvapich-3.0b.tar.gz b/mvapich-3.0b.tar.gz deleted file mode 100644 index 189311d..0000000 --- a/mvapich-3.0b.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:52d8a742e16eef69e944754fea7ebf8ba4ac572dac67dbda528443d9f32547cc -size 38232677 diff --git a/mvapich3-s390_get_cycles.patch b/mvapich3-s390_get_cycles.patch new file mode 100644 index 0000000..f63c39e --- /dev/null +++ b/mvapich3-s390_get_cycles.patch @@ -0,0 +1,27 @@ +commit e83d26fa6213f1ec9c506c43029ed243f89cd63e +Author: Nicolas Morey-Chaisemartin +Date: Thu Jun 8 15:11:12 2017 +0200 + + mvapich3-s390_get_cycles + + Signed-off-by: Nicolas Morey-Chaisemartin + +diff --git src/mpid/ch3/channels/common/include/mvp_clock.h src/mpid/ch3/channels/common/include/mvp_clock.h +index 2f7e08ede22f..38bc906d3e67 100644 +--- src/mpid/ch3/channels/common/include/mvp_clock.h ++++ src/mpid/ch3/channels/common/include/mvp_clock.h +@@ -93,6 +93,14 @@ static inline cycles_t get_cycles() + return ret; + } + ++#elif defined(__s390__) || defined(__s390x__) ++typedef unsigned long cycles_t; ++static inline cycles_t get_cycles() ++{ ++ unsigned long clk; ++ asm volatile("stck %0" : "=Q" (clk) : : "cc"); ++ return clk >> 2; ++} + #else + #warning get_cycles not implemented for this architecture: attempt asm/timex.h + #include diff --git a/mvapich3.changes b/mvapich3.changes index 6c679f2..654429c 100644 --- a/mvapich3.changes +++ b/mvapich3.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Tue Feb 20 13:54:55 UTC 2024 - Nicolas Morey + +- Update to v3.0 GA +- Cleanup spec file + - standard flavour has been removed and has been replaced by the ucx flavour + - Drop 32b arch support + - Disable static libraries for non-HPC build + - No need to pull ucx nor libfabric-devel for mvapich3-devel +- Replace 0001-fix-control-reaches-end-of-non-void-function.patch with upstream: + - mpi-coll-missing-return.patch + - mpl-warnings-missing-return.patch +- Add: + - mvapich3-s390_get_cycles.patch for s390 support + - pass-correct-size-to-snprintf.patch to fix potential overflows + - autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch to fix + libfabric sub dependencies being unnecessary pulled + - config-replace-AC_TRY_-COMPILE-LINK-RUN.patch to replace osolete + autoconf macros + ------------------------------------------------------------------- Mon Aug 7 16:59:30 UTC 2023 - Nicolas Morey diff --git a/mvapich3.spec b/mvapich3.spec index 672058f..63f4577 100644 --- a/mvapich3.spec +++ b/mvapich3.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,21 +18,26 @@ %global flavor @BUILD_FLAVOR@%{nil} +# Static libraries are disabled by default +# for non HPC builds +# To enable them, simply uncomment: +# % define build_static_devel 1 + %define pname mvapich3 -%define vers 3.0b -%define _vers 3_0_b -%define rc_ver -1 +%define vers 3.0 +%define _vers 3_0 +%define rc_ver %nil %if "%{flavor}" == "" ExclusiveArch: do_not_build %{bcond_with hpc} %endif -%if "%{flavor}" == "standard" +%if "%{flavor}" == "ucx" %define build_flavor ucx %{bcond_with hpc} %endif -%if "%{flavor}" == "testsuite" +%if "%{flavor}" == "ucx-testsuite" %define build_flavor ucx %define testsuite 1 %{bcond_with hpc} @@ -48,17 +53,11 @@ ExclusiveArch: do_not_build %{bcond_with hpc} %endif -%if "%flavor" == "gnu-hpc" +%if "%flavor" == "gnu-hpc-ucx" %define compiler_family gnu %undefine c_f_ver %define build_flavor ucx -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu-hpc-testsuite" -%define compiler_family gnu -%undefine c_f_ver -%define testsuite 1 -%define build_flavor ucx +%define build_static_devel 1 %{bcond_without hpc} %endif @@ -69,25 +68,12 @@ ExclusiveArch: do_not_build %define build_static_devel 1 %{bcond_without hpc} %endif -%if "%flavor" == "gnu-hpc-ofi-testsuite" -%define compiler_family gnu -%undefine c_f_ver -%define testsuite 1 -%define build_flavor ofi -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu7-hpc" +%if "%flavor" == "gnu7-hpc-ucx" %define compiler_family gnu %define c_f_ver 7 %define build_flavor ucx -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu7-hpc-testsuite" -%define compiler_family gnu -%define c_f_ver 7 -%define testsuite 1 -%define build_flavor ucx +%define build_static_devel 1 %{bcond_without hpc} %endif @@ -98,25 +84,12 @@ ExclusiveArch: do_not_build %define build_static_devel 1 %{bcond_without hpc} %endif -%if "%flavor" == "gnu7-hpc-ofi-testsuite" -%define compiler_family gnu -%define c_f_ver 7 -%define testsuite 1 -%define build_flavor ofi -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu8-hpc" +%if "%flavor" == "gnu8-hpc-ucx" %define compiler_family gnu %define c_f_ver 8 %define build_flavor ucx -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu8-hpc-testsuite" -%define compiler_family gnu -%define c_f_ver 8 -%define testsuite 1 -%define build_flavor ucx +%define build_static_devel 1 %{bcond_without hpc} %endif @@ -128,25 +101,11 @@ ExclusiveArch: do_not_build %{bcond_without hpc} %endif -%if "%flavor" == "gnu8-hpc-ofi-testsuite" -%define compiler_family gnu -%define c_f_ver 8 -%define testsuite 1 -%define build_flavor ofi -%{bcond_without hpc} -%endif - -%if "%flavor" == "gnu9-hpc" +%if "%flavor" == "gnu9-hpc-ucx" %define compiler_family gnu %define c_f_ver 9 %define build_flavor ucx -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu9-hpc-testsuite" -%define compiler_family gnu -%define c_f_ver 9 -%define testsuite 1 -%define build_flavor ucx +%define build_static_devel 1 %{bcond_without hpc} %endif @@ -157,46 +116,24 @@ ExclusiveArch: do_not_build %define build_static_devel 1 %{bcond_without hpc} %endif -%if "%flavor" == "gnu9-hpc-ofi-testsuite" -%define compiler_family gnu -%define c_f_ver 9 -%define testsuite 1 -%define build_flavor ofi -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu10-hpc" +%if "%flavor" == "gnu10-hpc-ucx" %define compiler_family gnu %define c_f_ver 10 %define build_flavor ucx -%{bcond_without hpc} -%endif -%if "%flavor" == "gnu10-hpc-testsuite" -%define compiler_family gnu -%define c_f_ver 10 -%define testsuite 1 -%define build_flavor ucx +%define build_static_devel 1 %{bcond_without hpc} %endif %if "%flavor" == "gnu10-hpc-ofi" %define compiler_family gnu %define c_f_ver 10 -%define build_flavor ofi +%define build_flavor psm2 %define build_static_devel 1 %{bcond_without hpc} %endif -%if "%flavor" == "gnu10-hpc-ofi-testsuite" -%define compiler_family gnu -%define c_f_ver 10 -%define testsuite 1 -%define build_flavor ofi -%{bcond_without hpc} -%endif -%if "%{build_flavor}" != "ucx" %define pack_suff %{?build_flavor:-%{build_flavor}} -%endif %if %{without hpc} %define module_name mvapich3%{?pack_suff} @@ -242,20 +179,31 @@ License: BSD-3-Clause Group: Development/Libraries/Parallel Version: %{vers} Release: 0 -Source0: http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich-%{version}.tar.gz +Source0: http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich-%{version}%{?rc_ver}.tar.gz Source1: mpivars.sh Source2: mpivars.csh Source3: macros.hpc-mvapich3 Source100: _multibuild -Patch1: 0001-fix-control-reaches-end-of-non-void-function.patch +Patch0: mvapich3-s390_get_cycles.patch +Patch1: pass-correct-size-to-snprintf.patch +# Backport from mpich +Patch2: mpl-warnings-missing-return.patch +Patch3: mpi-coll-missing-return.patch +Patch4: autoconf-pull-dynamic-and-not-static-libs-from-pkg-config.patch +Patch5: config-replace-AC_TRY_-COMPILE-LINK-RUN.patch + URL: http://mvapich.cse.ohio-state.edu BuildRoot: %{_tmppath}/%{name}-%{version}-build +# Exclude 32b archs +ExcludeArch: %{arm} %ix86 %if %{without skip_hpc_build} ExclusiveArch: do_not_build %endif BuildRequires: autoconf +BuildRequires: autoconf +BuildRequires: automake BuildRequires: automake BuildRequires: bison BuildRequires: flex @@ -263,10 +211,10 @@ BuildRequires: hwloc-devel >= 2.0 %ifnarch s390 s390x %{arm} BuildRequires: libnuma-devel %endif -BuildRequires: libnl3-devel BuildRequires: libtool -BuildRequires: libuuid-devel +BuildRequires: libtool BuildRequires: sysfsutils +BuildRequires: python3 %if %{without hpc} BuildRequires: gcc-c++ BuildRequires: gcc-fortran @@ -282,29 +230,18 @@ BuildRequires: hwloc-devel %if %{with pmix} BuildRequires: pmix-devel %endif -%if "%{build_flavor}" == "ofi" +%if "%{build_flavor}" == "ofi" && %{with skip_hpc_build} BuildRequires: libfabric-devel -%ifarch x86_64 -BuildRequires: libpsm2-devel %endif -BuildRequires: libibverbs-devel -BuildRequires: librdmacm-devel -%endif - %if "%{build_flavor}" == "ucx" -BuildRequires: libucm-devel >= 1.7.0 -BuildRequires: libucp-devel >= 1.7.0 -BuildRequires: libucs-devel >= 1.7.0 -BuildRequires: libuct-devel >= 1.7.0 +BuildRequires: libucm-devel +BuildRequires: libucp-devel +BuildRequires: libucs-devel +BuildRequires: libuct-devel # UCX is only available for 64b archs ExcludeArch: %ix86 %arm %endif -# Temporary: armv7 is broken due to Fortran Float issues -ExcludeArch: %arm - -BuildRequires: python3 - %if %{without hpc} Requires: mpi-selector %else @@ -312,8 +249,8 @@ Requires: mpi-selector %endif %description -This is an MPI-3 implementation which includes all MPI-1 features. It -is based on MPICH2 and MVICH. +This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It +is based on MPICH3 and MVICH. %{!?testsuite:%{?with_hpc:%{hpc_master_package -a -L}}} @@ -323,15 +260,6 @@ is based on MPICH2 and MVICH. Summary: OSU MVAPICH3 MPI package Group: Development/Libraries/Parallel Requires: %{name} = %{version} -%if "%{build_flavor}" == "ofi" -Requires: libfabric-devel -%endif -%if "%{build_flavor}" == "ucx" -Requires: libucm-devel >= 1.7.0 -Requires: libucp-devel >= 1.7.0 -Requires: libucs-devel >= 1.7.0 -Requires: libuct-devel >= 1.7.0 -%endif %if %{without hpc} Requires: gcc-c++ Requires: gcc-fortran @@ -340,11 +268,12 @@ Requires: gcc-fortran %endif %description devel -This is an MPI-2 implementation which includes all MPI-1 features. It -is based on MPICH2 and MVICH. +This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It +is based on MPICH3 and MVICH. %{?with_hpc:%{hpc_master_package -a devel}} +%if 0%{?build_static_devel} %package devel-static Summary: OSU MVAPICH3 MPI package - static libraries Group: Development/Libraries/Parallel @@ -352,7 +281,8 @@ Requires: %{name}-devel = %{version} %description devel-static This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It -is based on MPICH2 and MVICH. This package contains the static libraries +is based on MPICH3. This package contains the static libraries +%endif %package doc Summary: OSU MVAPICH3 MPI package - Documentation @@ -361,7 +291,7 @@ Requires: %{name} = %{version} %description doc This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It -is based on MPICH2 and MVICH. This package contains the static libraries +is based on MPICH3 and MVICH. This package contains the static libraries %{?with_hpc:%{hpc_master_package doc}} @@ -383,12 +313,11 @@ is based on MPICH2 and MVICH. This package contains the static libraries %prep %{?with_hpc:%hpc_debug} -%setup -q -n mvapich-%{version} -%patch1 -p1 -# usually done by autogen.sh -cp src/mpl/src/sock/mpl_sockaddr.c src/mpi/romio/mpl/src/sock/mpl_sockaddr.c -cp src/mpl/src/sock/mpl_sockaddr.c src/pm/hydra/mpl/src/sock/mpl_sockaddr.c -cp src/mpl/src/sock/mpl_sockaddr.c src/pm/hydra2/mpl/src/sock/mpl_sockaddr.c +%setup -q -n mvapich-%{version}%{?rc_ver} +%autopatch -p0 + +cp /usr/share/automake*/config.* . + %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects @@ -398,7 +327,7 @@ cp src/mpl/src/sock/mpl_sockaddr.c src/pm/hydra2/mpl/src/sock/mpl_sockaddr.c export FFLAGS="-fallow-argument-mismatch $FFLAGS" %endif -# disabled - creates broken configure script - ./autogen.sh +./autogen.sh --without-ucx --without-ofi %if %{with hpc} %{hpc_setup} %{hpc_configure} \ @@ -412,11 +341,10 @@ export FFLAGS="-fallow-argument-mismatch $FFLAGS" --libdir=%{p_libdir} \ --libexecdir=%{p_libexecdir} \ --mandir=%{p_mandir} \ - --with-device=ch4:ofi \ %endif --docdir=%{_datadir}/doc/%{name} \ + --disable-rpath \ --disable-wrapper-rpath \ - --enable-yield=sched_yield \ %if %{with hwloc} --with-hwloc-prefix=%{_prefix} \ %endif @@ -458,6 +386,11 @@ rm -f %{buildroot}%{p_libdir}/libfmpich.la \ %{buildroot}%{p_libdir}/libmpi.la \ %{buildroot}%{p_libdir}/libmpicxx.la \ %{buildroot}%{p_libdir}/libmpifort.la + +%if !0%{?build_static_devel} +find %{buildroot} -name "*.a" -delete +%endif + install -m 0755 -d %{buildroot}%{_datadir}/doc/%{name} install -m 0644 COPYRIGHT* %{buildroot}%{_datadir}/doc/%{name} install -m 0644 CHANGE* %{buildroot}%{_datadir}/doc/%{name} @@ -563,6 +496,7 @@ fi %files %defattr(-, root, root) +%doc CHANGES CHANGELOG COPYRIGHT README README.envvar README-MVAPICH README_MVP.envvar %if %{without hpc} %dir /usr/%_lib/mpi %dir /usr/%_lib/mpi/gcc @@ -573,8 +507,6 @@ fi %hpc_mpi_dirs %hpc_modules_files %endif -%doc %{_datadir}/doc/%{name}/COPYRIGHT* -%doc %{_datadir}/doc/%{name}/CHANGE* %dir %{p_prefix} %dir %{p_bindir} %dir %{p_datadir} @@ -594,17 +526,22 @@ fi %doc %{_datadir}/doc/%{name} %exclude /%{_datadir}/doc/%{name}/COPYRIGHT* %exclude /%{_datadir}/doc/%{name}/CHANGE* +%exclude /%{_datadir}/doc/%{name}/README* %files devel %defattr(-,root,root) -%{p_libdir}/pkgconfig +%dir %{p_libdir}/pkgconfig %{p_mandir}/man3/* %{p_includedir} %{p_libdir}/*.so +%{p_libdir}/pkgconfig/mvapich.pc +%{p_libdir}/pkgconfig/yaksa.pc +%if 0%{?build_static_devel} %files devel-static %defattr(-,root,root) %{p_libdir}/*.a +%endif %if %{with hpc} %files macros-devel diff --git a/pass-correct-size-to-snprintf.patch b/pass-correct-size-to-snprintf.patch new file mode 100644 index 0000000..750d689 --- /dev/null +++ b/pass-correct-size-to-snprintf.patch @@ -0,0 +1,261 @@ +commit 8a3405cf8d4e5a95bc46a7c518c1fd2809cf5417 +Author: Nicolas Morey +Date: Fri Nov 10 10:59:04 2023 +0100 + + pass correct size to snprintf + + Fix potential buffer overflows (required to make 'sundials' testsuite pass) + + Signed-off-by: Nicolas Morey + +diff --git src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c +index 45a31c7ab228..fd4e1d92f1bf 100644 +--- src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c ++++ src/mpid/ch3/channels/common/src/affinity/hwloc_bind.c +@@ -2245,7 +2245,7 @@ int smpi_identify_free_cores(hwloc_cpuset_t *sock_cpuset, + for (i = 0; i < g_smpi.num_local_nodes; ++i) { + hwloc_bitmap_clr(*free_sock_cpuset, local_core_ids[i]); + } +- hwloc_bitmap_snprintf(cpu_str, 128, *free_sock_cpuset); ++ hwloc_bitmap_snprintf(cpu_str, sizeof(cpu_str), *free_sock_cpuset); + PRINT_DEBUG(DEBUG_INIT_verbose, "Free sock_cpuset = %s\n", cpu_str); + } + +@@ -3386,12 +3386,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (i = 0; i < local_procs; i++) { + curr = count; + for (k = 0; k < num_app_threads; k++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[curr]); + curr = (curr + 1) % num_pu; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + count = (count + hw_threads_per_core) % num_pu; + } + } else if (mvp_hybrid_binding_policy == HYBRID_LINEAR) { +@@ -3400,7 +3400,7 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + * physical resources */ + for (i = 0; i < local_procs; i++) { + for (k = 0; k < num_app_threads; k++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[curr]); + + curr = ((curr + hw_threads_per_core) >= num_pu) ? +@@ -3408,7 +3408,7 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + (curr + hw_threads_per_core) % num_pu; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + } else if (mvp_hybrid_binding_policy == HYBRID_SPREAD) { + #if defined(CHANNEL_MRAIL) +@@ -3432,12 +3432,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (k = curr; k < curr + chunk; k++) { + for (l = 0; l < hw_threads_per_core; l++) { + j += +- snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k * hw_threads_per_core + l]); + } + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + curr = (curr + chunk) % size; + } + } else { +@@ -3454,11 +3454,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (k = curr; k < curr + ranks_per_sock; k++) { + for (l = 0; l < hw_threads_per_core; l++) { + j += +- snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k * hw_threads_per_core + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + curr = (curr + + ((num_pu_per_socket / hw_threads_per_core) * chunk)) % +@@ -3470,12 +3470,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + * socket followed by second secket */ + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k]); + k = (k + hw_threads_per_core) % size; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + } else if (mvp_hybrid_binding_policy == HYBRID_SCATTER) { + #if defined(CHANNEL_MRAIL) +@@ -3495,11 +3495,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + } + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[node_base_pu + node_offset + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + node_base_pu = (node_base_pu + num_pu_per_socket) % size; + /* + * when wrapping around to the first socket, advance the offset +@@ -3541,11 +3541,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { + j += snprintf( +- mapping + j, _POSIX2_LINE_MAX, "%d,", ++ mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map_per_numa[node_base_pu + node_offset + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + node_base_pu = (node_base_pu + num_pu_per_numanode) % size; + /* + * when wrapping around to the first numa, advance the offset +diff --git src/mpid/ch4/netmod/mvp/hwloc_bind.c src/mpid/ch4/netmod/mvp/hwloc_bind.c +index 44e867b6b19f..4440d4739dc0 100644 +--- src/mpid/ch4/netmod/mvp/hwloc_bind.c ++++ src/mpid/ch4/netmod/mvp/hwloc_bind.c +@@ -2145,7 +2145,7 @@ int smpi_identify_free_cores(hwloc_cpuset_t *sock_cpuset, + for (i = 0; i < mvp_smp_info.num_local_nodes; ++i) { + hwloc_bitmap_clr(*free_sock_cpuset, local_core_ids[i]); + } +- hwloc_bitmap_snprintf(cpu_str, 128, *free_sock_cpuset); ++ hwloc_bitmap_snprintf(cpu_str, sizeof(cpu_str), *free_sock_cpuset); + PRINT_DEBUG(DEBUG_INIT_verbose, "Free sock_cpuset = %s\n", cpu_str); + } + +@@ -3273,7 +3273,7 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + /* one app thread or enough phsyical cores for all threads */ + for (i = 0; i < local_procs; i++) { + for (k = 0; k < num_app_threads; k++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[curr]); + + curr = +@@ -3282,7 +3282,7 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + (curr + hw_threads_per_core) % num_pu; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + } else { + /* +@@ -3292,12 +3292,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (i = 0; i < local_procs; i++) { + curr = count; + for (k = 0; k < num_app_threads; k++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[curr]); + curr = (curr + 1) % num_pu; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + count = (count + hw_threads_per_core) % num_pu; + } + } +@@ -3326,12 +3326,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (i = 0; i < local_procs; i++) { + curr = count; + for (k = 0; k < num_app_threads; k++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[curr]); + curr = (curr + 1) % num_pu; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + count = (count + hw_threads_per_core) % num_pu; + } + break; +@@ -3359,12 +3359,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (k = curr; k < curr + chunk; k++) { + for (l = 0; l < hw_threads_per_core; l++) { + j += snprintf( +- mapping + j, _POSIX2_LINE_MAX, "%d,", ++ mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k * hw_threads_per_core + l]); + } + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + curr = (curr + chunk) % size; + } + } else { +@@ -3381,11 +3381,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + for (k = curr; k < curr + ranks_per_sock; k++) { + for (l = 0; l < hw_threads_per_core; l++) { + j += snprintf( +- mapping + j, _POSIX2_LINE_MAX, "%d,", ++ mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k * hw_threads_per_core + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + curr = (curr + ((num_pu_per_socket / hw_threads_per_core) * + chunk)) % +@@ -3398,12 +3398,12 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + * first socket followed by second secket. */ + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[k]); + k = (k + hw_threads_per_core) % size; + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + } + break; + case MVP_HYBRID_BINDING_POLICY_SCATTER: +@@ -3425,11 +3425,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + } + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[node_base_pu + node_offset + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + node_base_pu = (node_base_pu + num_pu_per_socket) % size; + /* + * when wrapping around to the first socket, advance the offset +@@ -3468,11 +3468,11 @@ static int mvp_generate_implicit_cpu_mapping(int local_procs, + * domains in round-robin fashion. */ + for (i = 0; i < local_procs; i++) { + for (l = 0; l < num_app_threads; l++) { +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, "%d,", ++ j += snprintf(mapping + j, sizeof(mapping)-j, "%d,", + mvp_core_map[node_base_pu + node_offset + l]); + } + mapping[--j] = '\0'; +- j += snprintf(mapping + j, _POSIX2_LINE_MAX, ":"); ++ j += snprintf(mapping + j, sizeof(mapping)-j, ":"); + node_base_pu = (node_base_pu + num_pu_per_numanode) % size; + /* + * when wrapping around to the first numa, advance the offset