summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2019-06-20 15:00:37 +0200
committerJoe Orton <jorton@apache.org>2019-06-20 15:00:37 +0200
commit50bbfb3de58e82514f50a34f2ec24d147112b7f5 (patch)
tree8b983073a3f756f57b81d724d0d44fe35d56d8eb /configure.in
parentClarify pool lifetime constraints when modifying ap_server_config_defines. (diff)
downloadapache2-50bbfb3de58e82514f50a34f2ec24d147112b7f5.tar.xz
apache2-50bbfb3de58e82514f50a34f2ec24d147112b7f5.zip
Add an --enable-reduced-exports configure option to link libmain.a
using ld's --whole-archive mode and avoid building exports.c entirely. This reduces the size of a minimal httpd binary by 18% on Linux/x86_64 (687K to 560K) with no difference to the set of symbols available to modules. This option is only appropriate to use if using a shared libapr* build, hence is non-default. * configure.in: Add --enable-reduced-exports; disable httpdunit build if used. Define AP_FORCE_EXPORTS if not enabled (default) in place of AP_USING_AUTOCONF. * server/main.c (ap_suck_in_APR): Only build if AP_FORCE_EXPORTS is defined. * Makefile.in: Link libmain.la using LIBMAIN_LIB. * server/Makefile.in: Conditionally build exports.c into libmain. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1861685 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in27
1 files changed, 23 insertions, 4 deletions
diff --git a/configure.in b/configure.in
index b20aad03f6..ec0336785e 100644
--- a/configure.in
+++ b/configure.in
@@ -703,6 +703,28 @@ fi
APACHE_SUBST(PICFLAGS)
APACHE_SUBST(PILDFLAGS)
+ap_reduced_exports=no
+EXPORTS_DOT_C=exports.c
+LIBMAIN_LIB=server/libmain.la
+APACHE_SUBST(EXPORTS_DOT_C)
+APACHE_SUBST(LIBMAIN_LIB)
+
+AC_ARG_ENABLE(reduced-exports,
+APACHE_HELP_STRING(--enable-reduced-exports,Reduce binary size if using shared APR libraries),
+[
+ if test "$enableval" = "yes" -a "$GCC" = "yes"; then
+ ap_reduced_exports=yes
+ fi
+])
+
+if test "$ap_reduced_exports" = "yes"; then
+ EXPORTS_DOT_C=
+ LIBMAIN_LIB="-Wl,--whole-archive,server/.libs/libmain.a,--no-whole-archive"
+ AC_MSG_NOTICE([Using reduced symbol exports])
+else
+ AC_DEFINE(AP_FORCE_EXPORTS, 1, [Force symbol exports for dependent libraries])
+fi
+
AC_ARG_WITH(valgrind,
[ --with-valgrind[[=DIR]] Enable code to reduce valgrind false positives
(optionally: set path to valgrind headers) ],
@@ -722,7 +744,7 @@ AC_ARG_WITH(valgrind,
dnl Enable the unit test executable if Check is installed.
dnl TODO: at the moment, only pkg-config discovery is supported.
AC_MSG_CHECKING([for Check to enable unit tests])
-if test "x$PKGCONFIG" != "x" && `$PKGCONFIG --atleast-version='0.9.12' check`; then
+if test "x$PKGCONFIG" != "x" -a "$AP_FORCE_EXPORTS" = "yes" && `$PKGCONFIG --atleast-version='0.9.12' check`; then
UNITTEST_CFLAGS=`$PKGCONFIG --cflags check`
UNITTEST_LIBS=`$PKGCONFIG --libs check`
other_targets="$other_targets test/httpdunit"
@@ -864,9 +886,6 @@ APACHE_SUBST(AP_LIBS)
APACHE_SUBST(AP_BUILD_SRCLIB_DIRS)
APACHE_SUBST(AP_CLEAN_SRCLIB_DIRS)
-AC_DEFINE(AP_USING_AUTOCONF, 1,
- [Using autoconf to configure Apache])
-
if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1,
[This platform doesn't suffer from the thundering herd problem])