You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/01/25 11:17:53 UTC

svn commit: r126362 - /httpd/httpd/trunk/CHANGES /httpd/httpd/trunk/build/rules.mk.in /httpd/httpd/trunk/configure.in

Author: jorton
Date: Tue Jan 25 02:17:51 2005
New Revision: 126362

URL: http://svn.apache.org/viewcvs?view=rev&rev=126362
Log:
* 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

Modified:
   httpd/httpd/trunk/CHANGES
   httpd/httpd/trunk/build/rules.mk.in
   httpd/httpd/trunk/configure.in

Modified: httpd/httpd/trunk/CHANGES
Url: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?view=diff&rev=126362&p1=httpd/httpd/trunk/CHANGES&r1=126361&p2=httpd/httpd/trunk/CHANGES&r2=126362
==============================================================================
--- httpd/httpd/trunk/CHANGES	(original)
+++ httpd/httpd/trunk/CHANGES	Tue Jan 25 02:17:51 2005
@@ -2,6 +2,10 @@
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Add --enable-pie flag to configure, to build httpd as a Position
+     Independent Executable where supported (GCC/binutils).
+     [Joe Orton]
+
   *) proxy_balancer: Add in load-balancing via weighted traffic
      byte count. [Jim Jagielski]
 

Modified: httpd/httpd/trunk/build/rules.mk.in
Url: http://svn.apache.org/viewcvs/httpd/httpd/trunk/build/rules.mk.in?view=diff&rev=126362&p1=httpd/httpd/trunk/build/rules.mk.in&r1=126361&p2=httpd/httpd/trunk/build/rules.mk.in&r2=126362
==============================================================================
--- httpd/httpd/trunk/build/rules.mk.in	(original)
+++ httpd/httpd/trunk/build/rules.mk.in	Tue Jan 25 02:17:51 2005
@@ -31,18 +31,21 @@
 
 # Compile commands
 
-COMPILE      = $(CC)  $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
-CXX_COMPILE  = $(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
+BASE_CC  = $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
+BASE_CXX = $(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
 
-SH_COMPILE     = $(LIBTOOL) --mode=compile $(COMPILE) @SHLTCFLAGS@ -c $< && touch $@
-SH_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) @SHLTCFLAGS@ -c $< && touch $@
+COMPILE      = $(BASE_CC) @PICFLAGS@
+CXX_COMPILE  = $(BASE_CXX) @PICFLAGS@
+
+SH_COMPILE     = $(LIBTOOL) --mode=compile $(BASE_CC) @SHLTCFLAGS@ -c $< && touch $@
+SH_CXX_COMPILE = $(LIBTOOL) --mode=compile $(BASE_CXX) @SHLTCFLAGS@ -c $< && touch $@
 
 LT_COMPILE     = $(LIBTOOL) --mode=compile $(COMPILE) @LTCFLAGS@ -c $< && touch $@
 LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) @LTCFLAGS@ -c $< && touch $@
 
 # Link-related commands
 
-LINK     = $(LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
+LINK     = $(LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) @PILDFLAGS@ $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
 SH_LINK  = $(SH_LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) $(LT_LDFLAGS) $(ALL_LDFLAGS) $(SH_LDFLAGS) $(CORE_IMPLIB) $(SH_LIBS) -o $@
 MOD_LINK = $(LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) -static $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
 

Modified: httpd/httpd/trunk/configure.in
Url: http://svn.apache.org/viewcvs/httpd/httpd/trunk/configure.in?view=diff&rev=126362&p1=httpd/httpd/trunk/configure.in&r1=126361&p2=httpd/httpd/trunk/configure.in&r2=126362
==============================================================================
--- httpd/httpd/trunk/configure.in	(original)
+++ httpd/httpd/trunk/configure.in	Tue Jan 25 02:17:51 2005
@@ -394,6 +394,29 @@
   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