diff --git a/CHANGES b/CHANGES index eb7e69e90f..6074a4f53b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ DD mmm YYYY - 2.9.x (to be released) ------------------- + * Only check for pcre2 install if required + [Issue #2833 - @martinhsv] * Adjustment of previous fix for log messages [Issue #2832 - @marcstern, @erkia] * Mark apache error log messages as from mod_security2 diff --git a/build/find_pcre2.m4 b/build/find_pcre2.m4 index 36196bdaeb..11e9890f98 100644 --- a/build/find_pcre2.m4 +++ b/build/find_pcre2.m4 @@ -18,70 +18,76 @@ AC_DEFUN([CHECK_PCRE2], AC_ARG_WITH( pcre2, [AC_HELP_STRING([--with-pcre2=PATH],[Path to pcre2 prefix or config script])], - , with_pcre2=yes) + , with_pcre2=no) AS_CASE(["${with_pcre2}"], [no], [test_paths=], [yes], [test_paths="/usr/local/libpcre2 /usr/local/pcre2 /usr/local /opt/libpcre2 /opt/pcre2 /opt /usr"], [test_paths="${with_pcre2}"]) -AC_MSG_CHECKING([for libpcre2 config script]) +if test "x${with_pcre2}" == "x" || test "x${with_pcre2}" == "xno"; then + AC_MSG_NOTICE([pcre2 not specified; omitting check]) +else -for x in ${test_paths}; do - dnl # Determine if the script was specified and use it directly - if test ! -d "$x" -a -e "$x"; then - PCRE2_CONFIG=$x - pcre2_path="no" - break - fi + AC_MSG_CHECKING([for libpcre2 config script]) - dnl # Try known config script names/locations - for PCRE2_CONFIG in pcre2-config; do - if test -e "${x}/bin/${PCRE2_CONFIG}"; then - pcre2_path="${x}/bin" + for x in ${test_paths}; do + dnl # Determine if the script was specified and use it directly + if test ! -d "$x" -a -e "$x"; then + PCRE2_CONFIG=$x + pcre2_path="no" break - elif test -e "${x}/${PCRE2_CONFIG}"; then - pcre2_path="${x}" + fi + + dnl # Try known config script names/locations + for PCRE2_CONFIG in pcre2-config; do + if test -e "${x}/bin/${PCRE2_CONFIG}"; then + pcre2_path="${x}/bin" + break + elif test -e "${x}/${PCRE2_CONFIG}"; then + pcre2_path="${x}" + break + else + pcre2_path="" + fi + done + if test -n "$pcre2_path"; then break - else - pcre2_path="" fi done - if test -n "$pcre2_path"; then - break - fi -done -if test -n "${pcre2_path}"; then - if test "${pcre2_path}" != "no"; then - PCRE2_CONFIG="${pcre2_path}/${PCRE2_CONFIG}" + if test -n "${pcre2_path}"; then + if test "${pcre2_path}" != "no"; then + PCRE2_CONFIG="${pcre2_path}/${PCRE2_CONFIG}" + fi + AC_MSG_RESULT([${PCRE2_CONFIG}]) + PCRE2_VERSION="`${PCRE2_CONFIG} --version`" + if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 VERSION: $PCRE2_VERSION); fi + PCRE2_CFLAGS="`${PCRE2_CONFIG} --cflags`" + if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 CFLAGS: $PCRE2_CFLAGS); fi + PCRE2_LDADD="`${PCRE2_CONFIG} --libs8`" + if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 LDADD: $PCRE2_LDADD); fi + PCRE_LD_PATH="/`${PCRE2_CONFIG} --libs8 | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`" + if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 PCRE_LD_PATH: $PCRE_LD_PATH); fi + else + AC_MSG_RESULT([no]) fi - AC_MSG_RESULT([${PCRE2_CONFIG}]) - PCRE2_VERSION="`${PCRE2_CONFIG} --version`" - if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 VERSION: $PCRE2_VERSION); fi - PCRE2_CFLAGS="`${PCRE2_CONFIG} --cflags`" - if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 CFLAGS: $PCRE2_CFLAGS); fi - PCRE2_LDADD="`${PCRE2_CONFIG} --libs8`" - if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 LDADD: $PCRE2_LDADD); fi - PCRE_LD_PATH="/`${PCRE2_CONFIG} --libs8 | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`" - if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre2 PCRE_LD_PATH: $PCRE_LD_PATH); fi -else - AC_MSG_RESULT([no]) -fi -AC_SUBST(PCRE2_CONFIG) -AC_SUBST(PCRE2_VERSION) -AC_SUBST(PCRE2_CPPFLAGS) -AC_SUBST(PCRE2_CFLAGS) -AC_SUBST(PCRE2_LDFLAGS) -AC_SUBST(PCRE2_LDADD) -AC_SUBST(PCRE_LD_PATH) + AC_SUBST(PCRE2_CONFIG) + AC_SUBST(PCRE2_VERSION) + AC_SUBST(PCRE2_CPPFLAGS) + AC_SUBST(PCRE2_CFLAGS) + AC_SUBST(PCRE2_LDFLAGS) + AC_SUBST(PCRE2_LDADD) + AC_SUBST(PCRE_LD_PATH) -if test -z "${PCRE2_VERSION}"; then - AC_MSG_NOTICE([*** pcre2 library not found.]) -else - AC_MSG_NOTICE([using pcre2 v${PCRE2_VERSION}]) - PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}" - ifelse([$1], , , $1) -fi + if test -z "${PCRE2_VERSION}"; then + AC_MSG_NOTICE([*** pcre2 library not found.]) + ifelse([$2], , AC_MSG_ERROR([pcre2 library is required]), $2) + else + AC_MSG_NOTICE([using pcre2 v${PCRE2_VERSION}]) + PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}" + ifelse([$1], , , $1) + fi +fi ])