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