summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2005-01-25 10:17:51 +0000
committerJoe Orton <jorton@apache.org>2005-01-25 10:17:51 +0000
commit81f215029833c3731ac3113ef89639880b1251ce (patch)
treec5e3f7615f36db49aa1a328fc18b37aade3a33de /configure.in
parentfe2650384de1a98942a333af466290522ed1ab91 (diff)
downloadhttpd-81f215029833c3731ac3113ef89639880b1251ce.tar.gz
* configure.in: Add --enable-pie flag; define PICFLAGS and PILDFLAGS.
* build/rules.mk.in: Factor out BASE_CC and BASE_CXX from COMPILE. Substitute PICFLAGS into COMPILE and CXX_COMPILE, but not into {SH,LT}{,_CXX}_COMPILE. Substitute PILDFLAGS into LINK but not {SH,MOD}_LINK. Reviewed by: jerenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@126362 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index fd501397e9..d663979b7a 100644
--- a/configure.in
+++ b/configure.in
@@ -394,6 +394,29 @@ AC_ARG_ENABLE(maintainer-mode,APACHE_HELP_STRING(--enable-maintainer-mode,Turn o
APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
])dnl
+dnl Conditionally enable PIE support for GNU toolchains.
+AC_ARG_ENABLE(pie,APACHE_HELP_STRING(--enable-pie,Build httpd as a Position Independent Executable))
+if test "$enable_pie" = "yes"; then
+ AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
+ save_CFLAGS=$CFLAGS
+ save_LDFLAGS=$LDFLAGS
+ CFLAGS="$CFLAGS -fPIE"
+ LDFLAGS="$LDFLAGS -pie"
+ AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
+ [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no], [ap_cv_cc_pie=yes])
+ CFLAGS=$save_CFLAGS
+ LDFLAGS=$save_LDFLAGS
+ ])
+ if test "$ap_cv_cc_pie" = "yes"; then
+ PICFLAGS="-fPIE"
+ PILDFLAGS="-pie"
+ else
+ AC_ERROR([--enable-pie requested but $CC failed using PIE flags])
+ fi
+fi
+AC_SUBST(PICFLAGS)
+AC_SUBST(PILDFLAGS)
+
prefix="$orig_prefix"
APACHE_ENABLE_MODULES