0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-18 10:53:48 +02:00

configure: Add --enable-compact for the smallest possible building and linking.

This commit is contained in:
Jason Volk 2019-06-06 05:14:32 -07:00
parent 143e4bda7b
commit 2b43a5a92b
4 changed files with 42 additions and 10 deletions

View file

@ -155,6 +155,22 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging suite fo
AM_CONDITIONAL([DEBUG], [[[[ "$DEBUG" = "1" ]]]])
dnl
dnl Compactness
dnl
AC_MSG_CHECKING(Optimize for size; strip symbols; force no debugging)
AC_ARG_ENABLE(compact, AC_HELP_STRING([--enable-compact], [Optimize for size and compactness]),
[
AC_MSG_RESULT([yes])
AC_SUBST(COMPACT, 1)
RB_DEFINE_UNQUOTED([COMPACT], [1], [Not configured for compactness when lit.])
], [
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([COMPACT], [[[[ "$COMPACT" = "1" ]]]])
dnl
dnl Explicit assert switch for still using assert() without --enable-debug
dnl
@ -267,10 +283,18 @@ AC_ARG_WITH(optimize-level, AC_HELP_STRING([--with-optimize-level[[[=3]]]], [Exp
], [
AM_COND_IF(OPTIMIZE,
[
optimize_level="3"
AC_MSG_RESULT([no, but --enable-optimize has implied level -O$optimize_level])
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [Explicitly set release mode optimization])
AM_COND_IF(COMPACT,
[
optimize_level="s"
AC_MSG_RESULT([no, but --enable-optimize and --enable-compact means -O$optimize_level])
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [Implicitly set release mode optimization])
], [
optimize_level="3"
AC_MSG_RESULT([no, but --enable-optimize has implied level -O$optimize_level])
AC_SUBST(OPTIMIZE_LEVEL, $optimize_level)
RB_DEFINE_UNQUOTED([OPTIMIZE_LEVEL], [$optimize_level], [Explicitly set release mode optimization])
])
], [
AM_COND_IF(DEBUG,
[
@ -501,9 +525,14 @@ AM_COND_IF([DEBUG],
CXXFLAGS+=" -fvar-tracking"
CXXFLAGS+=" -fvar-tracking-assignments"
], [
dnl Note these flags are unreliable with LTO
CXXFLAGS+=" -g"
CXXFLAGS+=" -ggdb"
AM_COND_IF([COMPACT],
[
], [
dnl Note these flags are unreliable with LTO
CXXFLAGS+=" -g"
CXXFLAGS+=" -ggdb"
])
])
dnl Creates an ELF section in the output which contains a list of
@ -1625,6 +1654,12 @@ AC_SUBST(EXTRA_CXXFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(EXTRA_LIBS)
AM_COND_IF([COMPACT],
[
EXTRA_LDFLAGS+=" -Wl,--strip-all"
EXTRA_LDFLAGS+=" -Wl,--gc-sections"
])
AM_COND_IF([MINGW],
[

View file

@ -28,7 +28,6 @@ AM_LDFLAGS = \
-Wl,--detect-odr-violations \
-Wl,--unresolved-symbols=report-all \
-Wl,--allow-shlib-undefined \
-Wl,--gc-sections \
-Wl,--dynamic-list-data \
-Wl,--dynamic-list-cpp-new\
-Wl,--dynamic-list-cpp-typeinfo \

View file

@ -40,7 +40,6 @@ AM_LDFLAGS = \
-Wl,--unresolved-symbols=report-all \
-Wl,--no-undefined-version \
-Wl,--weak-unresolved-symbols \
-Wl,--no-gc-sections \
-Wl,--icf=all \
-Wl,--rosegment \
-Wl,--gdb-index \

View file

@ -38,7 +38,6 @@ AM_LDFLAGS = \
-Wl,--warn-execstack \
-Wl,--detect-odr-violations \
-Wl,--allow-shlib-undefined \
-Wl,--gc-sections \
-Wl,--icf=all \
-Wl,--gdb-index \
-Wl,-z,lazy \