Mercurial > hg > nginx
comparison auto/lib/pcre/conf @ 7981:0b5f12d5c531
PCRE2 library support.
The PCRE2 library is now used by default if found, instead of the
original PCRE library. If needed for some reason, this can be disabled
with the --without-pcre2 configure option.
To make it possible to specify paths to the library and include files
via --with-cc-opt / --with-ld-opt, the library is first tested without
any additional paths and options. If this fails, the pcre2-config script
is used.
Similarly to the original PCRE library, it is now possible to build PCRE2
from sources with nginx configure, by using the --with-pcre= option.
It automatically detects if PCRE or PCRE2 sources are provided.
Note that compiling PCRE2 10.33 and later requires inttypes.h. When
compiling on Windows with MSVC, inttypes.h is only available starting
with MSVC 2013. In older versions some replacement needs to be provided
("echo '#include <stdint.h>' > pcre2-10.xx/src/inttypes.h" is good enough
for MSVC 2010).
The interface on nginx side remains unchanged.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 25 Dec 2021 01:07:15 +0300 |
parents | 8007ea138d6a |
children |
comparison
equal
deleted
inserted
replaced
7980:8007ea138d6a | 7981:0b5f12d5c531 |
---|---|
3 # Copyright (C) Nginx, Inc. | 3 # Copyright (C) Nginx, Inc. |
4 | 4 |
5 | 5 |
6 if [ $PCRE != NONE ]; then | 6 if [ $PCRE != NONE ]; then |
7 | 7 |
8 have=NGX_PCRE . auto/have | 8 if [ -f $PCRE/src/pcre2.h.generic ]; then |
9 | 9 |
10 if [ "$NGX_PLATFORM" = win32 ]; then | 10 PCRE_LIBRARY=PCRE2 |
11 have=PCRE_STATIC . auto/have | 11 |
12 fi | 12 have=NGX_PCRE . auto/have |
13 | 13 have=NGX_PCRE2 . auto/have |
14 CORE_INCS="$CORE_INCS $PCRE" | 14 |
15 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" | 15 if [ "$NGX_PLATFORM" = win32 ]; then |
16 | 16 have=PCRE2_STATIC . auto/have |
17 case "$NGX_CC_NAME" in | 17 fi |
18 | 18 |
19 msvc | owc | bcc) | 19 CORE_INCS="$CORE_INCS $PCRE/src/" |
20 LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" | 20 CORE_DEPS="$CORE_DEPS $PCRE/src/pcre2.h" |
21 CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" | 21 |
22 ;; | 22 case "$NGX_CC_NAME" in |
23 | 23 |
24 *) | 24 msvc) |
25 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" | 25 LINK_DEPS="$LINK_DEPS $PCRE/src/pcre2-8.lib" |
26 CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" | 26 CORE_LIBS="$CORE_LIBS $PCRE/src/pcre2-8.lib" |
27 ;; | 27 ;; |
28 | 28 |
29 esac | 29 *) |
30 | 30 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre2-8.a" |
31 CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre2-8.a" | |
32 ;; | |
33 | |
34 esac | |
35 | |
36 else | |
37 | |
38 PCRE_LIBRARY=PCRE | |
39 | |
40 have=NGX_PCRE . auto/have | |
41 | |
42 if [ "$NGX_PLATFORM" = win32 ]; then | |
43 have=PCRE_STATIC . auto/have | |
44 fi | |
45 | |
46 CORE_INCS="$CORE_INCS $PCRE" | |
47 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" | |
48 | |
49 case "$NGX_CC_NAME" in | |
50 | |
51 msvc | owc | bcc) | |
52 LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" | |
53 CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" | |
54 ;; | |
55 | |
56 *) | |
57 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" | |
58 CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" | |
59 ;; | |
60 | |
61 esac | |
62 fi | |
31 | 63 |
32 if [ $PCRE_JIT = YES ]; then | 64 if [ $PCRE_JIT = YES ]; then |
33 have=NGX_HAVE_PCRE_JIT . auto/have | 65 have=NGX_HAVE_PCRE_JIT . auto/have |
34 PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit" | 66 PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit" |
35 fi | 67 fi |
36 | 68 |
37 else | 69 else |
38 | 70 |
39 if [ "$NGX_PLATFORM" != win32 ]; then | 71 if [ "$NGX_PLATFORM" != win32 ]; then |
40 | |
41 PCRE=NO | 72 PCRE=NO |
73 fi | |
74 | |
75 if [ $PCRE = NO -a $PCRE2 != DISABLED ]; then | |
76 | |
77 ngx_feature="PCRE2 library" | |
78 ngx_feature_name="NGX_PCRE2" | |
79 ngx_feature_run=no | |
80 ngx_feature_incs="#define PCRE2_CODE_UNIT_WIDTH 8 | |
81 #include <pcre2.h>" | |
82 ngx_feature_path= | |
83 ngx_feature_libs="-lpcre2-8" | |
84 ngx_feature_test="pcre2_code *re; | |
85 re = pcre2_compile(NULL, 0, 0, NULL, NULL, NULL); | |
86 if (re == NULL) return 1" | |
87 . auto/feature | |
88 | |
89 if [ $ngx_found = no ]; then | |
90 | |
91 # pcre2-config | |
92 | |
93 ngx_pcre2_prefix=`pcre2-config --prefix 2>/dev/null` | |
94 | |
95 if [ -n "$ngx_pcre2_prefix" ]; then | |
96 ngx_feature="PCRE2 library in $ngx_pcre2_prefix" | |
97 ngx_feature_path=`pcre2-config --cflags \ | |
98 | sed -n -e 's/.*-I *\([^ ][^ ]*\).*/\1/p'` | |
99 ngx_feature_libs=`pcre2-config --libs8` | |
100 . auto/feature | |
101 fi | |
102 fi | |
103 | |
104 if [ $ngx_found = yes ]; then | |
105 have=NGX_PCRE . auto/have | |
106 CORE_INCS="$CORE_INCS $ngx_feature_path" | |
107 CORE_LIBS="$CORE_LIBS $ngx_feature_libs" | |
108 PCRE=YES | |
109 PCRE_LIBRARY=PCRE2 | |
110 fi | |
111 fi | |
112 | |
113 if [ $PCRE = NO ]; then | |
42 | 114 |
43 ngx_feature="PCRE library" | 115 ngx_feature="PCRE library" |
44 ngx_feature_name="NGX_PCRE" | 116 ngx_feature_name="NGX_PCRE" |
45 ngx_feature_run=no | 117 ngx_feature_run=no |
46 ngx_feature_incs="#include <pcre.h>" | 118 ngx_feature_incs="#include <pcre.h>" |
112 | 184 |
113 if [ $ngx_found = yes ]; then | 185 if [ $ngx_found = yes ]; then |
114 CORE_INCS="$CORE_INCS $ngx_feature_path" | 186 CORE_INCS="$CORE_INCS $ngx_feature_path" |
115 CORE_LIBS="$CORE_LIBS $ngx_feature_libs" | 187 CORE_LIBS="$CORE_LIBS $ngx_feature_libs" |
116 PCRE=YES | 188 PCRE=YES |
189 PCRE_LIBRARY=PCRE | |
117 fi | 190 fi |
118 | 191 |
119 if [ $PCRE = YES ]; then | 192 if [ $PCRE = YES ]; then |
120 ngx_feature="PCRE JIT support" | 193 ngx_feature="PCRE JIT support" |
121 ngx_feature_name="NGX_HAVE_PCRE_JIT" | 194 ngx_feature_name="NGX_HAVE_PCRE_JIT" |