2 # Copyright (C) Igor Sysoev
3 # Copyright (C) Nginx, Inc.
6 if [ $PCRE != NONE ]; then
7 CORE_INCS="$CORE_INCS $PCRE"
12 have=NGX_PCRE . auto/have
13 have=PCRE_STATIC . auto/have
14 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
15 LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
16 CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
20 have=NGX_PCRE . auto/have
21 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
23 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
25 echo $ngx_n "checking for PCRE library ...$ngx_c"
27 if [ -f $PCRE/pcre.h ]; then
28 ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
29 | sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
31 else if [ -f $PCRE/configure.in ]; then
32 ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
33 | sed -e 's/^.*=\(.*\)$/\1/'`
36 ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
37 | sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
41 echo " $ngx_pcre_ver major version found"
43 # to allow -ipo optimization we link with the *.o but not library
45 case "$ngx_pcre_ver" in
47 CORE_LIBS="$CORE_LIBS $PCRE/pcre.o"
51 CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
52 CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
53 CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
54 CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
55 CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
56 CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
57 CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
61 CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
62 CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
63 CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
64 CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
65 CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
66 CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
67 CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
68 CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o"
75 have=NGX_PCRE . auto/have
76 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
77 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
78 CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
84 if [ $PCRE_JIT = YES ]; then
85 have=NGX_HAVE_PCRE_JIT . auto/have
86 PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit"
91 if [ "$NGX_PLATFORM" != win32 ]; then
95 ngx_feature="PCRE library"
96 ngx_feature_name="NGX_PCRE"
98 ngx_feature_incs="#include <pcre.h>"
100 ngx_feature_libs="-lpcre"
101 ngx_feature_test="pcre *re;
102 re = pcre_compile(NULL, 0, NULL, 0, NULL);
103 if (re == NULL) return 1"
106 if [ $ngx_found = no ]; then
110 ngx_feature="PCRE library in /usr/local/"
111 ngx_feature_path="/usr/local/include"
113 if [ $NGX_RPATH = YES ]; then
114 ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpcre"
116 ngx_feature_libs="-L/usr/local/lib -lpcre"
122 if [ $ngx_found = no ]; then
124 # RedHat RPM, Solaris package
126 ngx_feature="PCRE library in /usr/include/pcre/"
127 ngx_feature_path="/usr/include/pcre"
128 ngx_feature_libs="-lpcre"
133 if [ $ngx_found = no ]; then
137 ngx_feature="PCRE library in /usr/pkg/"
138 ngx_feature_path="/usr/pkg/include"
140 if [ $NGX_RPATH = YES ]; then
141 ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
143 ngx_feature_libs="-L/usr/pkg/lib -lpcre"
149 if [ $ngx_found = no ]; then
153 ngx_feature="PCRE library in /opt/local/"
154 ngx_feature_path="/opt/local/include"
156 if [ $NGX_RPATH = YES ]; then
157 ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
159 ngx_feature_libs="-L/opt/local/lib -lpcre"
165 if [ $ngx_found = yes ]; then
166 CORE_INCS="$CORE_INCS $ngx_feature_path"
167 CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
171 if [ $PCRE = YES ]; then
172 ngx_feature="PCRE JIT support"
173 ngx_feature_name="NGX_HAVE_PCRE_JIT"
174 ngx_feature_test="int jit = 0;
175 pcre_free_study(NULL);
176 pcre_config(PCRE_CONFIG_JIT, &jit);
177 if (jit != 1) return 1;"
180 if [ $ngx_found = yes ]; then
186 if [ $PCRE != YES ]; then
189 $0: error: the HTTP rewrite module requires the PCRE library.
190 You can either disable the module by using --without-http_rewrite_module
191 option, or install the PCRE library into the system, or build the PCRE library
192 statically from the source with nginx by using --with-pcre=<path> option.