1From b9b44cd82caceeb638cc6a862b5bb90b93ad6c6a Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Sat, 5 Jan 2013 19:53:10 -0800 4 5--- 6 aclocal.m4 | 2 ++ 7 configure.in | 8 ++++++-- 8 2 files changed, 8 insertions(+), 2 deletions(-) 9 10diff --git a/aclocal.m4 b/aclocal.m4 11index 2115204..2a9a802 100644 12--- a/aclocal.m4 13+++ b/aclocal.m4 14@@ -7,6 +7,8 @@ dnl -------------------------------------------------------------------------- 15 AC_DEFUN(AF_PATH_INCLUDE, 16 [AC_PATH_PROGS($1,$2,$3,$4) 17 if test -n "$$1"; then 18+ AH_TEMPLATE([HAVE_$1], [Have $2]) 19+ AH_TEMPLATE([PATH_$1], [Have $2]) 20 AC_DEFINE(HAVE_$1,1,[define if you have $1]) 21 AC_DEFINE_UNQUOTED(PATH_$1, "$$1", [define if you have $1]) 22 HAVE_$1=1 23diff --git a/configure.in b/configure.in 24index 25d7c4e..44a1c8b 100644 25--- a/configure.in 26+++ b/configure.in 27@@ -324,13 +324,15 @@ AC_PROG_CC 28 cat > pietest.c <<EOF 29 int main(void) { return 0; } 30 EOF 31+AF_tmp_ldflags="$LDFLAGS" 32+AF_tmp_cflags="$CFLAGS" 33 CFLAGS=-fPIE 34 LDFLAGS=-pie 35 DAEMON_CFLAGS= 36 DAEMON_LDFLAGS= 37 AC_MSG_CHECKING([whether gcc -fPIE works]) 38-AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])], 39- [gcc_supports_pie=yes], [gcc_supports_pie=no], [gcc_supports_pie=no]) 40+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])], 41+ [gcc_supports_pie=yes], [gcc_supports_pie=no], [gcc_supports_pie=no]) 42 AC_MSG_RESULT([$gcc_supports_pie]) 43 if test $gcc_supports_pie = yes ; then 44 DAEMON_CFLAGS="-fPIE" 45@@ -339,6 +341,8 @@ fi 46 rm -f pietest.c 47 AC_SUBST(DAEMON_CFLAGS) 48 AC_SUBST(DAEMON_LDFLAGS) 49+CFLAGS="${AF_tmp_cflags}" 50+LDFLAGS="${AF_tmp_ldflags}" 51 52 # 53 # Enable ability to access value in external env variable 54