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