Tweak AX_CHECK_COMPILE_FLAG to also try to link the test program

This commit is contained in:
Frank Denis 2016-12-29 07:51:50 +01:00
parent 4e8832ed57
commit f31a4b759d
2 changed files with 7 additions and 11 deletions

View File

@ -36,6 +36,7 @@ AC_SUBST(SODIUM_LIBRARY_VERSION_MINOR)
AC_SUBST(SODIUM_LIBRARY_VERSION) AC_SUBST(SODIUM_LIBRARY_VERSION)
AC_SUBST(DLL_VERSION) AC_SUBST(DLL_VERSION)
AC_LANG_ASSERT(C)
LX_CFLAGS=${CFLAGS-NONE} LX_CFLAGS=${CFLAGS-NONE}
dnl Path check dnl Path check
@ -180,19 +181,14 @@ AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
[CFLAGS="$CFLAGS -fvisibility=hidden"]) [CFLAGS="$CFLAGS -fvisibility=hidden"])
AS_CASE([$host_os], [cygwin*|mingw*|msys|pw32*|cegcc*], [ ], [ AS_CASE([$host_os], [cygwin*|mingw*|msys|pw32*|cegcc*], [ ], [
AX_CHECK_COMPILE_FLAG([-fPIC], [ AX_CHECK_COMPILE_FLAG([-fPIC], [CFLAGS="$CFLAGS -fPIC"])
AX_CHECK_LINK_FLAG([-fPIC],
[CFLAGS="$CFLAGS -fPIC"]
)
])
]) ])
AS_IF([test "$enable_pie" != "no"],[ AS_IF([test "$enable_pie" != "no"],[
AX_CHECK_COMPILE_FLAG([-fPIE], [ AX_CHECK_COMPILE_FLAG([-fPIE], [
AX_CHECK_LINK_FLAG([-fPIE], AX_CHECK_LINK_FLAG([-pie], [
[AX_CHECK_LINK_FLAG([-pie],
[CFLAGS="$CFLAGS -fPIE" [CFLAGS="$CFLAGS -fPIE"
LDFLAGS="$LDFLAGS -pie"]) LDFLAGS="$LDFLAGS -pie"]
]) ])
]) ])
]) ])

View File

@ -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, [ AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], AC_TRY_LINK([#include <stdio.h>],
[[char x[42U], fodder = 0;if (fodder > -1000 && fgets(x,1000,stdin)) puts(x)]])], [char x[42U], fodder = 0;if (fodder > -1000 && fgets(x,1000,stdin)) puts(x)],
[AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])]) [AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])