From: Phil Mayers Date: Mon, 25 Jul 2011 14:18:12 +0000 (+0100) Subject: support for PCRE X-Git-Tag: release_3_0_0_beta0~698 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b3765b0a05b49339fc4d5ff58f75ed12b1f18e5;p=thirdparty%2Ffreeradius-server.git support for PCRE --- diff --git a/configure.in b/configure.in index 28f7227e4ca..5f4936c8ee4 100644 --- a/configure.in +++ b/configure.in @@ -641,9 +641,19 @@ AC_CHECK_HEADERS(net/if.h, [], [], ]) REGEX=no +AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the header file])) +if test "x$ac_cv_header_pcreposix_h" = "xyes"; then + AC_DEFINE(HAVE_REGEX_H [], [define if we have any regex]) + REGEX_EXTENDED=yes + REGEX_PCRE=yes + REGEX=yes + LIBS="$LIBS -lpcreposix" +else + AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the header file])) if test "x$ac_cv_header_regex_h" = "xyes"; then REGEX_EXTENDED=no + REGEX_PCRE=no REGEX=yes AC_EGREP_CPP(yes, [#include @@ -652,7 +662,10 @@ if test "x$ac_cv_header_regex_h" = "xyes"; then #endif ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from )]) REGEX_EXTENDED=yes]) fi +fi + AC_SUBST(REGEX) +AC_SUBST(REGEX_PCRE) AC_SUBST(REGEX_EXTENDED) dnl # diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c index e7258ca654b..4075c590c7b 100644 --- a/src/lib/valuepair.c +++ b/src/lib/valuepair.c @@ -31,9 +31,13 @@ RCSID("$Id$") # include #endif +#ifdef HAVE_PCREPOSIX_H +# include +#else #ifdef HAVE_REGEX_H # include #endif +#endif static const char *months[] = { "jan", "feb", "mar", "apr", "may", "jun", diff --git a/src/main/evaluate.c b/src/main/evaluate.c index e1bec5114ca..c0c5480a354 100644 --- a/src/main/evaluate.c +++ b/src/main/evaluate.c @@ -30,6 +30,9 @@ RCSID("$Id$") #include +#ifdef HAVE_PCREPOSIX_H +#include +#else #ifdef HAVE_REGEX_H #include @@ -46,6 +49,7 @@ RCSID("$Id$") #define REG_NOSUB (0) #endif #endif +#endif #ifdef WITH_UNLANG diff --git a/src/main/radiusd.c b/src/main/radiusd.c index e8571a92070..735c2fe299c 100644 --- a/src/main/radiusd.c +++ b/src/main/radiusd.c @@ -256,6 +256,18 @@ int main(int argc, char *argv[]) radlog(L_INFO, "PARTICULAR PURPOSE.\n"); radlog(L_INFO, "You may redistribute copies of FreeRADIUS under the terms of the\n"); radlog(L_INFO, "GNU General Public License v2.\n"); + radlog(L_INFO, "\n"); + radlog(L_INFO, "Compilation options:\n"); +#ifdef HAVE_PCREPOSIX_H + radlog(L_INFO, "Regex flavour: PCRE\n"); +#else +#ifdef HAVE_REGEX_H + radlog(L_INFO, "Regex flavour: Posix\n"); +#else + radlog(L_INFO, "Regex flavour: none\n"); +#endif +#endif + fflush(NULL); } diff --git a/src/main/realms.c b/src/main/realms.c index d5286ff1123..e0f0b02c8fc 100644 --- a/src/main/realms.c +++ b/src/main/realms.c @@ -32,6 +32,9 @@ RCSID("$Id$") #include #include +#ifdef HAVE_PCREPOSIX_H +#include +#else #ifdef HAVE_REGEX_H #include @@ -52,6 +55,7 @@ RCSID("$Id$") #define REG_ICASE (0) #endif #endif +#endif static rbtree_t *realms_byname = NULL; diff --git a/src/main/valuepair.c b/src/main/valuepair.c index 2072d76e4f5..e6f29b62276 100644 --- a/src/main/valuepair.c +++ b/src/main/valuepair.c @@ -30,6 +30,9 @@ RCSID("$Id$") #include #include +#ifdef HAVE_PCREPOSIX_H +#include +#else #ifdef HAVE_REGEX_H # include @@ -46,6 +49,7 @@ RCSID("$Id$") #define REG_NOSUB (0) #endif #endif +#endif struct cmp { unsigned int attribute;