1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

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
This commit is contained in:
nnposter
2024-09-01 20:36:02 +00:00
parent 28e47f9361
commit bef25962e7
2 changed files with 17 additions and 11 deletions

9
configure vendored
View File

@@ -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
fi
fi
fi
fi

View File

@@ -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