Skip to content

Commit

Permalink
Simplifiy configuration to build libModSecurity with std C++17
Browse files Browse the repository at this point in the history
- Leveraged autoconf again to check whether the C++ compiler supports
  the required standard version and build using it.
- Replaced the outdaded `ax_cxx_compile_stdcxx_11.m4` macro with the
  latest version of `ax_cxx_compile_stdcxx` which supports C++17.
  - https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
  - https://raw.githubusercontent.com/autoconf-archive/autoconf-archive/e4e5269db2764b9f53d759c24750ac6ca38e02ea/m4/ax_cxx_compile_stdcxx.m4
- This should also streamline updating to C++20 in the future.
  • Loading branch information
eduar-hte committed Aug 8, 2024
1 parent e8db92e commit 59254fe
Show file tree
Hide file tree
Showing 12 changed files with 1,020 additions and 184 deletions.
1,018 changes: 1,018 additions & 0 deletions build/ax_cxx_compile_stdcxx.m4

Large diffs are not rendered by default.

171 changes: 0 additions & 171 deletions build/ax_cxx_compile_stdcxx_11.m4

This file was deleted.

4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG


# Check if the compiler is c++17 compatible.
# AX_CXX_COMPILE_STDCXX_17(,mandatory)
# Set C++ standard version and check if compiler supports it.
AX_CXX_COMPILE_STDCXX(17, noext, mandatory)

# Check for libinjection
if ! test -f "${srcdir}/others/libinjection/src/libinjection_html5.c"; then
Expand Down
1 change: 0 additions & 1 deletion examples/reading_logs_via_rule_message/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ simple_request_LDFLAGS = \

simple_request_CPPFLAGS = \
$(GLOBAL_CFLAGS) \
-std=c++17 \
-I$(top_builddir)/headers \
-I$(top_builddir) \
-g \
Expand Down
1 change: 0 additions & 1 deletion examples/reading_logs_with_offset/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ read_LDFLAGS = \

read_CPPFLAGS = \
$(GLOBAL_CFLAGS) \
-std=c++17 \
-I$(top_builddir)/headers \
-I$(top_builddir) \
-g \
Expand Down
1 change: 0 additions & 1 deletion examples/using_bodies_in_chunks/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ simple_request_LDFLAGS = \

simple_request_CPPFLAGS = \
$(GLOBAL_CFLAGS) \
-std=c++17 \
-I$(top_builddir)/headers \
-I$(top_builddir) \
-g \
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ libmodsecurity_la_CFLAGS =


libmodsecurity_la_CPPFLAGS = \
-std=c++17 \
-I.. \
-g \
-I../others \
Expand Down
1 change: 0 additions & 1 deletion src/parser/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ libmodsec_parser_la_SOURCES = \
test.cc

libmodsec_parser_la_CPPFLAGS = \
-std=c++17 \
-I../.. \
-I../../headers \
-I../../others \
Expand Down
3 changes: 0 additions & 3 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ unit_tests_LDFLAGS = \


unit_tests_CPPFLAGS = \
-std=c++17 \
-Icommon \
-I../ \
-g \
Expand Down Expand Up @@ -126,7 +125,6 @@ regression_tests_LDFLAGS = \


regression_tests_CPPFLAGS = \
-std=c++17 \
-Icommon \
-I../ \
-g \
Expand Down Expand Up @@ -179,7 +177,6 @@ rules_optimization_LDFLAGS = \
$(YAJL_LDFLAGS)

rules_optimization_CPPFLAGS = \
-std=c++17 \
-Icommon \
-I../ \
-g \
Expand Down
1 change: 0 additions & 1 deletion test/benchmark/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ benchmark_LDFLAGS = \
$(LUA_LDFLAGS)

benchmark_CPPFLAGS = \
-std=c++17 \
-I$(top_builddir)/headers \
$(GLOBAL_CPPFLAGS) \
$(PCRE_CFLAGS) \
Expand Down
1 change: 0 additions & 1 deletion test/fuzzer/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ afl_fuzzer_LDADD = \


afl_fuzzer_CPPFLAGS = \
-std=c++17 \
-Icommon \
-I../ \
-I../../ \
Expand Down
1 change: 0 additions & 1 deletion tools/rules-check/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ modsec_rules_check_LDFLAGS = \
$(YAJL_LDFLAGS)

modsec_rules_check_CPPFLAGS = \
-std=c++17 \
-I$(top_builddir)/headers \
$(GLOBAL_CPPFLAGS) \
$(PCRE_CFLAGS) \
Expand Down

0 comments on commit 59254fe

Please sign in to comment.