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

Also find pcre2/pcre2.h. Fixes #2851

This commit is contained in:
dmiller
2024-06-04 20:24:55 +00:00
parent 03c9f34959
commit c6ffdbf7ae
4 changed files with 62 additions and 20 deletions

64
configure vendored
View File

@@ -7300,11 +7300,7 @@ 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" "
#define PCRE2_CODE_UNIT_WIDTH 8
"
ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "$ac_includes_default"
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
@@ -7347,6 +7343,56 @@ then :
have_pcre=yes
fi
else $as_nop
ac_fn_c_check_header_compile "$LINENO" "pcre2/pcre2.h" "ac_cv_header_pcre2_pcre2_h" "$ac_includes_default"
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
printf %s "checking for pcre2_compile_8 in -lpcre2-8... " >&6; }
if test ${ac_cv_lib_pcre2_8_pcre2_compile_8+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpcre2-8 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char pcre2_compile_8 ();
int
main (void)
{
return pcre2_compile_8 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_pcre2_8_pcre2_compile_8=yes
else $as_nop
ac_cv_lib_pcre2_8_pcre2_compile_8=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre2_8_pcre2_compile_8" >&5
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
@@ -7364,14 +7410,6 @@ if test $have_pcre != yes ; then
printf "%s\n" "#define PCRE_INCLUDED 1" >>confdefs.h
else
# We only need to check for and use this if we are NOT using included pcre
ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "$ac_includes_default"
if test "x$ac_cv_header_pcre2_h" = xyes
then :
printf "%s\n" "#define HAVE_PCRE2_H 1" >>confdefs.h
fi
LIBPCRE_LIBS="-lpcre2-8"
PCRE_BUILD=""
PCRE_CLEAN=""

View File

@@ -530,10 +530,10 @@ AC_HELP_STRING([--with-libpcre=included], [Always use the version included with
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 ]),
[],
[
#define PCRE2_CODE_UNIT_WIDTH 8
]
[AC_CHECK_HEADER(pcre2/pcre2.h,
[AC_CHECK_LIB(pcre2-8, pcre2_compile_8, [have_pcre=yes
AC_DEFINE(HAVE_PCRE2_PCRE2_H, 1)])]
)]
)
fi
@@ -547,8 +547,6 @@ if test $have_pcre != yes ; then
PCRE_DIST_CLEAN="distclean-pcre"
AC_DEFINE(PCRE_INCLUDED, 1, [Using included libpcre2])
else
# We only need to check for and use this if we are NOT using included pcre
AC_CHECK_HEADERS(pcre2.h)
LIBPCRE_LIBS="-lpcre2-8"
PCRE_BUILD=""
PCRE_CLEAN=""

View File

@@ -104,6 +104,8 @@
#undef HAVE_TERMIOS_H
#undef HAVE_PCRE2_PCRE2_H
#undef BSD_NETWORKING
#undef IN_ADDR_DEEPSTRUCT

View File

@@ -71,7 +71,11 @@
#include <vector>
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
#ifdef HAVE_PCRE2_PCRE2_H
# include <pcre2/pcre2.h>
#else
# include <pcre2.h>
#endif
#undef NDEBUG
#include <assert.h>