From: Alan T. DeKok Date: Tue, 2 Sep 2014 21:41:51 +0000 (-0400) Subject: Added checks for libpcre X-Git-Tag: release_3_0_5~642 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a64a09b48a7c57b0342c48abdc0b63cd0cef3efd;p=thirdparty%2Ffreeradius-server.git Added checks for libpcre --- diff --git a/configure b/configure index 0ad2c47c56b..d7715de9f8c 100755 --- a/configure +++ b/configure @@ -10911,12 +10911,60 @@ $as_echo "#define HAVE_REGEX_H 1" >>confdefs.h $as_echo "#define HAVE_PCREPOSIX_H 1" >>confdefs.h - REGEX=yes - REGEX_EXTENDED=yes - REGEX_PCRE=yes - LIBS="-lpcre -lpcreposix $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_compile in -lpcre" >&5 +$as_echo_n "checking for pcre_compile in -lpcre... " >&6; } +if ${ac_cv_lib_pcre_pcre_compile+:} false; then : + $as_echo_n "(cached) " >&6 else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $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. */ +#ifdef __cplusplus +extern "C" +#endif +char pcre_compile (); +int +main () +{ +return pcre_compile (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcre_pcre_compile=yes +else + ac_cv_lib_pcre_pcre_compile=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_compile" >&5 +$as_echo "$ac_cv_lib_pcre_pcre_compile" >&6; } +if test "x$ac_cv_lib_pcre_pcre_compile" = xyes; then : + + +$as_echo "#define HAVE_LIBPCRE 1" >>confdefs.h + + REGEX=yes + REGEX_EXTENDED=yes + REGEX_PCRE=yes + LIBS="-lpcre -lpcreposix $LIBS" + + +fi + + +fi + +if test "x$REGEX" != "xyes"; then smart_try_dir= diff --git a/configure.ac b/configure.ac index 798c72ccb44..8a73bfafb79 100644 --- a/configure.ac +++ b/configure.ac @@ -1665,15 +1665,23 @@ FR_SMART_CHECK_INCLUDE(pcreposix.h) if test "x$ac_cv_header_pcreposix_h" = "xyes"; then AC_DEFINE(HAVE_REGEX_H, [1], [define if we have any regex]) AC_DEFINE(HAVE_PCREPOSIX_H, [1], [define this if we have the header file]) - REGEX=yes - REGEX_EXTENDED=yes - REGEX_PCRE=yes - LIBS="-lpcre -lpcreposix $LIBS" + + AC_CHECK_LIB(pcre, pcre_compile, + [ + AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library]) + REGEX=yes + REGEX_EXTENDED=yes + REGEX_PCRE=yes + LIBS="-lpcre -lpcreposix $LIBS" + ] + ) dnl # -dnl # Then fallback to POSIX regular expressions +dnl # If no pcre, fallback to POSIX regular expressions dnl # -else +fi + +if test "x$REGEX" != "xyes"; then smart_try_dir= FR_SMART_CHECK_INCLUDE(regex.h) if test "x$ac_cv_header_regex_h" = "xyes"; then diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index d547ab0083f..72182c4fefd 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -159,6 +159,9 @@ /* Define to 1 if you have the `pcap' library (-lpcap). */ #undef HAVE_LIBPCAP +/* Define to use libpcre library */ +#undef HAVE_LIBPCRE + /* Define if you have a readline compatible library */ #undef HAVE_LIBREADLINE