714a278daa66d59c66446e4379535af0abffe054
[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.25 2002/01/04 15:27:18 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.25  2002/01/04 15:27:18  oes
32 dnl Changed quoting of CODE_STATUS for use in make
33 dnl
34 dnl Revision 1.24  2001/12/30 14:07:31  steudten
35 dnl - Add signal handling (unix)
36 dnl - Add SIGHUP handler (unix)
37 dnl - Add creation of pidfile (unix)
38 dnl - Add action 'top' in rc file (RH)
39 dnl - Add entry 'SIGNALS' to manpage
40 dnl - Add exit message to logfile (unix)
41 dnl
42 dnl Revision 1.23  2001/12/09 20:24:42  david__schmidt
43 dnl Change from "alpha" to "beta" in configure.in
44 dnl
45 dnl Revision 1.22  2001/12/01 11:24:01  jongfoster
46 dnl Renaming Makefile.in to GNUmakefile.in so that non-GNU versions of
47 dnl make break in a more obvious way.
48 dnl
49 dnl Revision 1.21  2001/11/30 21:35:54  jongfoster
50 dnl Bumping version number to 2.9.10
51 dnl
52 dnl Revision 1.20  2001/10/23 21:24:09  jongfoster
53 dnl Support for FEATURE_CGI_EDIT_ACTIONS
54 dnl
55 dnl Revision 1.19  2001/10/07 15:33:14  oes
56 dnl Removed FEATURE_DENY_GZIP
57 dnl Bumped up version number
58 dnl
59 dnl Revision 1.18  2001/09/13 13:10:24  steudten
60 dnl
61 dnl PreWork for Debug Interface.
62 dnl Add new option "--with-debug" to enable debugging (flags aso.)
63 dnl
64 dnl Revision 1.17  2001/09/12 23:44:55  david__schmidt
65 dnl Mac OSX (Darwin) support added.
66 dnl
67 dnl Revision 1.16  2001/09/12 22:55:45  joergs
68 dnl AmigaOS support added.
69 dnl
70 dnl Revision 1.15  2001/09/12 17:28:59  david__schmidt
71 dnl
72 dnl OS/2 port: update autoconf'd support for the platform.
73 dnl
74 dnl Revision 1.14  2001/07/30 22:12:11  jongfoster
75 dnl Fixing Solaris build (I hope) and tidying up #defines:
76 dnl - All feature #defines are now of the form FEATURE_xxx
77 dnl - Permanently turned off WIN_GUI_EDIT
78 dnl - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
79 dnl
80 dnl Revision 1.13  2001/07/29 17:09:17  jongfoster
81 dnl Major changes to build system in order to fix these bugs:
82 dnl - pthreads under Linux was broken - changed -lpthread to -pthread
83 dnl - Compiling in MinGW32 mode under CygWin now correctly detects
84 dnl   which shared libraries are available
85 dnl - Solaris support (?) (Not tested under Solaris yet)
86 dnl
87 dnl Revision 1.12  2001/07/25 19:16:27  oes
88 dnl Bumping version number to 2.9.8
89 dnl
90 dnl Revision 1.11  2001/07/21 18:00:07  jongfoster
91 dnl Bumping version number to 2.9.7
92 dnl
93 dnl Revision 1.10  2001/07/18 17:25:04  oes
94 dnl Fixed a typo
95 dnl
96 dnl Revision 1.9  2001/07/15 19:45:13  jongfoster
97 dnl Added support for linking with POSIX threads library
98 dnl
99 dnl Revision 1.8  2001/07/15 17:54:29  jongfoster
100 dnl Renaming #define STATIC to STATIC_PCRE
101 dnl Adding new #define FEATURE_PTHREAD that will be used to enable
102 dnl POSIX threads support.
103 dnl
104 dnl Revision 1.7  2001/07/13 13:58:05  oes
105 dnl    Completely reorganized the selection scheme for
106 dnl    pcre, pcreposix, pcrs and gnu_regex:
107 dnl
108 dnl    The presence of shared pcre, pcreposix or pcrs
109 dnl    libraried is now autodetected. Additionally, the
110 dnl    user can enforce using the built-in static variants
111 dnl    by specifying --disable-dynamic-(pcre|pcrs).
112 dnl    Care is taken to avoid that pcre is dyn, while pcreposix
113 dnl    is static, if both are used and that pcrs is static if
114 dnl    pcrs is.
115 dnl
116 dnl    The choice between pcre, gnu or no regex for actionsfile
117 dnl    URL matching is now via
118 dnl    --(enable|disable)-regex-matching[=(gnu|pcre|no)] with the
119 dnl    default being pcre.
120 dnl
121 dnl Revision 1.6  2001/06/29 21:56:40  oes
122 dnl Version -> 2.9.5
123 dnl
124 dnl Revision 1.5  2001/06/29 13:26:27  oes
125 dnl Introduced #define CODE_STATUS
126 dnl
127 dnl Revision 1.4  2001/05/29 09:50:24  jongfoster
128 dnl Unified blocklist/imagelist/permissionslist.
129 dnl File format is still under discussion, but the internal changes
130 dnl are (mostly) done.
131 dnl
132 dnl Also modified interceptor behaviour:
133 dnl - We now intercept all URLs beginning with one of the following
134 dnl   prefixes (and *only* these prefixes):
135 dnl     * http://i.j.b/
136 dnl     * http://ijbswa.sf.net/config/
137 dnl     * http://ijbswa.sourceforge.net/config/
138 dnl - New interceptors "home page" - go to http://i.j.b/ to see it.
139 dnl - Internal changes so that intercepted and fast redirect pages
140 dnl   are not replaced with an image.
141 dnl - Interceptors now have the option to send a binary page direct
142 dnl   to the client. (i.e. ijb-send-banner uses this)
143 dnl - Implemented show-url-info interceptor.  (Which is why I needed
144 dnl   the above interceptors changes - a typical URL is
145 dnl   "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
146 dnl   The previous mechanism would not have intercepted that, and
147 dnl   if it had been intercepted then it then it would have replaced
148 dnl   it with an image.)
149 dnl
150 dnl Revision 1.3  2001/05/22 18:46:04  oes
151 dnl
152 dnl - Enabled filtering banners by size rather than URL
153 dnl   by adding patterns that replace all standard banner
154 dnl   sizes with the "Junkbuster" gif to the re_filterfile
155 dnl
156 dnl - Enabled filtering WebBugs by providing a pattern
157 dnl   which kills all 1x1 images
158 dnl
159 dnl - Added support for PCRE_UNGREEDY behaviour to pcrs,
160 dnl   which is selected by the (nonstandard and therefore
161 dnl   capital) letter 'U' in the option string.
162 dnl   It causes the quantifiers to be ungreedy by default.
163 dnl   Appending a ? turns back to greedy (!).
164 dnl
165 dnl - Added a new interceptor ijb-send-banner, which
166 dnl   sends back the "Junkbuster" gif. Without imagelist or
167 dnl   MSIE detection support, or if tinygif = 1, or the
168 dnl   URL isn't recognized as an imageurl, a lame HTML
169 dnl   explanation is sent instead.
170 dnl
171 dnl - Added new feature, which permits blocking remote
172 dnl   script redirects and firing back a local redirect
173 dnl   to the browser.
174 dnl   The feature is conditionally compiled, i.e. it
175 dnl   can be disabled with --disable-fast-redirects,
176 dnl   plus it must be activated by a "fast-redirects"
177 dnl   line in the config file, has its own log level
178 dnl   and of course wants to be displayed by show-proxy-args
179 dnl   Note: Boy, all the #ifdefs in 1001 locations and
180 dnl   all the fumbling with configure.in and acconfig.h
181 dnl   were *way* more work than the feature itself :-(
182 dnl
183 dnl - Because a generic redirect template was needed for
184 dnl   this, tinygif = 3 now uses the same.
185 dnl
186 dnl - Moved GIFs, and other static HTTP response templates
187 dnl   to project.h
188 dnl
189 dnl - Some minor fixes
190 dnl
191 dnl - Removed some >400 CRs again (Jon, you really worked
192 dnl   a lot! ;-)
193 dnl
194 dnl Revision 1.2  2001/05/20 01:21:20  jongfoster
195 dnl Version 2.9.4 checkin.
196 dnl - Merged popupfile and cookiefile, and added control over PCRS
197 dnl   filtering, in new "permissionsfile".
198 dnl - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
199 dnl   file error you now get a message box (in the Win32 GUI) rather
200 dnl   than the program exiting with no explanation.
201 dnl - Made killpopup use the PCRS MIME-type checking and HTTP-header
202 dnl   skipping.
203 dnl - Removed tabs from "config"
204 dnl - Moved duplicated url parsing code in "loaders.c" to a new funcition.
205 dnl - Bumped up version number.
206 dnl
207 dnl Revision 1.1.1.1  2001/05/15 13:58:50  oes
208 dnl Initial import of version 2.9.3 source tree
209 dnl
210 dnl 
211
212
213 dnl =================================================================
214 dnl AutoConf Initialization
215 dnl =================================================================
216
217 AC_REVISION($Revision: 1.25 $)
218 AC_INIT(jcc.c)
219 AC_CONFIG_HEADER(config.h)
220 AC_CANONICAL_HOST
221
222
223 dnl =================================================================
224 dnl Application version number
225 dnl =================================================================
226
227 VERSION_MAJOR=2
228 VERSION_MINOR=9
229 VERSION_POINT=10
230 CODE_STATUS="beta"
231
232 dnl CODE_STATUS can be "alpha", "beta", or "stable", and will be
233 dnl used for CGI output
234
235 dnl =================================================================
236 dnl Substitute the version numbers
237 dnl =================================================================
238
239 AC_SUBST(VERSION_MAJOR)
240 AC_SUBST(VERSION_MINOR)
241 AC_SUBST(VERSION_POINT)
242 AC_SUBST(CODE_STATUS)
243
244 dnl
245 AC_DEFINE_UNQUOTED(VERSION_MAJOR,${VERSION_MAJOR})
246 AC_DEFINE_UNQUOTED(VERSION_MINOR,${VERSION_MINOR})
247 AC_DEFINE_UNQUOTED(VERSION_POINT,${VERSION_POINT})
248 AC_DEFINE_UNQUOTED(VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_POINT}")
249 AC_DEFINE_UNQUOTED(CODE_STATUS,"${CODE_STATUS}")
250
251 dnl =================================================================
252 dnl pid file only for unix 
253 dnl =================================================================
254 dnl 
255 PID_FILE_PATH="\"/etc/junkbuster"\"
256
257 dnl =================================================================
258 dnl Checks for programs needed to build.
259 dnl =================================================================
260 AC_PROG_CC
261 AC_PROG_CPP
262 dnl AC_PROG_CXX
263 dnl AC_PROG_INSTALL
264 dnl AC_PROG_LN_S
265 dnl AC_PROG_MAKE_SET
266 dnl RANLIB is for PCRE:
267 dnl AC_PROG_RANLIB
268
269 AC_CHECK_PROG(GDB,gdb,yes,no)
270
271 dnl =================================================================
272 dnl debug, gcc and gdb support 
273 dnl =================================================================
274
275 AC_ARG_WITH(debug,
276         [  --with-debug            Enable debug mode],
277         [
278                 if test "x$withval" != "$xno" ; then
279                     if test $ac_cv_prog_cc_g = yes; then
280                       if test "$GCC" = yes; then
281                         if test "$GDB"; then
282                           CFLAGS="-ggdb"
283                         else
284                           CFLAGS="-g"
285                         fi
286                         CFLAGS="$CFLAGS -Wshadow  -Wconversion"
287                       else
288                         CFLAGS="-g"
289                       fi
290                    fi
291                    CFLAGS="$CFLAGS -D_DEBUG"
292                 fi
293         ],
294         [
295             if test "X$CFLAGS" = "X"; then # if CFLAGS are unset
296               if test "$GCC" = yes; then
297                 CFLAGS="-O2"
298               else
299                 CFLAGS=
300               fi
301             fi
302         ]
303 )
304
305 dnl =================================================================
306 dnl additional gcc flags
307 dnl =================================================================
308 dnl 
309 if test "$GCC"; then
310   CFLAGS="-pipe $CFLAGS"
311 fi
312
313
314 dnl =================================================================
315 dnl Build type
316 dnl =================================================================
317 dnl
318 dnl Must do this first.
319 dnl
320 dnl Reason: This sets CFLAGS in order to switch the Cygwin compiler
321 dnl into Cygwin or MinGW32 modes.  Depending on the mode selected,
322 dnl the compiler will use completely different sets of library
323 dnl and include files.
324 dnl 
325 dnl =================================================================
326
327 AC_MINGW32
328 AC_CYGWIN
329
330 if test "$MINGW32" = "yes"; then
331   target_type=mingw
332 else
333   if test "$CYGWIN" = "yes"; then
334     target_type=cygwin
335   else
336     target_type=unix
337   fi
338 fi
339
340 dnl Decide what to do based on target_type
341 dnl Note: PTHREAD_LIB is always set, even if pthread is disabled.
342 dnl This is because we don't know yet whether pthread is enabled.
343
344 AC_ARG_ENABLE(mingw32,
345 [  --enable-mingw32        Use mingw32 for a Windows GUI],
346 [if test $enableval = yes; then
347   target_type=mingw
348 fi])
349
350 if test $target_type = mingw; then
351   WIN_ONLY=
352   SPECIAL_CFLAGS="-mwindows -mno-cygwin"
353   PTHREAD_LIB=-lpthreadGC
354   echo "Using mingw32 (Win32 GUI)"
355 else
356   WIN_ONLY=#
357   if test $target_type = cygwin; then
358     SPECIAL_CFLAGS="-mno-win32"
359     PTHREAD_LIB=
360     echo "Using Cygnus (Win32 command line)"
361   else
362     SPECIAL_CFLAGS=
363     PTHREAD_LIB=-lpthread
364   fi
365 fi
366 AC_SUBST(WIN_ONLY)
367
368
369 dnl Save old CFLAGS so we can restore them later, then add SPECIAL_CFLAGS
370 old_CFLAGS_nospecial=$CFLAGS
371 CFLAGS="$CFLAGS $SPECIAL_CFLAGS"
372
373 # Hack to force AutoConf to use the CFLAGS we just set
374 dnl Warning: This may break with a future version of Autoconf
375 dnl          Tested with autoconf 2.13
376 ac_cpp='$CPP $CPPFLAGS $SPECIAL_CFLAGS'
377 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
378 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
379
380
381 dnl =================================================================
382 dnl Thread support
383 dnl =================================================================
384
385 AC_CHECK_HEADER(pthread.h, [have_pthread=yes], [have_pthread=no])
386
387 AC_ARG_ENABLE(pthread,
388 [  --disable-pthread       Don't use POSIX threads (pthreads)],
389 [if test $enableval = no; then
390   # Disable pthreads
391   have_pthread=no
392 fi])
393
394 if test $have_pthread = yes; then
395   PTHREAD_ONLY=
396   AC_DEFINE(FEATURE_PTHREAD)
397   echo Using POSIX threads
398   if test "$GCC" = "yes"; then
399     # Set a GCC specific switch:
400     if test "$target_type" = "unix"; then
401       # This compiler switch makes Linux thread-safe
402       # Don't know about other OS's?  Is this switch
403       # supported?
404       PTHREAD_LIB=
405       SPECIAL_CFLAGS="-pthread"
406     fi
407   fi
408 else
409   PTHREAD_ONLY=#
410   echo Using native threads
411 fi
412
413 AC_SUBST(PTHREAD_ONLY)
414
415 dnl =================================================================
416 dnl Support for thread-safe versions of gethostbyaddr, gethostbyname,
417 dnl gmtime and localtime
418 dnl =================================================================
419
420 AC_CHECK_FUNC(gethostbyaddr_r, [
421   AC_MSG_CHECKING([signature of gethostbyaddr_r])
422   AC_TRY_COMPILE([
423 #   include <netdb.h>
424   ], [
425     struct hostent *h, *hp;
426     char *a, *b;
427     int l, bl, t, e;
428     (void) gethostbyaddr_r(a, l, t, h, b, bl, &hp, &e)
429   ], [
430     AC_DEFINE(HAVE_GETHOSTBYADDR_R_8_ARGS)
431     AC_MSG_RESULT([8 args])
432   ], [
433     AC_TRY_COMPILE([
434 #     include <netdb.h>
435     ], [
436       struct hostent *h;
437       char *a, *b;
438       int l, bl, t, e;
439       (void) gethostbyaddr_r(a, l, t, h, b, bl, &e)
440     ], [
441       AC_DEFINE(HAVE_GETHOSTBYADDR_R_7_ARGS)
442       AC_MSG_RESULT([7 args])
443     ], [
444       AC_TRY_COMPILE([
445 #       include <netdb.h>
446       ], [
447         struct hostent_data *d;
448         struct hostent *h;
449         char a,
450         int l, t;
451         (void) gethostbyaddr_r(a, l, t, h, d)
452       ], [
453         AC_DEFINE(HAVE_GETHOSTBYADDR_R_5_ARGS)
454         AC_MSG_RESULT([5 args])
455       ], [
456         AC_MSG_RESULT(unrecognised)
457       ])
458     ])
459   ])
460 ], [
461   AC_MSG_RESULT(no)
462 ])
463
464 AC_CHECK_FUNC(gethostbyname_r, [
465   AC_MSG_CHECKING([signature of gethostbyname_r])
466   AC_TRY_COMPILE([
467 #   include <netdb.h>
468   ], [
469     struct hostent *h, *r;
470     char *n, *b;
471     int bl, e;
472     (void) gethostbyname_r(n, h, b, bl, &r, &e)
473   ], [
474     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARGS)
475     AC_MSG_RESULT([6 args])
476   ], [
477     AC_TRY_COMPILE([
478 #     include <netdb.h>
479     ], [
480       struct hostent *h;
481       char *n, *b;
482       int bl, e;
483       (void) gethostbyname_r(n, h, b, bl, &e)
484     ], [
485       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARGS)
486       AC_MSG_RESULT([5 args])
487     ], [
488       AC_TRY_COMPILE([
489 #       include <netdb.h>
490       ], [
491         struct hostent_data *d;
492         struct hostent *h;
493         char *n,
494         (void) gethostbyname_r(n, h, d)
495       ], [
496         AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARGS)
497         AC_MSG_RESULT([3 args])
498       ], [
499         AC_MSG_RESULT(unrecognised)
500       ])
501     ])
502   ])
503 ], [
504   AC_MSG_RESULT(no)
505 ])
506
507 AC_CHECK_FUNC(gmtime_r, [
508   AC_MSG_CHECKING([signature of gmtime_r])
509   AC_TRY_COMPILE([
510 #   include <time.h>
511   ], [
512     struct time *t;
513     struct tm *tm;
514     (void) gmtime_r(t, tm)
515   ], [
516     AC_MSG_RESULT(ok)
517     AC_DEFINE(HAVE_GMTIME_R)
518   ], [
519     AC_MSG_RESULT(unrecognised)
520   ])
521 ], [
522   AC_MSG_RESULT(no)
523 ])
524
525 AC_CHECK_FUNC(localtime_r, [
526   AC_MSG_CHECKING([signature of localtime_r])
527   AC_TRY_COMPILE([
528 #   include <time.h>
529   ], [
530     struct time *t;
531     struct tm *tm;
532     (void) localtime_r(t, tm)
533   ], [
534     AC_MSG_RESULT(ok)
535     AC_DEFINE(HAVE_LOCALTIME_R)
536   ], [
537     AC_MSG_RESULT(unrecognised)
538   ])
539 ], [
540   AC_MSG_RESULT(no)
541 ])
542
543 dnl =================================================================
544 dnl Solaris specific
545 dnl FIXME: Not tested on Solaris yet...
546 dnl =================================================================
547
548
549 SOCKET_LIB=
550
551 case "$host" in
552 *-solaris*) SOCKET_LIB="-lsocket -lnsl"
553             AC_DEFINE(__EXTENSIONS__)
554             if test "$GCC" = "yes"; then
555               # Set a GCC specific switch:
556               # This compiler switch makes Solaris thread-safe
557               PTHREAD_LIB=
558               SPECIAL_CFLAGS="-pthreads"
559             else
560               # What do we do without GCC? Guess this:
561               SPECIAL_CFLAGS="-D_REENTRANT"
562             fi
563 ;;
564 esac
565
566 AC_SUBST(SOCKET_LIB)
567
568 dnl =================================================================
569 dnl OS/2 specific
570 dnl =================================================================
571
572 case "$host" in
573 *-os2-emx*) SOCKET_LIB=-lsocket
574 ;;
575 esac
576
577 AC_SUBST(SOCKET_LIB)
578
579 dnl =================================================================
580 dnl AmigaOS specific
581 dnl =================================================================
582
583 AMIGAOS_ONLY=#
584
585 case "$host" in
586 *-amigaos) AMIGAOS_ONLY=
587 ;;
588 esac
589
590 AC_SUBST(AMIGAOS_ONLY)
591
592 dnl =================================================================
593 dnl Check for standard compiler stuff
594 dnl =================================================================
595
596 AC_EXEEXT
597 AC_OBJEXT
598 AC_HEADER_STDC
599 AC_C_CONST
600 AC_TYPE_SIZE_T
601 AC_CHECK_SIZEOF(int)
602 AC_CHECK_SIZEOF(char *)
603 AC_CHECK_SIZEOF(long)
604 AC_CHECK_SIZEOF(long long)
605 AC_CHECK_SIZEOF(size_t)
606
607 dnl Checks for header files.
608 dnl AC_HEADER_SYS_WAIT
609 dnl AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/time.h unistd.h)
610
611 dnl Checks for library functions.
612 dnl AC_TYPE_SIGNAL
613 dnl AC_CHECK_FUNC(strstr)
614 dnl bcopy and memmove are for PCRE
615 AC_CHECK_FUNCS(strerror bcopy memmove)
616
617
618 dnl =================================================================
619 dnl Checks for libraries.
620 dnl =================================================================
621 dnl Note: Some systems may have the library but not the system header
622 dnl       file, so we must check for both.
623 AC_CHECK_LIB(pcre, pcre_compile, [AC_CHECK_HEADER(pcre.h, [have_pcre=yes], [have_pcre=no])], [have_pcre=no])
624 AC_CHECK_LIB(pcreposix, regcomp, [AC_CHECK_HEADER(pcreposix.h, [have_pcreposix=yes], [have_pcreposix=no])], [have_pcreposix=no], -lpcre)
625 AC_CHECK_LIB(pcrs, pcrs_compile, [AC_CHECK_HEADER(pcrs.h, [have_pcrs=yes], [have_pcrs=no])], [have_pcrs=no])
626
627
628 dnl =================================================================
629 dnl Always defined
630 dnl =================================================================
631
632 AC_DEFINE(__MT__)
633
634 dnl =================================================================
635 dnl Features
636 dnl =================================================================
637
638 AC_ARG_ENABLE(toggle,
639 [  --disable-toggle         Don't support temporary disable],
640 [if test $enableval = yes; then
641   AC_DEFINE(FEATURE_TOGGLE)
642 fi],AC_DEFINE(FEATURE_TOGGLE))
643
644 AC_ARG_ENABLE(force,
645 [  --disable-force          Don't allow single-page disable],
646 [if test $enableval = yes; then
647   AC_DEFINE(FEATURE_FORCE_LOAD)
648 fi],AC_DEFINE(FEATURE_FORCE_LOAD))
649
650 AC_ARG_ENABLE(fast-redirects,
651 [  --disable-fast-redirects Don't support fast redirects],
652 [if test $enableval = yes; then
653   AC_DEFINE(FEATURE_FAST_REDIRECTS)
654 fi], AC_DEFINE(FEATURE_FAST_REDIRECTS))
655
656 AC_ARG_ENABLE(killpopup,
657 [  --disable-killpopup      Never block popups],
658 [if test $enableval = yes; then
659   AC_DEFINE(FEATURE_KILL_POPUPS)
660 fi],AC_DEFINE(FEATURE_KILL_POPUPS))
661
662 AC_ARG_ENABLE(stats,
663 [  --disable-stats          Don't keep statistics],
664 [if test $enableval = yes; then
665   AC_DEFINE(FEATURE_STATISTICS)
666 fi],AC_DEFINE(FEATURE_STATISTICS))
667
668 AC_ARG_ENABLE(ie-images,
669 [  --disable-ie-images      Don't auto-detect whether a request from MS Internet
670                            Explorer is for an image or HTML.],
671 [if test $enableval = yes; then
672   AC_DEFINE(FEATURE_IMAGE_DETECT_MSIE)
673 fi],
674 AC_DEFINE(FEATURE_IMAGE_DETECT_MSIE))
675
676 AC_ARG_ENABLE(image-blocking,
677 [  --disable-image-blocking Don't try to figure out whether a request is 
678                            for an image or HTML - assume HTML.],
679 [if test $enableval = yes; then
680   AC_DEFINE(FEATURE_IMAGE_BLOCKING)
681 fi],
682 AC_DEFINE(FEATURE_IMAGE_BLOCKING))
683
684 AC_ARG_ENABLE(acl-files,
685 [  --disable-acl-files      Prevents the use of ACL files to control access to
686                            the proxy by IP address.],
687 [if test $enableval = yes; then
688   AC_DEFINE(FEATURE_ACL)
689 fi],
690 AC_DEFINE(FEATURE_ACL))
691
692 AC_ARG_ENABLE(trust-files,
693 [  --disable-trust-files    Prevents the use of trust files.],
694 [if test $enableval = yes; then
695   AC_DEFINE(FEATURE_TRUST)
696 fi],
697 AC_DEFINE(FEATURE_TRUST))
698
699 AC_ARG_ENABLE(jar-files,
700 [  --disable-jar-files      Prevents the use of jar files to capture cookies.],
701 [if test $enableval = yes; then
702   AC_DEFINE(FEATURE_COOKIE_JAR)
703 fi],
704 AC_DEFINE(FEATURE_COOKIE_JAR))
705
706 AC_ARG_ENABLE(editor,
707 [  --disable-editor         Prevents the use of the web-based actions file
708                            editor and web-based temporary disable setting.],
709 [if test $enableval = yes; then
710   AC_DEFINE(FEATURE_CGI_EDIT_ACTIONS)
711 fi],
712 AC_DEFINE(FEATURE_CGI_EDIT_ACTIONS))
713
714 dnl pcre/pcrs is needed for CGI anyway, so
715 dnl the choice is only between static and
716 dnl dynamic:
717
718 AC_ARG_ENABLE(regex-matching,
719 [  --enable-regex-matching=pcre  Use perl-compatible regex for actionsfile
720                                 pattern matching (default)
721   --enable-regex-matching=gnu   Use gnu style regex for actionsfile pattern
722                                 matching (-> bigger binary)
723   --disable-regex-matching      Don't use regex matching, compare URL
724                                 prefix instead (won't shrink birary)],
725 [ regex_matching=$enableval ],
726 [ regex_matching=pcre ])
727
728 AC_ARG_ENABLE(dynamic-pcre,
729 [  --disable-dynamic-pcre        Use the built-in, static pcre, even if
730                                 libpcre is available],
731 [ if test $enableval = "no"; then have_pcre=no; fi ])
732
733 AC_ARG_ENABLE(dynamic-pcrs,
734 [  --disable-dynamic-pcrs        Use the built-in, static pcrs, even if
735                                 libpcrs is available],
736 [ if test $enableval = "no"; then have_pcrs=no; fi ])
737
738
739 # Is the regex URL matching based on libpcreposix, but we
740 # don't have that library?
741 #
742 if test $have_pcreposix = "yes" -o $regex_matching != "pcre"; then
743   dont_miss_pcreposix=yes
744 else
745   dont_miss_pcreposix=no
746 fi
747
748 # If we have libpcre and either we also have pcreposix or
749 # we don't need pcreposix, then link pcre dynamically; else
750 # build it and link statically
751 #
752 if test $have_pcre = "yes" -a $dont_miss_pcreposix = "yes"; then
753   echo "using libpcre"
754   pcre_dyn=yes
755   STATIC_PCRE_ONLY=#
756   LIBS="$LIBS -lpcre"
757 else
758   echo "using built-in static pcre"
759   pcre_dyn=no
760   AC_DEFINE(STATIC_PCRE)
761   STATIC_PCRE_ONLY=
762 fi
763
764 # If we have libpcrs and pcre is linked dynamically
765 # then also link pcrs dynamically, else build and link
766 # pcrs statically
767 #
768 if test $have_pcrs = "yes" -a $pcre_dyn = "yes"; then
769   echo "using libpcrs"
770   STATIC_PCRS_ONLY=#
771   LIBS="$LIBS -lpcrs"
772 else
773   echo "using built-in static pcrs"
774   AC_DEFINE(STATIC_PCRS)
775   STATIC_PCRS_ONLY=
776 fi
777
778 # Which method should be used for URL matching?
779 # pcre, gnu regex or prefix matching?
780 #
781 if test $regex_matching = "gnu"; then
782   echo "using gnu regex for URL matching"
783   AC_DEFINE(REGEX_GNU)
784   GNU_REGEX_ONLY=
785   PCRE_REGEX_ONLY=#
786 elif test $regex_matching = "pcre"; then
787   echo "using pcre regex for URL matching"
788   AC_DEFINE(REGEX_PCRE)
789   GNU_REGEX_ONLY=#
790   PCRE_REGEX_ONLY=
791   if test $pcre_dyn = "yes"; then
792     LIBS="$LIBS -lpcreposix"
793   fi
794 else
795   echo -e "using prefix matching for URLs\nHint: This does NOT make the executable any smaller!"
796   GNU_REGEX_ONLY=#
797   PCRE_REGEX_ONLY=#
798 fi
799
800 AC_SUBST(GNU_REGEX_ONLY)
801 AC_SUBST(PCRE_REGEX_ONLY)
802 AC_SUBST(STATIC_PCRE_ONLY)
803 AC_SUBST(STATIC_PCRS_ONLY)
804
805 dnl =================================================================
806 dnl Final cleanup and output
807 dnl =================================================================
808
809 dnl Remove the SPECIAL_CFLAGS stuff from CFLAGS, and add it seperately
810 dnl in the Makefile
811 CFLAGS=$old_CFLAGS_nospecial
812 AC_SUBST(SPECIAL_CFLAGS)
813
814 AC_SUBST(PID_FILE_PATH)
815 AC_DEFINE_UNQUOTED(PID_FILE_PATH,${PID_FILE_PATH})
816
817 AC_SUBST(PTHREAD_LIB)
818
819 AC_OUTPUT(GNUmakefile)