blob: 5e3960fea3b9125fb5f028c26e6719001549ca43 [file] [log] [blame]
Igor Sysoeve9b2cb12004-02-09 20:47:18 +00001
Igor Sysoevff8da912004-09-29 16:00:49 +00002# Copyright (C) Igor Sysoev
Maxim Konovalovf8d59e32012-01-18 15:07:43 +00003# Copyright (C) Nginx, Inc.
Igor Sysoevff8da912004-09-29 16:00:49 +00004
5
Igor Sysoeve9b2cb12004-02-09 20:47:18 +00006if [ $PCRE != NONE ]; then
Igor Sysoev11dbe972004-03-29 17:43:58 +00007 CORE_INCS="$CORE_INCS $PCRE"
Igor Sysoeve9b2cb12004-02-09 20:47:18 +00008
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00009 case "$NGX_CC_NAME" in
Igor Sysoevfc5a10a2004-03-09 19:47:07 +000010
Maxim Dounine98db542016-02-13 06:47:34 +030011 msvc | owc | bcc)
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000012 have=NGX_PCRE . auto/have
Igor Sysoevfc5a10a2004-03-09 19:47:07 +000013 have=PCRE_STATIC . auto/have
Igor Sysoev3646a162004-03-14 20:46:25 +000014 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
15 LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
Igor Sysoevfc5a10a2004-03-09 19:47:07 +000016 CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
17 ;;
18
Maxim Dounine98db542016-02-13 06:47:34 +030019 icc)
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000020 have=NGX_PCRE . auto/have
Igor Sysoev3646a162004-03-14 20:46:25 +000021 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
22
23 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
24
Igor Sysoevb145b062005-06-15 18:33:41 +000025 echo $ngx_n "checking for PCRE library ...$ngx_c"
26
Igor Sysoevd3f7b532007-07-15 14:45:51 +000027 if [ -f $PCRE/pcre.h ]; then
Igor Sysoevfeb42252007-01-10 16:15:49 +000028 ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
29 | sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
30
Igor Sysoev90b9bfe2007-07-20 18:33:44 +000031 else if [ -f $PCRE/configure.in ]; then
Igor Sysoevfeb42252007-01-10 16:15:49 +000032 ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
33 | sed -e 's/^.*=\(.*\)$/\1/'`
Igor Sysoevae004c02007-07-15 14:44:53 +000034
35 else
36 ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
37 | sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
38 fi
Igor Sysoevfeb42252007-01-10 16:15:49 +000039 fi
Igor Sysoevb145b062005-06-15 18:33:41 +000040
41 echo " $ngx_pcre_ver major version found"
42
Igor Sysoev3646a162004-03-14 20:46:25 +000043 # to allow -ipo optimization we link with the *.o but not library
Igor Sysoevb145b062005-06-15 18:33:41 +000044
45 case "$ngx_pcre_ver" in
Igor Sysoevfeb42252007-01-10 16:15:49 +000046 4|5)
47 CORE_LIBS="$CORE_LIBS $PCRE/pcre.o"
48 ;;
49
Igor Sysoevb145b062005-06-15 18:33:41 +000050 6)
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"
58 ;;
59
60 *)
Igor Sysoevfeb42252007-01-10 16:15:49 +000061 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"
Igor Sysoevb145b062005-06-15 18:33:41 +000069 ;;
Igor Sysoevfeb42252007-01-10 16:15:49 +000070
Igor Sysoevb145b062005-06-15 18:33:41 +000071 esac
Igor Sysoev3646a162004-03-14 20:46:25 +000072 ;;
73
Igor Sysoevfc5a10a2004-03-09 19:47:07 +000074 *)
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000075 have=NGX_PCRE . auto/have
Maxim Dounin48d96ce2013-09-04 20:48:28 +040076
77 if [ "$NGX_PLATFORM" = win32 ]; then
78 have=PCRE_STATIC . auto/have
79 fi
80
Igor Sysoeva893eab2004-03-11 21:34:52 +000081 CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
82 LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
Igor Sysoev9a864bd2004-04-04 20:32:09 +000083 CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
Igor Sysoevfc5a10a2004-03-09 19:47:07 +000084 ;;
85
86 esac
Igor Sysoeve9b2cb12004-02-09 20:47:18 +000087
Valentin Bartenevbc5191c2011-12-26 13:10:36 +000088
89 if [ $PCRE_JIT = YES ]; then
90 have=NGX_HAVE_PCRE_JIT . auto/have
91 PCRE_CONF_OPT="$PCRE_CONF_OPT --enable-jit"
92 fi
93
Igor Sysoeve9b2cb12004-02-09 20:47:18 +000094else
95
Igor Sysoevd039a2e2005-02-22 14:40:13 +000096 if [ "$NGX_PLATFORM" != win32 ]; then
Igor Sysoev76566f82008-05-16 14:32:58 +000097
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000098 PCRE=NO
Igor Sysoev9bfb4342004-04-18 19:06:02 +000099
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000100 ngx_feature="PCRE library"
Igor Sysoevf6906042004-11-25 16:17:31 +0000101 ngx_feature_name="NGX_PCRE"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000102 ngx_feature_run=no
103 ngx_feature_incs="#include <pcre.h>"
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000104 ngx_feature_path=
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000105 ngx_feature_libs="-lpcre"
Maxim Dounina3bdd732012-03-27 16:44:52 +0000106 ngx_feature_test="pcre *re;
107 re = pcre_compile(NULL, 0, NULL, 0, NULL);
108 if (re == NULL) return 1"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000109 . auto/feature
Igor Sysoeve9b2cb12004-02-09 20:47:18 +0000110
Igor Sysoev76566f82008-05-16 14:32:58 +0000111 if [ $ngx_found = no ]; then
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000112
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000113 # FreeBSD port
114
115 ngx_feature="PCRE library in /usr/local/"
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000116 ngx_feature_path="/usr/local/include"
Igor Sysoev274b63e2007-09-19 12:14:05 +0000117
118 if [ $NGX_RPATH = YES ]; then
119 ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpcre"
120 else
121 ngx_feature_libs="-L/usr/local/lib -lpcre"
122 fi
123
Igor Sysoev76566f82008-05-16 14:32:58 +0000124 . auto/feature
125 fi
126
127 if [ $ngx_found = no ]; then
128
Igor Sysoev891f90b2008-08-04 14:54:12 +0000129 # RedHat RPM, Solaris package
Igor Sysoev76566f82008-05-16 14:32:58 +0000130
131 ngx_feature="PCRE library in /usr/include/pcre/"
132 ngx_feature_path="/usr/include/pcre"
133 ngx_feature_libs="-lpcre"
134
135 . auto/feature
136 fi
137
138 if [ $ngx_found = no ]; then
139
140 # NetBSD port
141
142 ngx_feature="PCRE library in /usr/pkg/"
143 ngx_feature_path="/usr/pkg/include"
144
145 if [ $NGX_RPATH = YES ]; then
146 ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
147 else
148 ngx_feature_libs="-L/usr/pkg/lib -lpcre"
149 fi
150
151 . auto/feature
152 fi
153
154 if [ $ngx_found = no ]; then
155
156 # MacPorts
157
158 ngx_feature="PCRE library in /opt/local/"
159 ngx_feature_path="/opt/local/include"
160
161 if [ $NGX_RPATH = YES ]; then
162 ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
163 else
164 ngx_feature_libs="-L/opt/local/lib -lpcre"
165 fi
166
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000167 . auto/feature
Igor Sysoevfc5a10a2004-03-09 19:47:07 +0000168 fi
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000169
170 if [ $ngx_found = yes ]; then
Igor Sysoev0ec09f92006-11-27 11:07:09 +0000171 CORE_INCS="$CORE_INCS $ngx_feature_path"
172 CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
173 PCRE=YES
Igor Sysoev59bb78b2010-07-08 15:57:36 +0000174 fi
Valentin Bartenevbc5191c2011-12-26 13:10:36 +0000175
Valentin Bartenev9d712d92011-12-29 15:58:53 +0000176 if [ $PCRE = YES ]; then
Valentin Bartenevbc5191c2011-12-26 13:10:36 +0000177 ngx_feature="PCRE JIT support"
178 ngx_feature_name="NGX_HAVE_PCRE_JIT"
179 ngx_feature_test="int jit = 0;
Maxim Dounin8ae9e792012-12-12 13:50:07 +0000180 pcre_free_study(NULL);
Valentin Bartenevbc5191c2011-12-26 13:10:36 +0000181 pcre_config(PCRE_CONFIG_JIT, &jit);
182 if (jit != 1) return 1;"
183 . auto/feature
184
185 if [ $ngx_found = yes ]; then
186 PCRE_JIT=YES
187 fi
188 fi
Igor Sysoev59bb78b2010-07-08 15:57:36 +0000189 fi
Igor Sysoevda85fe62009-05-26 14:28:49 +0000190
Igor Sysoev59bb78b2010-07-08 15:57:36 +0000191 if [ $PCRE != YES ]; then
Igor Sysoevda85fe62009-05-26 14:28:49 +0000192cat << END
193
194$0: error: the HTTP rewrite module requires the PCRE library.
195You can either disable the module by using --without-http_rewrite_module
196option, or install the PCRE library into the system, or build the PCRE library
197statically from the source with nginx by using --with-pcre=<path> option.
198
199END
Igor Sysoev59bb78b2010-07-08 15:57:36 +0000200 exit 1
Igor Sysoeve9b2cb12004-02-09 20:47:18 +0000201 fi
Igor Sysoev59bb78b2010-07-08 15:57:36 +0000202
Igor Sysoeve9b2cb12004-02-09 20:47:18 +0000203fi