Renaming #define STATIC to STATIC_PCRE
[privoxy.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl 
3 dnl $Id: configure.in,v 1.7 2001/07/13 13:58:05 oes Exp $
4 dnl 
5 dnl Written by and Copyright (C) 2001 the SourceForge
6 dnl IJBSWA team.  http://ijbswa.sourceforge.net
7 dnl
8 dnl Based on the Internet Junkbuster originally written
9 dnl by and Copyright (C) 1997 Anonymous Coders and 
10 dnl Junkbusters Corporation.  http://www.junkbusters.com
11 dnl
12 dnl This program is free software; you can redistribute it 
13 dnl and/or modify it under the terms of the GNU General
14 dnl Public License as published by the Free Software
15 dnl Foundation; either version 2 of the License, or (at
16 dnl your option) any later version.
17 dnl 
18 dnl This program is distributed in the hope that it will
19 dnl be useful, but WITHOUT ANY WARRANTY; without even the
20 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A
21 dnl PARTICULAR PURPOSE.  See the GNU General Public
22 dnl License for more details.
23 dnl 
24 dnl The GNU General Public License should be included with
25 dnl this file.  If not, you can view it at
26 dnl http://www.gnu.org/copyleft/gpl.html
27 dnl or write to the Free Software Foundation, Inc., 59
28 dnl Temple Place - Suite 330, Boston, MA  02111-1307, USA.
29 dnl 
30 dnl $Log: configure.in,v $
31 dnl Revision 1.7  2001/07/13 13:58:05  oes
32 dnl    Completely reorganized the selection scheme for
33 dnl    pcre, pcreposix, pcrs and gnu_regex:
34 dnl
35 dnl    The presence of shared pcre, pcreposix or pcrs
36 dnl    libraried is now autodetected. Additionally, the
37 dnl    user can enforce using the built-in static variants
38 dnl    by specifying --disable-dynamic-(pcre|pcrs).
39 dnl    Care is taken to avoid that pcre is dyn, while pcreposix
40 dnl    is static, if both are used and that pcrs is static if
41 dnl    pcrs is.
42 dnl
43 dnl    The choice between pcre, gnu or no regex for actionsfile
44 dnl    URL matching is now via
45 dnl    --(enable|disable)-regex-matching[=(gnu|pcre|no)] with the
46 dnl    default being pcre.
47 dnl
48 dnl Revision 1.6  2001/06/29 21:56:40  oes
49 dnl Version -> 2.9.5
50 dnl
51 dnl Revision 1.5  2001/06/29 13:26:27  oes
52 dnl Introduced #define CODE_STATUS
53 dnl
54 dnl Revision 1.4  2001/05/29 09:50:24  jongfoster
55 dnl Unified blocklist/imagelist/permissionslist.
56 dnl File format is still under discussion, but the internal changes
57 dnl are (mostly) done.
58 dnl
59 dnl Also modified interceptor behaviour:
60 dnl - We now intercept all URLs beginning with one of the following
61 dnl   prefixes (and *only* these prefixes):
62 dnl     * http://i.j.b/
63 dnl     * http://ijbswa.sf.net/config/
64 dnl     * http://ijbswa.sourceforge.net/config/
65 dnl - New interceptors "home page" - go to http://i.j.b/ to see it.
66 dnl - Internal changes so that intercepted and fast redirect pages
67 dnl   are not replaced with an image.
68 dnl - Interceptors now have the option to send a binary page direct
69 dnl   to the client. (i.e. ijb-send-banner uses this)
70 dnl - Implemented show-url-info interceptor.  (Which is why I needed
71 dnl   the above interceptors changes - a typical URL is
72 dnl   "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
73 dnl   The previous mechanism would not have intercepted that, and
74 dnl   if it had been intercepted then it then it would have replaced
75 dnl   it with an image.)
76 dnl
77 dnl Revision 1.3  2001/05/22 18:46:04  oes
78 dnl
79 dnl - Enabled filtering banners by size rather than URL
80 dnl   by adding patterns that replace all standard banner
81 dnl   sizes with the "Junkbuster" gif to the re_filterfile
82 dnl
83 dnl - Enabled filtering WebBugs by providing a pattern
84 dnl   which kills all 1x1 images
85 dnl
86 dnl - Added support for PCRE_UNGREEDY behaviour to pcrs,
87 dnl   which is selected by the (nonstandard and therefore
88 dnl   capital) letter 'U' in the option string.
89 dnl   It causes the quantifiers to be ungreedy by default.
90 dnl   Appending a ? turns back to greedy (!).
91 dnl
92 dnl - Added a new interceptor ijb-send-banner, which
93 dnl   sends back the "Junkbuster" gif. Without imagelist or
94 dnl   MSIE detection support, or if tinygif = 1, or the
95 dnl   URL isn't recognized as an imageurl, a lame HTML
96 dnl   explanation is sent instead.
97 dnl
98 dnl - Added new feature, which permits blocking remote
99 dnl   script redirects and firing back a local redirect
100 dnl   to the browser.
101 dnl   The feature is conditionally compiled, i.e. it
102 dnl   can be disabled with --disable-fast-redirects,
103 dnl   plus it must be activated by a "fast-redirects"
104 dnl   line in the config file, has its own log level
105 dnl   and of course wants to be displayed by show-proxy-args
106 dnl   Note: Boy, all the #ifdefs in 1001 locations and
107 dnl   all the fumbling with configure.in and acconfig.h
108 dnl   were *way* more work than the feature itself :-(
109 dnl
110 dnl - Because a generic redirect template was needed for
111 dnl   this, tinygif = 3 now uses the same.
112 dnl
113 dnl - Moved GIFs, and other static HTTP response templates
114 dnl   to project.h
115 dnl
116 dnl - Some minor fixes
117 dnl
118 dnl - Removed some >400 CRs again (Jon, you really worked
119 dnl   a lot! ;-)
120 dnl
121 dnl Revision 1.2  2001/05/20 01:21:20  jongfoster
122 dnl Version 2.9.4 checkin.
123 dnl - Merged popupfile and cookiefile, and added control over PCRS
124 dnl   filtering, in new "permissionsfile".
125 dnl - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
126 dnl   file error you now get a message box (in the Win32 GUI) rather
127 dnl   than the program exiting with no explanation.
128 dnl - Made killpopup use the PCRS MIME-type checking and HTTP-header
129 dnl   skipping.
130 dnl - Removed tabs from "config"
131 dnl - Moved duplicated url parsing code in "loaders.c" to a new funcition.
132 dnl - Bumped up version number.
133 dnl
134 dnl Revision 1.1.1.1  2001/05/15 13:58:50  oes
135 dnl Initial import of version 2.9.3 source tree
136 dnl
137 dnl 
138 AC_INIT(jcc.c)
139 AC_CONFIG_HEADER(config.h)
140
141 VERSION_MAJOR=2
142 VERSION_MINOR=9
143 VERSION_POINT=6
144
145 AC_SUBST(VERSION_MAJOR)
146 AC_SUBST(VERSION_MINOR)
147 AC_SUBST(VERSION_POINT)
148
149 dnl This can be "alpha", "beta", or "stable"
150 dnl and will be used for CGI output
151 dnl
152 AC_DEFINE(CODE_STATUS, "alpha")
153
154 AC_DEFINE_UNQUOTED(VERSION_MAJOR,${VERSION_MAJOR})
155 AC_DEFINE_UNQUOTED(VERSION_MINOR,${VERSION_MINOR})
156 AC_DEFINE_UNQUOTED(VERSION_POINT,${VERSION_POINT})
157 AC_DEFINE_UNQUOTED(VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_POINT}")
158
159 dnl Checks for programs.
160 dnl AC_PROG_CXX
161 AC_PROG_CC
162 AC_PROG_CPP
163 dnl AC_PROG_INSTALL
164 dnl AC_PROG_LN_S
165 dnl AC_PROG_MAKE_SET
166 dnl RANLIB is for PCRE:
167 dnl AC_PROG_RANLIB
168
169 AC_MINGW32
170 AC_CYGWIN
171 AC_EXEEXT
172 AC_OBJEXT
173
174 dnl Checks for libraries.
175 AC_CHECK_LIB(pcre, pcre_compile, [have_pcre=yes], [have_pcre=no])
176 AC_CHECK_LIB(pcreposix, regcomp, [have_pcreposix=yes], [have_pcreposix=no], -lpcre)
177 AC_CHECK_LIB(pcrs, pcrs_compile, [have_pcrs=yes], [have_pcrs=no])
178
179 dnl Checks for header files.
180 AC_HEADER_STDC
181 dnl AC_HEADER_SYS_WAIT
182 dnl AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/time.h unistd.h)
183 dnl limits.h is for PCRE:
184 dnl AC_CHECK_HEADERS(limits.h)
185
186 dnl Checks for typedefs, structures, and compiler characteristics.
187 AC_C_CONST
188 AC_TYPE_SIZE_T
189
190 dnl Checks for library functions.
191 dnl AC_TYPE_SIGNAL
192 dnl AC_CHECK_FUNC(strstr)
193 dnl bcopy and memmove are for PCRE
194 AC_CHECK_FUNCS(strerror bcopy memmove)
195
196 dnl Build type
197
198 AC_ARG_ENABLE(mingw32,
199 [  --enable-mingw32        Use mingw32 for a Windows GUI],
200 [if test $enableval = yes; then
201     WIN_ONLY=
202     CYGWIN_FLAGS="-mwindows -mno-cygwin"
203     echo "Using mingw32 (Win32 GUI)"
204   else
205     WIN_ONLY=#
206     if test "$CYGWIN" = "yes"; then
207       CYGWIN_FLAGS="-mno-win32"
208       echo "Using Cygnus (Win32 command line)"
209     else
210       CYGWIN_FLAGS=
211     fi
212   fi],
213 [if test "$MINGW32" = "yes"; then
214     WIN_ONLY=
215     CYGWIN_FLAGS="-mwindows -mno-cygwin"
216     echo "Using mingw32 (Win32 GUI)"
217   else
218     WIN_ONLY=#
219     if test "$CYGWIN" = "yes"; then
220       CYGWIN_FLAGS="-mno-win32"
221       echo "Using Cygnus (Win32 command line)"
222     else
223       CYGWIN_FLAGS=
224     fi
225   fi])
226
227 AC_SUBST(WIN_ONLY)
228 AC_SUBST(CYGWIN_FLAGS)
229
230 SOLARIS_ONLY=#
231 AC_SUBST(SOLARIS_ONLY)
232
233 dnl Features
234
235 AC_ARG_ENABLE(toggle,
236 [  --disable-toggle        Don't support temporary disable],
237 [if test $enableval = yes; then
238   AC_DEFINE(TOGGLE)
239 fi],AC_DEFINE(TOGGLE))
240
241 AC_ARG_ENABLE(pthread,
242 [  --disable-pthread       Don't use POSIX threads (pthreads)],
243 [if test $enableval = yes; then
244   AC_DEFINE(FEATURE_PTHREAD)
245 fi],AC_DEFINE(FEATURE_PTHREAD))
246
247 AC_ARG_ENABLE(gzip,
248 [  --enable-gzip           Allow gzip'ed transfer of documents. Note that this will make content modification impossible.],
249 [if test $enableval = "no"; then
250   AC_DEFINE(DENY_GZIP)
251 fi])
252
253 AC_ARG_ENABLE(force,
254 [  --disable-force         Don't allow blockfle to be bypassed],
255 [if test $enableval = yes; then
256   AC_DEFINE(FORCE_LOAD)
257 fi],AC_DEFINE(FORCE_LOAD))
258
259 AC_ARG_ENABLE(fast-redirects,
260 [  --disable-fast-redirects Don't support fast redirects],
261 [if test $enableval = yes; then
262   AC_DEFINE(FAST_REDIRECTS)
263 fi], AC_DEFINE(FAST_REDIRECTS))
264
265 AC_ARG_ENABLE(killpopup,
266 [  --disable-killpopup     Never block popups],
267 [if test $enableval = yes; then
268   AC_DEFINE(KILLPOPUPS)
269 fi],AC_DEFINE(KILLPOPUPS))
270
271 AC_ARG_ENABLE(stats,
272 [  --disable-stats         Don't keep statistics],
273 [if test $enableval = yes; then
274   AC_DEFINE(STATISTICS)
275 fi],AC_DEFINE(STATISTICS))
276
277 AC_ARG_ENABLE(split-proxy-args,
278 [  --disable-split-proxy-args  One big show-proxy-args page, not one per file.],
279 [if test $enableval = yes; then
280   AC_DEFINE(SPLIT_PROXY_ARGS)
281 fi],AC_DEFINE(SPLIT_PROXY_ARGS))
282
283 AC_ARG_ENABLE(webdav,
284 [  --disable-webdav        Don't support WebDAV.  This option stops MS Outlook
285                           Express from accessing HotMail e-mail.],
286 [if test $enableval = yes; then
287   AC_DEFINE(WEBDAV)
288 fi],
289 AC_DEFINE(WEBDAV))
290
291 AC_ARG_ENABLE(ie-images,
292 [  --disable-ie-images     Don't auto-detect whether a request from MS Internet
293                           Explorer is for an image or HTML.],
294 [if test $enableval = yes; then
295   AC_DEFINE(DETECT_MSIE_IMAGES)
296 fi],
297 AC_DEFINE(DETECT_MSIE_IMAGES))
298
299 AC_ARG_ENABLE(image-blocking,
300 [  --disable-image-blocking  Don't try to figure out whether a request is 
301                             for an image or HTML - assume HTML.],
302 [if test $enableval = yes; then
303   AC_DEFINE(IMAGE_BLOCKING)
304 fi],
305 AC_DEFINE(IMAGE_BLOCKING))
306
307 AC_ARG_ENABLE(acl-files,
308 [  --disable-acl-files     Prevents the use of ACL files to control access to
309                           the proxy by IP address.],
310 [if test $enableval = yes; then
311   AC_DEFINE(ACL_FILES)
312 fi],
313 AC_DEFINE(ACL_FILES))
314
315 AC_ARG_ENABLE(trust-files,
316 [  --disable-trust-files   Prevents the use of trust files.],
317 [if test $enableval = yes; then
318   AC_DEFINE(TRUST_FILES)
319 fi],
320 AC_DEFINE(TRUST_FILES))
321
322 AC_ARG_ENABLE(jar-files,
323 [  --disable-jar-files     Prevents the use of jar files to capture cookies.],
324 [if test $enableval = yes; then
325   AC_DEFINE(JAR_FILES)
326 fi],
327 AC_DEFINE(JAR_FILES))
328
329 dnl pcre/pcrs is needed for CGI anyway, so
330 dnl the choice is only between static and
331 dnl dynamic:
332
333 AC_ARG_ENABLE(regex-matching,
334 [  --enable-regex-matching=pcre     Use perl-compatible regex for actionsfile pattern matching (default)
335   --enable-regex-matching=gnu      Use gnu style regex for actionsfile pattern matching (-> bigger binary)
336   --disable-regex-matching         Don't use regex matching, compare URL prefix instead (won't shrink birary)],
337 [ regex_matching=$enableval ],
338 [ regex_matching=pcre ])
339
340 AC_ARG_ENABLE(dynamic-pcre,
341 [  --disable-dynamic-pcre           Use the built-in, static pcre, even if libpcre is available],
342 [ if test $enableval = "no"; then have_pcre=no; fi ])
343
344 AC_ARG_ENABLE(dynamic-pcrs,
345 [  --disable-dynamic-pcrs           Use the built-in, static pcrs, even if libpcrs is available],
346 [ if test $enableval = "no"; then have_pcrs=no; fi ])
347
348
349 # Is the regex URL matching based on libpcreposix, but we
350 # don't have that library?
351 #
352 if test $have_pcreposix = "yes" -o $regex_matching != "pcre"; then
353   dont_miss_pcreposix=yes
354 else
355   dont_miss_pcreposix=no
356 fi
357
358 # If we have libpcre and either we also have pcreposix or
359 # we don't need pcreposix, then link pcre dynamically; else
360 # build it and link statically
361 #
362 if test $have_pcre = "yes" -a $dont_miss_pcreposix = "yes"; then
363   echo "using libpcre"
364   pcre_dyn=yes
365   STATIC_PCRE_ONLY=#
366   LIBS="$LIBS -lpcre"
367 else
368   echo "using built-in static pcre"
369   pcre_dyn=no
370   AC_DEFINE(STATIC_PCRE)
371   STATIC_PCRE_ONLY=
372 fi
373
374 # If we have libpcrs and pcre is linked dynamically
375 # then also link pcrs dynamically, else build and link
376 # pcrs statically
377 #
378 if test $have_pcrs = "yes" -a $pcre_dyn = "yes"; then
379   echo "using libpcrs"
380   STATIC_PCRS_ONLY=#
381   LIBS="$LIBS -lpcrs"
382 else
383   echo "using built-in static pcrs"
384   AC_DEFINE(STATIC_PCRS)
385   STATIC_PCRS_ONLY=
386 fi
387
388 # Which method should be used for URL matching?
389 # pcre, gnu regex or prefix matching?
390 #
391 if test $regex_matching = "gnu"; then
392   echo "using gnu regex for URL matching"
393   AC_DEFINE(REGEX_GNU)
394   GNU_REGEX_ONLY=
395   PCRE_REGEX_ONLY=#
396 elif test $regex_matching = "pcre"; then
397   echo "using pcre regex for URL matching"
398   AC_DEFINE(REGEX_PCRE)
399   GNU_REGEX_ONLY=#
400   PCRE_REGEX_ONLY=
401   if test $pcre_dyn = "yes"; then
402     LIBS="$LIBS -lpcreposix"
403   fi
404 else
405   echo -e "using prefix matching for URLs\nHint: This does NOT make the executable any smaller!"
406   GNU_REGEX_ONLY=#
407   PCRE_REGEX_ONLY=#
408 fi
409
410 AC_SUBST(GNU_REGEX_ONLY)
411 AC_SUBST(PCRE_REGEX_ONLY)
412 AC_SUBST(STATIC_PCRE_ONLY)
413 AC_SUBST(STATIC_PCRS_ONLY)
414
415 AC_OUTPUT(Makefile)
416