Updated the trustfile config section.
[privoxy.git] / configure.in
index 2c50e61..d8d085b 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl 
-dnl $Id: configure.in,v 1.74 2002/09/03 17:31:33 oes Exp $
+dnl $Id: configure.in,v 1.81 2002/09/27 00:38:44 hal9 Exp $
 dnl 
 dnl Written by and Copyright (C) 2001, 2002 the SourceForge
 dnl Privoxy team. http://www.privoxy.org/
@@ -28,6 +28,30 @@ 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.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
@@ -397,7 +421,7 @@ dnl =================================================================
 dnl AutoConf Initialization
 dnl =================================================================
 
-AC_REVISION($Revision: 1.74 $)
+AC_REVISION($Revision: 1.81 $)
 AC_INIT(src/jcc.c)
 
 if test ! -f src/config.h.in; then
@@ -435,6 +459,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},
@@ -460,8 +485,13 @@ 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 
@@ -496,32 +526,78 @@ AC_ARG_WITH(debug,
         ]
 )
 
+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_ERROR(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_ERROR(There is no 'id' programm 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_ERROR(There is no 'groups' programm on this system)
+          else
+            AC_MSG_RESULT(none specified)
+            GROUP=$with_group;
+          fi
         ]
 )
 AC_SUBST(GROUP)
@@ -622,17 +698,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
@@ -900,10 +969,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
@@ -1140,7 +1226,7 @@ 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 \
@@ -1150,7 +1236,7 @@ for i in $DKPREFIXCOPY /usr/share/sgml/docbook/stylesheet/dsssl/modular \
         if test -f $i/html/docbook.dsl; then
                 echo "yes"
                 DKPREFIX=$i
-                break
+                break 
         else
                 echo "no"
         fi
@@ -1236,3 +1322,4 @@ AC_SUBST(SPECIAL_CFLAGS)
 AC_SUBST(PTHREAD_LIB)
 
 AC_OUTPUT(GNUmakefile doc/source/ldp.dsl doc/source/GNUmakefile)
+