diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-09 00:41:14 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-09 00:46:39 +0200 |
commit | c0dbfbd763ad77d6beaa345ce94afc93e193236e (patch) | |
tree | a5ddb4962be29e04a4ab27209a22c240af5114fc /libphobos/configure.ac | |
parent | 6e286c8df452787fffe4fb4bd3dbba4d80bc6c12 (diff) |
libphobos: Add --enable-libphobos-checking configure option
As GDCFLAGS is overriden by the top-level make file with '-O2 -g',
libphobos ends up always being built with all contracts, invariants, and
asserts compiled in. This adds a new configurable that defaults to omit
compiling any run-time checks into the library using '-frelease'.
Other choices either set the flags '-fno-release', enabling all run-time
checks, or '-fassert', which only compiles in asserts.
The omission of compiling in contracts results in a smaller library
size, with faster build times.
libphobos/ChangeLog:
PR d/94305
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add --enable-libphobos-checking and substitute
CHECKING_DFLAGS. Remove -frelease from GDCFLAGS.
* libdruntime/Makefile.am: Add CHECKING_DFLAGS to AM_DFLAGS.
* libdruntime/Makefile.in: Regenerate.
* src/Makefile.am: Add CHECKING_DFLAGS to AM_DFLAGS.
* src/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* testsuite/testsuite_flags.in: Add -fno-release -funittest to
--gdcflags.
Diffstat (limited to 'libphobos/configure.ac')
-rw-r--r-- | libphobos/configure.ac | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/libphobos/configure.ac b/libphobos/configure.ac index e6148f07519..ffd12981d0b 100644 --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -187,6 +187,31 @@ yes:*) use_libphobos=yes ;; esac AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes) +# Enable expensive internal checks +AC_ARG_ENABLE(libphobos-checking, +[AS_HELP_STRING([[--enable-libphobos-checking[=LIST]]], + [enable expensive run-time checks. With LIST, + enable only specific categories of checks. + Categories are: yes,no,all,none,release. + Flags are: assert or other strings])], +[ac_checking_flags="${enableval}"],[ac_checking_flags=release]) +IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," +for check in release $ac_checking_flags +do + case $check in + # These set all the flags to specific states + yes|all) RELEASE_FLAG="-fno-release" ; ASSERT_FLAG= ;; + no|none|release) RELEASE_FLAG="-frelease" ; ASSERT_FLAG= ;; + # These enable particular checks + assert) ASSERT_FLAG="-fassert" ;; + # Accept + *) ;; + esac +done +IFS="$ac_save_IFS" +CHECKING_DFLAGS="$RELEASE_FLAG $ASSERT_FLAG" +AC_SUBST(CHECKING_DFLAGS) + # Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec if test "$DCFG_MINFO_BRACKETING" = "false"; then DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec @@ -205,12 +230,12 @@ AC_SUBST(libtool_VERSION) # Set default flags (after DRUNTIME_WERROR!) if test -z "$GDCFLAGS"; then - GDCFLAGS="-g -frelease -O2" + GDCFLAGS="-g -O2" fi AC_SUBST(GDCFLAGS) if test -z "$GDCFLAGSX"; then - GDCFLAGSX="-g -fno-release -funittest" + GDCFLAGSX="-g" fi AC_SUBST(GDCFLAGSX) |