Resyncing HEAD with v_3_0_branch for two OSX fixes:
[privoxy.git] / configure.in
index 519b9ac..e36526a 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl 
-dnl $Id: configure.in,v 1.72 2002/06/04 15:52:25 jongfoster Exp $
+dnl $Id: configure.in,v 1.88 2003/03/23 02:15:51 hal9 Exp $
 dnl 
 dnl Written by and Copyright (C) 2001, 2002 the SourceForge
 dnl Privoxy team. http://www.privoxy.org/
@@ -28,6 +28,60 @@ dnl or write to the Free Software Foundation, Inc., 59
 dnl Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl 
 dnl $Log: configure.in,v $
+dnl Revision 1.88  2003/03/23 02:15:51  hal9
+dnl Apply Docbook/FreeBSD patch from a.go at tiscali.nl. Thanks!
+dnl
+dnl Revision 1.87  2002/12/28 04:10:22  david__schmidt
+dnl Initial drop of dashboard instrumentation - enabled with
+dnl --enable-activity-console
+dnl
+dnl Revision 1.86  2002/12/13 23:47:10  hal9
+dnl Add openbsd special flags per gunner at styx2002.no-ip.org
+dnl
+dnl Revision 1.85  2002/11/27 12:40:54  oes
+dnl Fixed broken handling of pre-set CFLAGS
+dnl
+dnl Revision 1.84  2002/10/24 22:24:57  hal9
+dnl Make install: Minor clean up for variable handling.
+dnl
+dnl Revision 1.83  2002/10/24 16:32:41  hal9
+dnl echo -n does not work with true /bin/sh. Use AC_MSG_CHECKING for docbook stuff.
+dnl
+dnl Revision 1.82  2002/09/27 04:24:07  hal9
+dnl Minor change of "! test" to "test -ne" for Solaris.
+dnl
+dnl Revision 1.81  2002/09/27 00:38:44  hal9
+dnl Some general cleanup of the user/group stuff. Including remove up to ':' to
+dnl make Linux (?) compatible with other *nix. Better AC output stuff.
+dnl
+dnl Revision 1.80  2002/09/26 18:47:46  hal9
+dnl This is most of Al's patch for --with-user and --with-group which tests that
+dnl these are valid values, if specified. If not specified, they are left empty.
+dnl
+dnl Revision 1.79  2002/09/07 02:11:06  hal9
+dnl Remove some testing stuff inadvertantly left in.
+dnl
+dnl Revision 1.78  2002/09/06 23:18:08  hal9
+dnl Migrate PCRE_H_IN_SUBDIR from 3.0 branch for pcre/pcre.h on RH, etc.
+dnl
+dnl Revision 1.77  2002/09/06 13:23:03  oes
+dnl Removed non-functional test for gcc support for -pthread
+dnl
+dnl Revision 1.76  2002/09/05 14:52:17  oes
+dnl Synced in some changes fromm the stable branch:
+dnl Fixed detection/inclusion of pcre.h, which is in a pcre subdir on RH
+dnl
+dnl Revision 1.75  2002/09/04 12:19:33  oes
+dnl Resurrected acconfig.h and removed double quotes from AC_DEFINE params to enable build on older systems
+dnl
+dnl Revision 1.74  2002/09/03 17:31:33  oes
+dnl Added workaround for very strange behaviour of AC_PROG_CC, which sets CFLAGS to -g -O2 if empty
+dnl
+dnl Revision 1.73  2002/06/05 00:26:21  hal9
+dnl Move all doc build stuff to doc/source/GNUmakefile, leaving a 'make dok'
+dnl target only in toplevel. Add DOC_STATUS variable so docs can be built without
+dnl touching sgml source.
+dnl
 dnl Revision 1.72  2002/06/04 15:52:25  jongfoster
 dnl Removing need for acconfig.h (apparently using acconfig.h is an
 dnl obsolete coding style).
@@ -389,14 +443,13 @@ dnl =================================================================
 dnl AutoConf Initialization
 dnl =================================================================
 
-AC_REVISION($Revision: 1.72 $)
+AC_REVISION($Revision: 1.88 $)
 AC_INIT(src/jcc.c)
-
 if test ! -f src/config.h.in; then
    echo "You need to run autoheader first. "
    echo -n "Shall I do this for you now? (y/n) "
    read answer
-   if test $answer != "y"; then
+   if test "$answer" != "y"; then
       exit 1
    else
       autoheader
@@ -427,6 +480,7 @@ AC_SUBST(VERSION_MAJOR)
 AC_SUBST(VERSION_MINOR)
 AC_SUBST(VERSION_POINT)
 AC_SUBST(CODE_STATUS)
+AC_SUBST(SYSCONFDIR)
 
 dnl
 AC_DEFINE_UNQUOTED(VERSION_MAJOR,${VERSION_MAJOR},
@@ -443,13 +497,24 @@ AC_DEFINE_UNQUOTED(CODE_STATUS,"${CODE_STATUS}",
 dnl =================================================================
 dnl Checks for programs needed to build.
 dnl =================================================================
+
+dnl Keep AC_PROG_CC from setting its own defaults:
+if test "X$CFLAGS" = "X"; then
+   CFLAGS = " "
+fi
+
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
+AC_PROG_AWK
 
 AC_CHECK_PROG(GDB,gdb,yes,no)
+AC_PATH_PROG(BGROUPS,groups,no,/bin:/usr/bin:/usr/local/bin)
+AC_PATH_PROG(ID,id,no,/bin:/usr/bin:/usr/local/bin)
+AC_SUBST(ID)
+AC_SUBST(BGROUPS)
 
 dnl =================================================================
 dnl debug, gcc and gdb support 
@@ -462,54 +527,98 @@ AC_ARG_WITH(debug,
                     if test $ac_cv_prog_cc_g = yes; then
                       if test "$GCC" = yes; then
                         if test "$GDB"; then
-                          CFLAGS="-ggdb"
+                          CFLAGS="$CFLAGS -ggdb"
                         else
-                          CFLAGS="-g"
+                          CFLAGS="$CFLAGS -g"
                         fi
                         CFLAGS="$CFLAGS -Wshadow  -Wconversion"
                       else
-                        CFLAGS="-g"
+                        CFLAGS="$CFLAGS -g"
                       fi
                    fi
                 fi
         ],
         [
-            if test "X$CFLAGS" = "X"; then # if CFLAGS are unset
+            if test "X$CFLAGS" = "X "; then # if CFLAGS were unset (see above)
               if test "$GCC" = yes; then
                 CFLAGS="-O2"
-              else
-                CFLAGS=
               fi
             fi
         ]
 )
 
+dnl =================================================================
+dnl Check for user and group validity
+dnl =================================================================
+
+$ID privoxy >/dev/null 2>/dev/null
+if test $? -ne 0 ; then
+ AC_MSG_WARN(There is no user 'privoxy' on this system)
+fi
+AC_MSG_CHECKING([for user])
 AC_ARG_WITH(user,
-        [  --with-user=privoxy            Set user under which privoxy run],
+        [  --with-user=privoxy          Set user under which privoxy will run],
         [
                 if test "x$withval" != "xyes"; then
-                    USER=$with_user;
+                  if test $ID = no ; then
+                    AC_MSG_WARN(There is no 'id' program on this system)
+                  else
+                    AC_MSG_RESULT($with_user)
+                    $ID $with_user 2>/dev/null >/dev/null
+                    if test $? -eq 0 ; then
+                      USER=$with_user;
+                    else
+                      AC_MSG_ERROR(There is no user '$with_user' on this system)
+                    fi
+                  fi
                   else
                    AC_MSG_ERROR(We need a user if you give me this parameter)
                 fi
         ],
         [
-          USER=privoxy;
+          if test $ID = no ; then
+            AC_MSG_WARN(There is no 'id' program on this system)
+          else
+            AC_MSG_RESULT(none specified)
+            USER=$with_user
+          fi
         ]
 )
 AC_SUBST(USER)
 
+AC_MSG_CHECKING([for group])
 AC_ARG_WITH(group,
         [  --with-group=privoxy         Set group for privoxy],
-        [
+        [ 
                 if test "x$withval" != "xyes"; then
-                    GROUP=$with_group;
+                  if test $BGROUPS = no ; then
+                    AC_MSG_ERROR(There is no 'groups' program on this system)
                   else
+                    AC_MSG_RESULT($with_group)
+                    $BGROUPS $USER >/dev/null
+                    if test $? -eq 0 ; then
+                    # FIXME: this fails if valid group, but not first group
+                    # listed.
+                      if test "$with_group" != "`$BGROUPS $USER | sed 's/.*: //' 2>/dev/null |$AWK '{print $1}'`" ; then
+                        AC_MSG_ERROR(The given value '$withval' does not match group entry)
+                      else
+                        GROUP=$with_group;
+                      fi
+                    else
+                      AC_MSG_ERROR(There is no group entry for user '$USER')
+                    fi
+                  fi
+                else
                    AC_MSG_ERROR(We need a group if you give me this parameter)
                 fi
         ],
         [
-          GROUP=privoxy;
+          if test $BGROUPS = no ; then
+            AC_MSG_WARN(There is no 'groups' program on this system)
+          else
+            AC_MSG_RESULT(none specified)
+            GROUP=$with_group;
+          fi
         ]
 )
 AC_SUBST(GROUP)
@@ -610,17 +719,10 @@ if test $have_pthread = yes; then
   if test "$GCC" = "yes"; then
     # Set a GCC specific switch:
     if test "$target_type" = "unix"; then
-      ac_jgf_save_CFLAGS=$CFLAGS
-      CFLAGS="$CFLAGS -pthread"
-      AC_TRY_LINK([#include <pthread.h>],
-        [void *p = pthread_create;],
-        [
-          # This compiler switch makes GCC on Linux thread-safe
-          # However, it's not supported on most other OS.
-          PTHREAD_LIB=
-          SPECIAL_CFLAGS="-pthread"
-        ])
-      CFLAGS=$ac_jgf_save_CFLAGS
+      # This compiler switch makes GCC on Linux thread-safe
+      # However, it's not supported on most other OS.
+      PTHREAD_LIB=
+      SPECIAL_CFLAGS="-pthread"
     fi
   fi
 else
@@ -826,10 +928,19 @@ dnl Mac OSX specific
 dnl =================================================================
     
 case "$host" in
-*-apple-darwin*) SPECIAL_CFLAGS="-Dunix"
+*-apple-darwin*) SPECIAL_CFLAGS="-Dunix -DOSX_DARWIN"
 ;;  
 esac
 
+dnl =================================================================
+dnl OpenBSD specific
+dnl =================================================================
+
+case "$host" in
+*-openbsd*) SPECIAL_CFLAGS="$SPECIAL_CFLAGS -Dunix"
+;;
+esac
+
 dnl =================================================================
 dnl AmigaOS specific
 dnl =================================================================
@@ -888,10 +999,27 @@ dnl =================================================================
 dnl Note: Some systems may have the library but not the system header
 dnl       file, so we must check for both.
 dnl       Also check for correct version
-AC_CHECK_LIB(pcre, pcre_compile, [AC_CHECK_HEADER(pcre.h, [AC_EGREP_HEADER(pcre_fullinfo, pcre.h, [have_pcre=yes], [AC_MSG_WARN([[pcre old version installed]]); have_pcre=no])], [have_pcre=no])], [have_pcre=no])
-AC_CHECK_LIB(pcreposix, regcomp, [AC_CHECK_HEADER(pcreposix.h, [AC_EGREP_HEADER(pcreposix_regerror, pcreposix.h, [AC_MSG_WARN([[pcreposix old version installed]]); have_pcreposix=no], [have_pcreposix=yes])], [have_pcreposix=no])], [have_pcreposix=no], -lpcre)
-AC_CHECK_LIB(pcrs, pcrs_compile, [AC_CHECK_HEADER(pcrs.h, [have_pcrs=yes], [have_pcrs=no])], [have_pcrs=no])
-
+AC_CHECK_LIB(pcre, pcre_compile, [
+   AC_CHECK_HEADER(pcre.h, [
+      AC_EGREP_HEADER(pcre_fullinfo, pcre.h, [have_pcre=yes], [AC_MSG_WARN([[pcre old version installed]]); have_pcre=no])
+   ], [
+      AC_CHECK_HEADER(pcre/pcre.h, [
+         AC_EGREP_HEADER(pcre_fullinfo, pcre/pcre.h, [have_pcre=yes]; [AC_DEFINE(PCRE_H_IN_SUBDIR)], [AC_MSG_WARN([[pcre old version installed]]); have_pcre=no])
+      ], [have_pcre=no])
+   ])
+], [have_pcre=no])
+AC_CHECK_LIB(pcreposix, regcomp, [
+   AC_CHECK_HEADER(pcreposix.h, [
+      AC_EGREP_HEADER(pcreposix_regerror, pcreposix.h, [AC_MSG_WARN([[pcreposix old version installed]]); have_pcreposix=no], [have_pcreposix=yes])
+   ], [
+      AC_CHECK_HEADER(pcre/pcreposix.h, [
+         AC_EGREP_HEADER(pcreposix_regerror, pcre/pcreposix.h, [AC_MSG_WARN([[pcreposix old version installed]]); have_pcreposix=no], [have_pcreposix=yes]; [AC_DEFINE(PCREPOSIX_H_IN_SUBDIR)])
+      ], [have_pcreposix=no])
+   ])
+], [have_pcreposix=no], -lpcre) 
+
+AC_CHECK_LIB(pcrs, pcrs_compile, [AC_CHECK_HEADER(pcrs.h, [have_pcrs=yes], [have_pcrs=no])], [have_pcrs=no], -lpcre)
 
 dnl =================================================================
 dnl Always defined
@@ -952,6 +1080,20 @@ if test $enableval2 = yes; then
     [ Enables statistics function. ])
 fi
 
+AC_ARG_ENABLE(activity-console,
+[  --enable-activity-console    Gather and send extended statistics to the activity console],
+[enableval2=$enableval],
+[enableval2=no])
+if test $enableval2 = yes; then
+  ACTIVITY_ONLY=
+  AC_DEFINE(FEATURE_ACTIVITY_CONSOLE,1,
+    [ Enables sending statistics to the activity console. This is currently
+      experimental, and will require some porting work for a few more platforms. ])
+  else
+    ACTIVITY_ONLY=#
+fi
+AC_SUBST(ACTIVITY_ONLY)
+
 AC_ARG_ENABLE(ie-images,
 [  --enable-ie-images      Don't auto-detect whether a request from MS Internet
                            Explorer is for an image or HTML.],
@@ -960,31 +1102,31 @@ AC_ARG_ENABLE(ie-images,
 if test $enableval2 = yes; then
   AC_DEFINE(FEATURE_IMAGE_DETECT_MSIE,1,
     [ Detect image requests automatically for MSIE.  Will fall back to
-      other image-detection methods (i.e. "+image" action) for other
+      other image-detection methods (i.e. ´´+image´´ action) for other
       browsers.
 
       You must also define FEATURE_IMAGE_BLOCKING to use this feature.
 
       It detects the following header pair as an image request:
-      "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)",
-      "Accept: * / *".
+      ´´User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)´´,
+      ´´Accept: * / *´´.
 
       And the following as a HTML request:
-      "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)",
-      "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, * / *".
+      User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0),
+      Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, * / *.
 
       And no, I haven't got that backwards - IE is being wierd.
 
       Known limitations: 
       1) If you press shift-reload on a blocked HTML page, you get
-         the image "blocked" page, not the HTML "blocked" page.
-      2) Once an image "blocked" page has been sent, viewing it 
+         the image blocked page, not the HTML ´´blocked´´ page.
+      2) Once an image ´´blocked´´ page has been sent, viewing it 
          in it's own browser window *should* bring up the HTML
-         "blocked" page, but it doesn't.  You need to clear the 
+         ´´blocked´´ page, but it doesn't.  You need to clear the 
          browser cache to get the HTML version again.
 
       These limitations are due to IE making inconsistent choices
-      about which "Accept:" header to send. ])
+      about which ´´Accept:´´ header to send. ])
 fi
 
 AC_ARG_ENABLE(image-blocking,
@@ -1045,10 +1187,9 @@ AC_ARG_ENABLE(no-gifs,
 [enableval2=no])
 if test $enableval2 = yes; then
   AC_DEFINE(FEATURE_NO_GIFS,1,
-    [ Deine to 1 to use PNG instead of GIF for built-in images. ])
+    [ Define to 1 to use PNG instead of GIF for built-in images. ])
 fi
 
-
 dnl pcre/pcrs is needed for CGI anyway, so
 dnl the choice is only between static and
 dnl dynamic:
@@ -1107,92 +1248,6 @@ fi
 AC_SUBST(STATIC_PCRE_ONLY)
 AC_SUBST(STATIC_PCRS_ONLY)
 
-dnl =================================================================
-dnl config.h Header/footer
-dnl =================================================================
-
-AH_TOP(
-[#ifndef CONFIG_H_INCLUDED
-#define CONFIG_H_INCLUDED
-
-/*********************************************************************
- *
- * File        :  config.h
- *
- * Purpose     :  This file should be the first thing included in every
- *                .c file.  (Before even system headers).  It contains 
- *                #define statements for various features.  It was
- *                introduced because the compile command line started
- *                getting ludicrously long with feature defines.
- *
- * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
- *                Privoxy team. http://www.privoxy.org/
- *
- *                This program is free software; you can redistribute it 
- *                and/or modify it under the terms of the GNU General
- *                Public License as published by the Free Software
- *                Foundation; either version 2 of the License, or (at
- *                your option) any later version.
- *
- *                This program is distributed in the hope that it will
- *                be useful, but WITHOUT ANY WARRANTY; without even the
- *                implied warranty of MERCHANTABILITY or FITNESS FOR A
- *                PARTICULAR PURPOSE.  See the GNU General Public
- *                License for more details.
- *
- *                The GNU General Public License should be included with
- *                this file.  If not, you can view it at
- *                http://www.gnu.org/copyleft/gpl.html
- *                or write to the Free Software Foundation, Inc., 59
- *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *********************************************************************/
-\f
-
-/*
- * It's too easy to accidentally use a Cygwin or MinGW32 version of config.h
- * under VC++, and it usually gives many wierd error messages.  Let's make
- * the error messages understandable, by bailing out now.
- */
-#ifdef _MSC_VER
-#error For MS VC++, please use vc_config_winthreads.h or vc_config_pthreads.h.  You can usually do this by selecting the "Build", "Clean" menu option.
-#endif /* def _MSC_VER */
-
-])
-
-AH_BOTTOM(
-[
-
-/*
- * Defined always.
- * FIXME: Don't know what it does or why we need it.
- * (presumably something to do with ANSI Standard C?)
- */
-#ifndef __STDC__
-#define __STDC__ 1
-#endif /* ndef __STDC__ */
-
-/*
- * Need to set up this define only for the Pthreads library for
- * Win32, available from http://sources.redhat.com/pthreads-win32/
- */
-#if defined(FEATURE_PTHREAD) && defined(_WIN32)
-#define __CLEANUP_C
-#endif /* defined(FEATURE_PTHREAD) && defined(_WIN32) */
-
-/*
- * BEOS does not currently support POSIX threads.
- * This *should* be detected by ./configure, but let's be sure.
- */
-#if defined(FEATURE_PTHREAD) && defined(__BEOS__)
-#error BEOS does not support pthread - please run ./configure again with "--disable-pthread"
-
-#endif /* defined(FEATURE_PTHREAD) && defined(__BEOS__) */
-
-
-#endif /* CONFIG_H_INCLUDED */
-])
-
 dnl =================================================================
 dnl DocBook stuff
 dnl =================================================================
@@ -1214,17 +1269,19 @@ dnl Checking for the docbook.dsl stylesheet file
 dnl It is still not portable (directory slash)
 dnl   ^ Why not?  All systems use / don't they?
 dnl   Windows certainly can.  Is this a Mac or
-dnl   Amiga issue?  -- Jon
+dnl   Amiga issue?  -- Jon  /dsssl/docbook/html/docbook.dsl
 DKPREFIXCOPY=$DKPREFIX
 DKPREFIX=false
 for i in $DKPREFIXCOPY /usr/share/sgml/docbook/stylesheet/dsssl/modular \
         /usr/share/sgml/docbook/dsssl-stylesheets /usr/share/sgml/docbkdsl \
-        /usr/share/sgml/docbook-dsssl; do
-        echo -n "checking for $i/html/docbook.dsl..."
+        /usr/share/sgml/docbook-dsssl /usr/local/share/sgml/docbook/dsssl/modular; do
+dnl  echo -n does not fly with /bin/sh.
+dnl      echo -n "checking for $i/html/docbook.dsl..."
+      AC_MSG_CHECKING([for $i])
         if test -f $i/html/docbook.dsl; then
                 echo "yes"
                 DKPREFIX=$i
-                break
+                break 
         else
                 echo "no"
         fi
@@ -1234,8 +1291,12 @@ AC_SUBST(DKPREFIX)
 JADECAT=""
 dnl where are the catalogs?
 for i in /usr/share/sgml/CATALOG.docbk30 \
-         /usr/share/sgml/CATALOG.docbk31; do
-        echo -n "checking for $i..."
+         /usr/share/sgml/CATALOG.docbk31 \
+        /usr/local/share/sgml/docbook/3.0/docbook.cat \
+        /usr/local/share/sgml/docbook/3.1/docbook.cat \
+        ; do
+dnl     echo -n "checking for $i..."
+      AC_MSG_CHECKING([for $i])
         if test -f $i; then
                 echo "yes"
                 JADECAT="$JADECAT -c $i"
@@ -1310,3 +1371,4 @@ AC_SUBST(SPECIAL_CFLAGS)
 AC_SUBST(PTHREAD_LIB)
 
 AC_OUTPUT(GNUmakefile doc/source/ldp.dsl doc/source/GNUmakefile)
+