From 55e1d7ad25b8e035c6faaab7fc8685fb0e3ebc1b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 11 Feb 2012 20:04:50 +0100 Subject: [PATCH] Config: Regularized configuration of regex libs --- ucw/default.cfg | 4 ++++ ucw/libucw.pc | 2 +- ucw/perl/UCW/Configure/C.pm | 4 ---- ucw/perl/UCW/Configure/LibUCW.pm | 8 ++++++++ ucw/regex.c | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ucw/default.cfg b/ucw/default.cfg index 75fb6353..ff970e09 100644 --- a/ucw/default.cfg +++ b/ucw/default.cfg @@ -59,5 +59,9 @@ Set("CONFIG_UCW_FB_DIRECT"); # Use epoll (needs support in libc and kernel, default: auto-detect) # Set("CONFIG_UCW_EPOLL"); +# Which regular expression library should be used? If none is selected, we use BSD regex from libc. +UnSet("CONFIG_UCW_POSIX_REGEX"); +UnSet("CONFIG_UCW_PCRE"); + # Return success 1; diff --git a/ucw/libucw.pc b/ucw/libucw.pc index f55aafbc..b84b783d 100644 --- a/ucw/libucw.pc +++ b/ucw/libucw.pc @@ -9,7 +9,7 @@ threads=-lpthread threads= #endif -#ifdef CONFIG_PCRE +#ifdef CONFIG_UCW_PCRE regex=-lpcre #else regex= diff --git a/ucw/perl/UCW/Configure/C.pm b/ucw/perl/UCW/Configure/C.pm index 88dbfd52..ccd20cbf 100644 --- a/ucw/perl/UCW/Configure/C.pm +++ b/ucw/perl/UCW/Configure/C.pm @@ -261,10 +261,6 @@ if (IsSet("CONFIG_DARWIN")) { } else { UnSet("CONFIG_UCW_DIRECT_IO"); } - if (!IsSet("CONFIG_POSIX_REGEX") && !IsSet("CONFIG_PCRE")) { - Set("CONFIG_POSIX_REGEX" => 1); - Warn "BSD regex library on Darwin isn't compatible, using POSIX regex.\n"; - } } ### Compiling test programs ### diff --git a/ucw/perl/UCW/Configure/LibUCW.pm b/ucw/perl/UCW/Configure/LibUCW.pm index 81c94598..8349eb68 100644 --- a/ucw/perl/UCW/Configure/LibUCW.pm +++ b/ucw/perl/UCW/Configure/LibUCW.pm @@ -66,6 +66,14 @@ int main(void) FINIS }); +# Darwin does not support BSD regexes, fix up +if (IsSet("CONFIG_DARWIN")) { + if (!IsSet("CONFIG_UCW_POSIX_REGEX") && !IsSet("CONFIG_UCW_PCRE")) { + Set("CONFIG_UCW_POSIX_REGEX" => 1); + Warn "BSD regex library on Darwin isn't compatible, using POSIX regex.\n"; + } +} + PostConfig { AtWrite { UCW::Configure::C::ConfigHeader("ucw/autoconf.h", [ diff --git a/ucw/regex.c b/ucw/regex.c index 6ead4648..7b89818e 100644 --- a/ucw/regex.c +++ b/ucw/regex.c @@ -16,7 +16,7 @@ #include #include -#ifdef CONFIG_POSIX_REGEX +#ifdef CONFIG_UCW_POSIX_REGEX /* POSIX regular expression library */ @@ -104,7 +104,7 @@ rx_subst(regex *r, const char *by, const char *src, char *dest, uns destlen) return 1; } -#elif defined(CONFIG_PCRE) +#elif defined(CONFIG_UCW_PCRE) /* PCRE library */ -- 2.39.2