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