mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +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:
parent
053e3b5266
commit
d47185d771
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -12,8 +12,8 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
platform:
|
||||
- {label: "x64", arch: "amd64", configure: ""}
|
||||
- {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32"}
|
||||
- {label: "x64", arch: "amd64", configure: "--enable-assertions=yes"}
|
||||
- {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS= -m32--enable-assertions=yes"}
|
||||
compiler:
|
||||
- {label: "gcc", cc: "gcc", cxx: "g++"}
|
||||
- {label: "clang", cc: "clang", cxx: "clang++"}
|
||||
@ -112,7 +112,7 @@ jobs:
|
||||
- name: build.sh
|
||||
run: ./build.sh
|
||||
- name: configure
|
||||
run: ./configure ${{ matrix.configure.opt }}
|
||||
run: ./configure ${{ matrix.configure.opt }} --enable-assertions=yes
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: make
|
||||
run: make -j `sysctl -n hw.logicalcpu`
|
||||
|
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user