refactor: autotools files#3494
Conversation
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
There was a problem hiding this comment.
Pull request overview
This PR refactors the autotools build configuration files to simplify and standardize library detection logic. It introduces a new generic MSC_CHECK_LIB macro that consolidates repetitive library detection code across multiple .m4 files, reducing duplication and improving maintainability. The changes also add comprehensive type definitions and header checks to configure.ac for better portability, and introduce helper macros for boolean options and status display.
Changes:
- Introduced generic
MSC_CHECK_LIBmacro for standardized library detection with pkg-config and manual fallback - Refactored 10 library detection .m4 files (CURL, GeoIP, MaxMind, LibXML2, LMDB, LUA, PCRE, PCRE2, SSDEEP, YAJL) to use the new macro
- Added extensive type checking and header validation in configure.ac for improved portability
- Created
MSC_ARG_ENABLE_BOOLandMSC_STATUS_LIBhelper macros for consistency - Added PCRE2 support to modsecurity.pc.in Libs.private
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| build/msc_find_lib.m4 | New file introducing generic library detection macros (MSC_CHECK_LIB, MSC_ARG_ENABLE_BOOL, MSC_STATUS_LIB) |
| build/curl.m4 | Refactored to use MSC_CHECK_LIB with TLSv1.2 and GnuTLS post-processing |
| build/yajl.m4 | Simplified using MSC_CHECK_LIB with header path normalization |
| build/ssdeep.m4 | Reduced from 144 to 11 lines using MSC_CHECK_LIB |
| build/pcre2.m4 | Simplified from 187 to 13 lines using MSC_CHECK_LIB |
| build/pcre.m4 | Refactored to use MSC_CHECK_LIB with JIT detection post-processing |
| build/lua.m4 | Refactored using MSC_CHECK_LIB with version detection via pkg-config and compile tests |
| build/lmdb.m4 | Simplified with MSC_CHECK_LIB and opt-in behavior enforcement |
| build/libxml.m4 | Reduced from 135 to 12 lines using MSC_CHECK_LIB with min version 2.6.29 |
| build/libmaxmind.m4 | Simplified from 187 to 12 lines using MSC_CHECK_LIB |
| build/libgeoip.m4 | Reduced from 186 to 12 lines using MSC_CHECK_LIB |
| configure.ac | Added AC_PREREQ, program checks, type definitions, header checks, function checks, simplified boolean options, and status display |
| modsecurity.pc.in | Added @PCRE2_LDADD@ to Libs.private for PCRE2 support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove duplicate -lpcre append in pcre.m4 (already set by MSC_CHECK_LIB) - Use LUA_VERSION from MSC_CHECK_LIB directly instead of re-querying pkg-config - Remove obsolete AC_PROG_RANLIB (superseded by LT_INIT)
|



what
config.hwhy
references