Skip to content

refactor: autotools files#3494

Open
fzipi wants to merge 3 commits intoowasp-modsecurity:v3/masterfrom
fzipi:chore/refactor-autoconf-files
Open

refactor: autotools files#3494
fzipi wants to merge 3 commits intoowasp-modsecurity:v3/masterfrom
fzipi:chore/refactor-autoconf-files

Conversation

@fzipi
Copy link
Collaborator

@fzipi fzipi commented Feb 12, 2026

what

  • refactor autotools files
  • add types definitions that can be used from config.h

why

  • simplify configure.ac logic

references

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
@fzipi fzipi marked this pull request as ready for review February 14, 2026 18:03
@fzipi fzipi requested a review from airween February 14, 2026 18:04
@airween airween requested a review from Copilot February 15, 2026 09:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_LIB macro 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_BOOL and MSC_STATUS_LIB helper 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)
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants