support for PCRE
authorPhil Mayers <p.mayers@imperial.ac.uk>
Mon, 25 Jul 2011 14:18:12 +0000 (15:18 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 Jul 2011 13:47:55 +0000 (09:47 -0400)
configure.in
src/lib/valuepair.c
src/main/evaluate.c
src/main/radiusd.c
src/main/realms.c
src/main/valuepair.c

index 28f7227..5f4936c 100644 (file)
@@ -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 <pcreposix.h> 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 <regex.h> 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 <regex.h>
@@ -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.h>)]) REGEX_EXTENDED=yes])
 fi
+fi
+
 AC_SUBST(REGEX)
+AC_SUBST(REGEX_PCRE)
 AC_SUBST(REGEX_EXTENDED)
 
 dnl #
index e7258ca..4075c59 100644 (file)
@@ -31,9 +31,13 @@ RCSID("$Id$")
 #  include     <malloc.h>
 #endif
 
+#ifdef HAVE_PCREPOSIX_H
+#  include     <pcreposix.h>
+#else
 #ifdef HAVE_REGEX_H
 #  include     <regex.h>
 #endif
+#endif
 
 static const char *months[] = {
         "jan", "feb", "mar", "apr", "may", "jun",
index e1bec51..c0c5480 100644 (file)
@@ -30,6 +30,9 @@ RCSID("$Id$")
 
 #include <ctype.h>
 
+#ifdef HAVE_PCREPOSIX_H
+#include <pcreposix.h>
+#else
 #ifdef HAVE_REGEX_H
 #include <regex.h>
 
@@ -46,6 +49,7 @@ RCSID("$Id$")
 #define REG_NOSUB (0)
 #endif
 #endif
+#endif
 
 #ifdef WITH_UNLANG
 
index e8571a9..735c2fe 100644 (file)
@@ -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);
        }
 
index d5286ff..e0f0b02 100644 (file)
@@ -32,6 +32,9 @@ RCSID("$Id$")
 #include <ctype.h>
 #include <fcntl.h>
 
+#ifdef HAVE_PCREPOSIX_H
+#include <pcreposix.h>
+#else
 #ifdef HAVE_REGEX_H
 #include <regex.h>
 
@@ -52,6 +55,7 @@ RCSID("$Id$")
 #define REG_ICASE (0)
 #endif
 #endif
+#endif
 
 static rbtree_t *realms_byname = NULL;
 
index 2072d76..e6f29b6 100644 (file)
@@ -30,6 +30,9 @@ RCSID("$Id$")
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/rad_assert.h>
 
+#ifdef HAVE_PCREPOSIX_H
+#include <pcreposix.h>
+#else
 #ifdef HAVE_REGEX_H
 #      include <regex.h>
 
@@ -46,6 +49,7 @@ RCSID("$Id$")
 #define REG_NOSUB (0)
 #endif
 #endif
+#endif
 
 struct cmp {
        unsigned int attribute;