summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorAxel Duch <axel.duch@nginx.com>2020-11-17 15:03:30 +0000
committerAxel Duch <axel.duch@nginx.com>2020-11-17 15:03:30 +0000
commite3af18834d7cc32734cba7532d8864bb343b416b (patch)
tree578c68e31396926abff818cdaf6cb83116157511 /auto
parent2a381a82a6e1bc2bd5d2f43a08fce50a1994f2e8 (diff)
downloadunit-e3af18834d7cc32734cba7532d8864bb343b416b.tar.gz
unit-e3af18834d7cc32734cba7532d8864bb343b416b.tar.bz2
Router: matching regular expressions support.
Diffstat (limited to 'auto')
-rw-r--r--auto/help2
-rw-r--r--auto/options10
-rw-r--r--auto/pcre56
-rw-r--r--auto/sources11
4 files changed, 62 insertions, 17 deletions
diff --git a/auto/help b/auto/help
index f5f10010..31c68567 100644
--- a/auto/help
+++ b/auto/help
@@ -35,6 +35,8 @@ cat << END
--no-ipv6 disable IPv6 support
--no-unix-sockets disable Unix domain sockets support
+ --no-regex disable regular expression support
+ --no-pcre2 force using PCRE library
--openssl enable OpenSSL library usage
diff --git a/auto/options b/auto/options
index d315b227..b6007bc2 100644
--- a/auto/options
+++ b/auto/options
@@ -16,8 +16,11 @@ NXT_DEBUG=NO
NXT_INET6=YES
NXT_UNIX_DOMAIN=YES
-NXT_REGEX=NO
-NXT_PCRE=NO
+NXT_PCRE_CFLAGS=
+NXT_PCRE_LIB=
+
+NXT_REGEX=YES
+NXT_TRY_PCRE2=YES
NXT_TLS=NO
NXT_OPENSSL=NO
@@ -73,7 +76,8 @@ do
--no-ipv6) NXT_INET6=NO ;;
--no-unix-sockets) NXT_UNIX_DOMAIN=NO ;;
- --pcre) NXT_PCRE=YES ;;
+ --no-regex) NXT_REGEX=NO ;;
+ --no-pcre2) NXT_TRY_PCRE2=NO ;;
--openssl) NXT_OPENSSL=YES ;;
--gnutls) NXT_GNUTLS=YES ;;
diff --git a/auto/pcre b/auto/pcre
index e8765cef..955e4baf 100644
--- a/auto/pcre
+++ b/auto/pcre
@@ -3,15 +3,41 @@
# Copyright (C) NGINX, Inc.
-NXT_REGEX=NO
-NXT_PCRE_CFLAGS=
-NXT_PCRE_LIB=
+nxt_found=no
+NXT_HAVE_PCRE2=NO
+if [ $NXT_TRY_PCRE2 = YES ]; then
+ if /bin/sh -c "(pcre2-config --version)" >> $NXT_AUTOCONF_ERR 2>&1; then
-if [ $NXT_PCRE = YES ]; then
+ NXT_PCRE_CFLAGS=`pcre2-config --cflags`
+ NXT_PCRE_LIB=`pcre2-config --libs8`
- nxt_found=no
+ nxt_feature="PCRE2 library"
+ nxt_feature_name=NXT_HAVE_PCRE2
+ nxt_feature_run=no
+ nxt_feature_incs="-DPCRE2_CODE_UNIT_WIDTH=8 $NXT_PCRE_CFLAGS"
+ nxt_feature_libs=$NXT_PCRE_LIB
+ nxt_feature_test="#include <pcre2.h>
+
+ int main(void) {
+ pcre2_code *re;
+
+ re = pcre2_compile((PCRE2_SPTR)\"\",
+ PCRE2_ZERO_TERMINATED, 0,
+ NULL, NULL, NULL);
+ return (re == NULL);
+ }"
+
+ . auto/feature
+
+ if [ $nxt_found = yes ]; then
+ NXT_HAVE_PCRE2=YES
+ $echo " + PCRE2 version: `pcre2-config --version`"
+ fi
+ fi
+fi
+if [ $nxt_found = no ]; then
if /bin/sh -c "(pcre-config --version)" >> $NXT_AUTOCONF_ERR 2>&1; then
NXT_PCRE_CFLAGS=`pcre-config --cflags`
@@ -33,17 +59,19 @@ if [ $NXT_PCRE = YES ]; then
return 0;
}"
. auto/feature
- fi
- if [ $nxt_found = no ]; then
- $echo
- $echo $0: error: no PCRE library found.
- $echo
- exit 1;
+ if [ $nxt_found = yes ]; then
+ $echo " + PCRE version: `pcre-config --version`"
+ fi
fi
+fi
- NXT_REGEX=YES
- nxt_have=NXT_REGEX . auto/have
+if [ $nxt_found = yes ]; then
+ nxt_have=NXT_HAVE_REGEX . auto/have
- $echo " + PCRE version: `pcre-config --version`"
+else
+ $echo
+ $echo $0: error: no PCRE library found.
+ $echo
+ exit 1;
fi
diff --git a/auto/sources b/auto/sources
index e44dc4bb..01fec6c1 100644
--- a/auto/sources
+++ b/auto/sources
@@ -128,6 +128,9 @@ NXT_LIB_GNUTLS_SRCS="src/nxt_gnutls.c"
NXT_LIB_CYASSL_SRCS="src/nxt_cyassl.c"
NXT_LIB_POLARSSL_SRCS="src/nxt_polarssl.c"
+NXT_LIB_PCRE_SRCS="src/nxt_pcre.c"
+NXT_LIB_PCRE2_SRCS="src/nxt_pcre2.c"
+
NXT_LIB_EPOLL_SRCS="src/nxt_epoll_engine.c"
NXT_LIB_KQUEUE_SRCS="src/nxt_kqueue_engine.c"
NXT_LIB_EVENTPORT_SRCS="src/nxt_eventport_engine.c"
@@ -211,6 +214,14 @@ if [ $NXT_POLARSSL = YES ]; then
fi
+if [ "$NXT_REGEX" = "YES" ]; then
+ if [ "$NXT_HAVE_PCRE2" = "YES" ]; then
+ NXT_LIB_SRCS="$NXT_LIB_SRCS $NXT_LIB_PCRE2_SRCS"
+ else
+ NXT_LIB_SRCS="$NXT_LIB_SRCS $NXT_LIB_PCRE_SRCS"
+ fi
+fi
+
if [ "$NXT_HAVE_EPOLL" = "YES" -o "$NXT_TEST_BUILD_EPOLL" = "YES" ]; then
NXT_LIB_SRCS="$NXT_LIB_SRCS $NXT_LIB_EPOLL_SRCS"
fi