diff --git a/configure b/configure index d6c007b49..375ea61ca 100755 --- a/configure +++ b/configure @@ -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="" diff --git a/configure.ac b/configure.ac index 05299ad26..862a056e7 100644 --- a/configure.ac +++ b/configure.ac @@ -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="" diff --git a/nmap_config.h.in b/nmap_config.h.in index 2b2e0e108..995ddcc2f 100644 --- a/nmap_config.h.in +++ b/nmap_config.h.in @@ -104,6 +104,8 @@ #undef HAVE_TERMIOS_H +#undef HAVE_PCRE2_PCRE2_H + #undef BSD_NETWORKING #undef IN_ADDR_DEEPSTRUCT diff --git a/service_scan.h b/service_scan.h index 49b8eba04..7aca4ae1b 100644 --- a/service_scan.h +++ b/service_scan.h @@ -71,7 +71,11 @@ #include #define PCRE2_CODE_UNIT_WIDTH 8 -#include +#ifdef HAVE_PCRE2_PCRE2_H +# include +#else +# include +#endif #undef NDEBUG #include