mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
Build System: Introduce Configurable Assertion Handling
Implemented a new configuration option --enable-assertions=[yes|no] within config.ac, enabling controlled inclusion of -DNDEBUG in CPPFLAGS. The default setting suppresses assertions (by adding -DNDEBUG to CPPFLAGS), preserving the original behavior. This enhancement allows for the optional enabling of assertions during development or debugging by setting --enable-assertions=yes, thereby excluding -DNDEBUG from CPPFLAGS.
This commit is contained in:
24
configure.ac
24
configure.ac
@@ -248,6 +248,17 @@ AC_SUBST([MSC_VERSION])
|
||||
MSC_GIT_VERSION=msc_version_git
|
||||
AC_SUBST([MSC_GIT_VERSION])
|
||||
|
||||
AC_ARG_ENABLE(assertions,
|
||||
[AS_HELP_STRING([--enable-assertions],[Turn on assertions feature: undefine NDEBUG])],
|
||||
|
||||
[case "${enableval}" in
|
||||
yes) assertions=true ;;
|
||||
no) assertions=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-assertions) ;;
|
||||
esac],
|
||||
|
||||
[assertions=false]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(debug-logs,
|
||||
[AS_HELP_STRING([--disable-debug-logs],[Turn off the SecDebugLog feature])],
|
||||
@@ -377,6 +388,14 @@ if test "$aflFuzzer" == "true"; then
|
||||
GLOBAL_CPPFLAGS="$GLOBAL_CPPFLAGS $FUZZ_CPPCFLAGS"
|
||||
$buildExamples = false
|
||||
fi
|
||||
|
||||
case $assertions in
|
||||
false) ASSERTIONS_CPPCFLAGS="-DNDEBUG" ;;
|
||||
true) ASSERTIONS_CPPCFLAGS="-UNDEBUG" ;;
|
||||
*) AC_MSG_ERROR(bad value ${assertions} for assertions) ;;
|
||||
esac
|
||||
GLOBAL_CPPFLAGS="$GLOBAL_CPPFLAGS $ASSERTIONS_CPPCFLAGS"
|
||||
|
||||
AC_SUBST(GLOBAL_LDADD)
|
||||
AC_SUBST(GLOBAL_CPPFLAGS)
|
||||
|
||||
@@ -613,6 +632,11 @@ if test $buildTestUtilities = true; then
|
||||
else
|
||||
echo " + Test Utilities ....disabled"
|
||||
fi
|
||||
if test $assertions = true; then
|
||||
echo " + Assertions ....enabled"
|
||||
else
|
||||
echo " + Assertions ....disabled"
|
||||
fi
|
||||
if test $debugLogs = true; then
|
||||
echo " + SecDebugLog ....enabled"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user