From f31a4b759dd55db33031b5e92267f51a6546216d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 29 Dec 2016 07:51:50 +0100 Subject: [PATCH] Tweak AX_CHECK_COMPILE_FLAG to also try to link the test program --- configure.ac | 14 +++++--------- m4/ax_check_compile_flag.m4 | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 90ff5413..91e12849 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,7 @@ AC_SUBST(SODIUM_LIBRARY_VERSION_MINOR) AC_SUBST(SODIUM_LIBRARY_VERSION) AC_SUBST(DLL_VERSION) +AC_LANG_ASSERT(C) LX_CFLAGS=${CFLAGS-NONE} dnl Path check @@ -180,19 +181,14 @@ AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CFLAGS="$CFLAGS -fvisibility=hidden"]) AS_CASE([$host_os], [cygwin*|mingw*|msys|pw32*|cegcc*], [ ], [ - AX_CHECK_COMPILE_FLAG([-fPIC], [ - AX_CHECK_LINK_FLAG([-fPIC], - [CFLAGS="$CFLAGS -fPIC"] - ) - ]) + AX_CHECK_COMPILE_FLAG([-fPIC], [CFLAGS="$CFLAGS -fPIC"]) ]) AS_IF([test "$enable_pie" != "no"],[ AX_CHECK_COMPILE_FLAG([-fPIE], [ - AX_CHECK_LINK_FLAG([-fPIE], - [AX_CHECK_LINK_FLAG([-pie], - [CFLAGS="$CFLAGS -fPIE" - LDFLAGS="$LDFLAGS -pie"]) + AX_CHECK_LINK_FLAG([-pie], [ + [CFLAGS="$CFLAGS -fPIE" + LDFLAGS="$LDFLAGS -pie"] ]) ]) ]) diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 index 5ae5d868..8fd4240d 100644 --- a/m4/ax_check_compile_flag.m4 +++ b/m4/ax_check_compile_flag.m4 @@ -61,8 +61,8 @@ AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[char x[42U], fodder = 0;if (fodder > -1000 && fgets(x,1000,stdin)) puts(x)]])], + AC_TRY_LINK([#include ], + [char x[42U], fodder = 0;if (fodder > -1000 && fgets(x,1000,stdin)) puts(x)], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])