From bef25962e7931b903d56b277f61ab3a0de9c00f5 Mon Sep 17 00:00:00 2001 From: nnposter Date: Sun, 1 Sep 2024 20:36:02 +0000 Subject: [PATCH] Improve tests for finding libpcre2. Close #2907, see #2851, see #2913 - Include definition of PCRE2_CODE_UNIT_WIDTH to allow the header test to compile correctly - Add description to the definition of HAVE_PCRE2_PCRE2_H to prevent an autoheader missing template error --- configure | 11 ++++++----- configure.ac | 17 +++++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 375ea61ca..5e53a5462 100755 --- a/configure +++ b/configure @@ -7300,7 +7300,8 @@ fi # If they didn't specify it, we try to find it if test $have_pcre != yes -a $requested_included_pcre != yes ; then - ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "#define PCRE2_CODE_UNIT_WIDTH 8 +" if test "x$ac_cv_header_pcre2_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre2_compile_8 in -lpcre2-8" >&5 @@ -7344,7 +7345,8 @@ then : fi else $as_nop - ac_fn_c_check_header_compile "$LINENO" "pcre2/pcre2.h" "ac_cv_header_pcre2_pcre2_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "pcre2/pcre2.h" "ac_cv_header_pcre2_pcre2_h" "#define PCRE2_CODE_UNIT_WIDTH 8 +" if test "x$ac_cv_header_pcre2_pcre2_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre2_compile_8 in -lpcre2-8" >&5 @@ -7385,14 +7387,13 @@ printf "%s\n" "$ac_cv_lib_pcre2_8_pcre2_compile_8" >&6; } if test "x$ac_cv_lib_pcre2_8_pcre2_compile_8" = xyes then : have_pcre=yes - printf "%s\n" "#define HAVE_PCRE2_PCRE2_H 1" >>confdefs.h + +printf "%s\n" "#define HAVE_PCRE2_PCRE2_H 1" >>confdefs.h fi - fi - fi fi diff --git a/configure.ac b/configure.ac index 862a056e7..848907786 100644 --- a/configure.ac +++ b/configure.ac @@ -529,12 +529,17 @@ AC_HELP_STRING([--with-libpcre=included], [Always use the version included with # If they didn't specify it, we try to find it if test $have_pcre != yes -a $requested_included_pcre != yes ; then AC_CHECK_HEADER(pcre2.h, - AC_CHECK_LIB(pcre2-8, pcre2_compile_8, [have_pcre=yes ]), - [AC_CHECK_HEADER(pcre2/pcre2.h, - [AC_CHECK_LIB(pcre2-8, pcre2_compile_8, [have_pcre=yes - AC_DEFINE(HAVE_PCRE2_PCRE2_H, 1)])] - )] - ) + AC_CHECK_LIB(pcre2-8, + pcre2_compile_8, + [have_pcre=yes ]), + AC_CHECK_HEADER(pcre2/pcre2.h, + AC_CHECK_LIB(pcre2-8, + pcre2_compile_8, + [have_pcre=yes + AC_DEFINE(HAVE_PCRE2_PCRE2_H, 1, [Using system pcre2/pcre2.h])]), + [], + [#define PCRE2_CODE_UNIT_WIDTH 8]), + [#define PCRE2_CODE_UNIT_WIDTH 8]) fi # If we still don't have it, we use our own