From 0dd08f348e6d1d9e24eacc14a563b93a510f3e11 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 23 Dec 2021 21:23:09 +0300 Subject: Replace obsolete AC_TRY_COMPILE/LINK/RUN in configure.ac (refactoring) * configure.ac (AC_TRY_COMPILE): Replace with AC_COMPILE_IFELSE(AC_LANG_SOURCE) or AC_COMPILE_IFELSE(AC_LANG_PROGRAM). * configure.ac (AC_TRY_LINK): Replace with AC_LINK_IFELSE(AC_LANG_PROGRAM); reformat code. * configure.ac (AC_TRY_RUN): Replace with AC_RUN_IFELSE(AC_LANG_SOURCE). --- configure.ac | 98 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 51 insertions(+), 47 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 10565572..7ccca2ea 100644 --- a/configure.ac +++ b/configure.ac @@ -86,10 +86,10 @@ esac AC_MSG_CHECKING([for emscripten]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ -#ifdef __EMSCRIPTEN__ -#error "this is emscripten" -#endif -]])], [emscripten=no], [emscripten=yes]) +# ifdef __EMSCRIPTEN__ +# error "this is emscripten" +# endif + ]])], [emscripten=no], [emscripten=yes]) # Note -s ASYNCIFY is required to scan the stack, ASYNCIFY_STACK_SIZE is # probably needed for gctest only. AS_IF([test "x$emscripten" = "xyes"], @@ -366,15 +366,15 @@ if test "$GCC" = yes; then AC_MSG_CHECKING([whether compiler supports -Wextra]) old_CFLAGS="$CFLAGS" CFLAGS="-Wextra $CFLAGS" - AC_TRY_COMPILE([],[], [ac_cv_cc_wextra=yes], [ac_cv_cc_wextra=no]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], + [ac_cv_cc_wextra=yes], [ac_cv_cc_wextra=no]) CFLAGS="$old_CFLAGS" AC_MSG_RESULT($ac_cv_cc_wextra) AS_IF([test "$ac_cv_cc_wextra" = yes], [WEXTRA="-Wextra"], [WEXTRA="-W"]) AC_MSG_CHECKING([whether compiler supports -Wpedantic]) CFLAGS="-Wpedantic -Wno-long-long $CFLAGS" - AC_TRY_COMPILE([],[ - extern int quiet; - ], [ac_cv_cc_pedantic=yes], [ac_cv_cc_pedantic=no]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[extern int quiet;]])], + [ac_cv_cc_pedantic=yes], [ac_cv_cc_pedantic=no]) CFLAGS="$old_CFLAGS" AC_MSG_RESULT($ac_cv_cc_pedantic) WPEDANTIC= @@ -385,11 +385,11 @@ if test "$GCC" = yes; then fi AC_MSG_CHECKING(for xlc) -AC_TRY_COMPILE([],[ - #ifndef __xlC__ - # error - #endif -], [compiler_xlc=yes], [compiler_xlc=no]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +# ifndef __xlC__ +# error +# endif + ]])], [compiler_xlc=yes], [compiler_xlc=no]) AC_MSG_RESULT($compiler_xlc) if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then # the darwin stack-frame-walking code is completely broken on xlc @@ -417,10 +417,11 @@ if test "$GCC" = yes; then if test "$ac_cv_fno_strict_aliasing" != skipped; then old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-strict-aliasing" - AC_TRY_COMPILE([],[], [ac_cv_fno_strict_aliasing=yes], []) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], + [ac_cv_fno_strict_aliasing=yes]) CFLAGS="$old_CFLAGS" AS_IF([test "$ac_cv_fno_strict_aliasing" = yes], - [CFLAGS="$CFLAGS -fno-strict-aliasing"], []) + [CFLAGS="$CFLAGS -fno-strict-aliasing"]) fi AC_MSG_RESULT($ac_cv_fno_strict_aliasing) fi @@ -549,8 +550,8 @@ if test "${enable_shared}" != no -a "${enable_static}" != yes; then AC_MSG_CHECKING([whether compiler supports -fvisibility]) old_CFLAGS="$CFLAGS" CFLAGS="-Werror -fvisibility=hidden $CFLAGS" - AC_TRY_COMPILE([],[], [ac_cv_fvisibility_hidden=yes], - [ac_cv_fvisibility_hidden=no]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], + [ac_cv_fvisibility_hidden=yes], [ac_cv_fvisibility_hidden=no]) CFLAGS="$old_CFLAGS" AS_IF([test "$ac_cv_fvisibility_hidden" = yes], [CFLAGS="-DGC_VISIBILITY_HIDDEN_SET -fvisibility=hidden $CFLAGS"], @@ -752,9 +753,9 @@ AC_MSG_CHECKING([whether -Wno-frame-address works]) use_wno_error_frame_address=no old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror -Wno-frame-address $CFLAGS_EXTRA" -AC_TRY_COMPILE([], [{ - if (!__builtin_return_address(1)) return 1; -}], [ use_wno_error_frame_address=yes ]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [if (!__builtin_return_address(1)) return 1;])], + [use_wno_error_frame_address=yes]) CFLAGS="$old_CFLAGS" AC_MSG_RESULT($use_wno_error_frame_address) if test x"$use_wno_error_frame_address" = xyes; then @@ -766,12 +767,13 @@ AC_MSG_CHECKING(for dladdr) have_dladdr=no old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $CFLAGS_EXTRA" -AC_TRY_COMPILE([ -#define _GNU_SOURCE 1 -#include ], [{ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +# define _GNU_SOURCE 1 +# include + ], [ Dl_info info; (void)dladdr("", &info); -}], [ have_dladdr=yes ]) + ])], [have_dladdr=yes]) CFLAGS="$old_CFLAGS" AC_MSG_RESULT($have_dladdr) if test x"$have_dladdr" = xyes; then @@ -782,8 +784,8 @@ fi AC_MSG_CHECKING(for sigsetjmp) old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $CFLAGS_EXTRA" -AC_TRY_LINK([#include ], - [sigjmp_buf t; sigsetjmp(t, 0)], +AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [sigjmp_buf t; sigsetjmp(t, 0)])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_DEFINE([GC_NO_SIGSETJMP], [1], [Missing sigsetjmp function.])]) @@ -794,25 +796,25 @@ AS_IF([test "$THREADS" = posix], [AC_MSG_CHECKING(for pthread_setname_np) old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror" - AC_TRY_COMPILE([#include ], - [pthread_setname_np("thread-name")], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [pthread_setname_np("thread-name")])], [AC_MSG_RESULT([yes (w/o tid)]) AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID], [1], [Define to use 'pthread_setname_np(const char*)' function.])], - [AC_TRY_COMPILE([#include ], - [pthread_setname_np(pthread_self(), "thread-name-%u", 0)], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [pthread_setname_np(pthread_self(), "thread-name-%u", 0)])], [AC_MSG_RESULT([yes (with tid and arg)]) AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG], [1], [Define to use 'pthread_setname_np(pthread_t, const char*, void *)' function.])], - [AC_TRY_COMPILE([ -#ifdef __CYGWIN__ -#define _GNU_SOURCE 1 -#elif defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) -#define _GNU_SOURCE 1 -#endif -#include ], - [pthread_setname_np(pthread_self(), "thread-name")], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +# ifdef __CYGWIN__ +# define _GNU_SOURCE 1 +# elif defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +# define _GNU_SOURCE 1 +# endif +# include + ], [pthread_setname_np(pthread_self(), "thread-name")])], [AC_MSG_RESULT([yes (with tid)]) AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID], [1], [Define to use 'pthread_setname_np(pthread_t, const char*)' @@ -1041,7 +1043,7 @@ if test x"$with_libatomic_ops" = xcheck; then old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $CFLAGS_EXTRA -DGC_BUILTIN_ATOMIC" CFLAGS="$CFLAGS -I${srcdir}/include -I${srcdir}/tests" - AC_TRY_RUN([#include "test_atomic_ops.c"], + AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "test_atomic_ops.c"]])], [AC_MSG_RESULT(yes) with_libatomic_ops=none], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(skipped because cross-compiling)]) @@ -1111,18 +1113,18 @@ AS_IF([test x$with_libatomic_ops != xnone -a x$need_atomic_ops_asm != xtrue], [ old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $AO_TRYLINK_CFLAGS $CFLAGS_EXTRA" AC_MSG_CHECKING([for lock-free AO_or primitive]) - AC_TRY_LINK([#include "atomic_ops.h"], - [AO_t x=0;AO_or(&x,1)], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "atomic_ops.h"], + [AO_t x=0; AO_or(&x,1)])], [ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_LOCKFREE_AO_OR], [1], [libatomic_ops AO_or primitive implementation is lock-free.]) ], [ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([for lock-free AO load/store, test-and-set primitives]) - AC_TRY_LINK([#include "atomic_ops.h"], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "atomic_ops.h"], [AO_t x=0;unsigned char c=0;AO_TS_t z=AO_TS_INITIALIZER; (void)AO_test_and_set_acquire(&z);AO_CLEAR(&z);AO_compiler_barrier(); AO_store(&x,AO_load(&x)+1);AO_char_store(&c,AO_char_load(&c)+1); - AO_store_release(&x,AO_load_acquire(&x)+1)], + AO_store_release(&x,AO_load_acquire(&x)+1)])], [ AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) use_thread_local_alloc=no @@ -1132,10 +1134,12 @@ AS_IF([test x$with_libatomic_ops != xnone -a x$need_atomic_ops_asm != xtrue], AS_IF([test x$use_parallel_mark != xno], [ AC_MSG_CHECKING( [for lock-free compare-and-swap and fetch-and-add primitives]) - AC_TRY_LINK( - [#define AO_REQUIRE_CAS - #include "atomic_ops.h"], - [AO_t x=0;(void)AO_fetch_and_add(&x,1);(void)AO_compare_and_swap(&x,1,2)], + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [ +# define AO_REQUIRE_CAS +# include "atomic_ops.h" + ], + [AO_t x=0;(void)AO_fetch_and_add(&x,1);(void)AO_compare_and_swap(&x,1,2)])], [ AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) use_parallel_mark=no ]) ]) -- cgit v1.2.1