]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: setup libcompat.la for portability primitives
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Mar 2009 02:52:23 +0000 (15:52 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Mar 2009 02:52:23 +0000 (15:52 +1300)
This library forms an underlayer which intends to be seamless for the rest
of Squid and the various OS on which it runs.

For code to be eligible for inclusion at this lowest layer it must be
emulating or wrapping a piece of OS-provided API for use on other OS
where it is not provided.

Shared code which is unique to Squid is not portability.

API mappings which are OS-specific are all defined for their particular
OS in the os/* files.

API mappings which are provided by multiple OS or support libraries
are mapped in compat/*

Emulators are acceptable, though the aim should be to inline or template
most of the code so only .h are really needed.

79 files changed:
Makefile.am
compat/GnuRegex.c [moved from lib/GNUregex.c with 99% similarity]
compat/GnuRegex.h [moved from include/GNUregex.h with 97% similarity]
compat/Makefile.am [new file with mode: 0644]
compat/assert.cc [moved from lib/assert.c with 94% similarity]
compat/assert.h [moved from include/assert.h with 91% similarity]
compat/compat.cc [new file with mode: 0644]
compat/compat.h [new file with mode: 0644]
compat/compat_shared.h [new file with mode: 0644]
compat/fdsetsize.h [new file with mode: 0644]
compat/os/aix.h [new file with mode: 0644]
compat/os/dragonfly.h [new file with mode: 0644]
compat/os/freebsd.h [new file with mode: 0644]
compat/os/hpux.h [new file with mode: 0644]
compat/os/linux.h [new file with mode: 0644]
compat/os/mswin.h [new file with mode: 0644]
compat/os/next.h [new file with mode: 0644]
compat/os/openbsd.h [new file with mode: 0644]
compat/os/os2.h [new file with mode: 0644]
compat/os/qnx.h [new file with mode: 0644]
compat/os/sgi.h [new file with mode: 0644]
compat/os/solaris.h [new file with mode: 0644]
compat/os/sunos.h [new file with mode: 0644]
compat/os/windows.h [new file with mode: 0644]
compat/osdetect.h [new file with mode: 0644]
compat/stdvarargs.h [new file with mode: 0644]
compat/valgrind.h [new file with mode: 0644]
configure.in
helpers/basic_auth/LDAP/Makefile.am
helpers/basic_auth/MSNT/Makefile.am
helpers/basic_auth/NCSA/Makefile.am
helpers/basic_auth/PAM/Makefile.am
helpers/basic_auth/SASL/Makefile.am
helpers/basic_auth/SMB/Makefile.am
helpers/basic_auth/YP/Makefile.am
helpers/basic_auth/getpwnam/Makefile.am
helpers/basic_auth/mswin_sspi/Makefile.am
helpers/basic_auth/squid_radius_auth/Makefile.am
helpers/digest_auth/eDirectory/Makefile.am
helpers/digest_auth/ldap/Makefile.am
helpers/digest_auth/password/Makefile.am
helpers/external_acl/ip_user/Makefile.am
helpers/external_acl/ldap_group/Makefile.am
helpers/external_acl/mswin_ad_group/Makefile.am
helpers/external_acl/mswin_lm_group/Makefile.am
helpers/external_acl/session/Makefile.am
helpers/external_acl/unix_group/Makefile.am
helpers/negotiate_auth/squid_kerb_auth/configure.in
helpers/ntlm_auth/fakeauth/Makefile.am
helpers/ntlm_auth/mswin_sspi/Makefile.am
helpers/ntlm_auth/smb_lm/Makefile.am
helpers/ntlm_auth/smb_lm/smbval/Makefile.am
include/Array.h
include/MemPool.h
include/config.h
lib/Makefile.am
lib/rfc1123.c
snmplib/Makefile.am
src/AuthUser.cci
src/ICAP/Makefile.am
src/Makefile.am
src/String.cci
src/acl.cc
src/adaptation/Makefile.am
src/auth/Makefile.am
src/cf_gen.cc
src/eCAP/Makefile.am
src/eCAP/ServiceRep.cc
src/eCAP/XactionRep.cc
src/fs/Makefile.am
src/globals.h
src/icmp/Makefile.am
src/icmp/testIcmp.h
src/ip/Makefile.am
src/repl/Makefile.am
src/squid.h
test-suite/Makefile.am
tools/Makefile.am
tools/cachemgr.cc

index f90fc200bbff643ec678dd73a7df5e6604b8504f..327b61c52e2de0da68a2e58ba7e681127c4f1da1 100644 (file)
@@ -2,8 +2,8 @@
 #
 
 AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 foreign
-DIST_SUBDIRS   = lib snmplib scripts src icons errors contrib doc helpers test-suite tools
-SUBDIRS                = lib @makesnmplib@ scripts src/ip src icons errors doc helpers test-suite tools
+DIST_SUBDIRS   = compat lib snmplib scripts src icons errors contrib doc helpers test-suite tools
+SUBDIRS                = compat lib @makesnmplib@ scripts src/ip src icons errors doc helpers test-suite tools
 
 DISTCLEANFILES = include/stamp-h include/stamp-h[0-9]*
 DEFAULT_PINGER         = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'`
similarity index 99%
rename from lib/GNUregex.c
rename to compat/GnuRegex.c
index 0091bf51bba3757e45631a1ab04ac6e6babea23d..b5ba9eb6b544c4c0c490b4ed4b14fc9423d9c98f 100644 (file)
@@ -34,6 +34,8 @@
 
 #include "config.h"
 
+#if USE_GNUREGEX /* only if squid needs it. Usually not */
+
 #if !HAVE_ALLOCA
 #define REGEX_MALLOC 1
 #endif
@@ -102,9 +104,8 @@ init_syntax_once(void)
 
 #define SYNTAX(c) re_syntax_table[c]
 
-\f
 /* Get the interface, including the syntax bits.  */
-#include "GNUregex.h"
+#include "compat/GnuRegex.h"
 
 /* Compile a fastmap for the compiled pattern in BUFFER; used to
  * accelerate searches.  Return 0 if successful and -2 if was an
@@ -2362,10 +2363,14 @@ typedef struct {
  * the pattern buffer.
  *
  * Returns 0 if we succeed, -2 if an internal error.   */
-
+#ifdef STDC_HEADERS
+int
+re_compile_fastmap(struct re_pattern_buffer *bufp)
+#else
 int
 re_compile_fastmap(bufp)
 struct re_pattern_buffer *bufp;
+#endif
 {
     int j, k;
     fail_stack_type fail_stack;
@@ -4401,6 +4406,7 @@ regex_t *preg;
         free(preg->translate);
     preg->translate = NULL;
 }
+#endif /* USE_GNUREGEX */
 \f
 /*
  * Local variables:
similarity index 97%
rename from include/GNUregex.h
rename to compat/GnuRegex.h
index 65443fefbf50654ec4de61b535105e6d4b9ed707..286e4ff6fb2f31a33f57554a2baaad5b9f536f83 100644 (file)
@@ -1,10 +1,31 @@
 /*
  * $Id$
  */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
 #ifndef SQUID_REGEXP_LIBRARY_H
 #define SQUID_REGEXP_LIBRARY_H
 
-#include "config.h"
+#if !USE_GNUREGEX /* try the system one by default */
+
+/* POSIX says that <sys/types.h> must be included (by the caller) before
+ * <regex.h>.  */
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_REGEX_H
+#include <regex.h>
+#endif
+
+
+#else  /* USE_GNUREGEX */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 
 /* Definitions for data structures and routines for the regular
  * expression library, version 0.12.
@@ -405,6 +426,11 @@ extern size_t regerror
               size_t errbuf_size));
 extern void regfree _RE_ARGS((regex_t * preg));
 
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* USE_GNUREGEX */
 #endif /* SQUID_REGEXP_LIBRARY_H */
 \f
 /*
diff --git a/compat/Makefile.am b/compat/Makefile.am
new file mode 100644 (file)
index 0000000..80ed992
--- /dev/null
@@ -0,0 +1,69 @@
+#
+#  Makefile for the Squid Portability Library
+#
+
+# Housekeeping, shared by all Squid Makefiles.
+# TODO: make this set by configure?
+AM_CFLAGS = @SQUID_CFLAGS@
+AM_CXXFLAGS = @SQUID_CXXFLAGS@
+DEFS = @DEFS@
+CLEANFILES = 
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/src \
+       -I$(top_srcdir)/include \
+       -I$(top_builddir)/lib \
+       @SQUID_CPPUNIT_INC@
+
+$(OBJS): $(top_srcdir)/include/version.h $(top_srcdir)/include/autoconf.h
+
+# Ideally this would be 100% inline functions and macro wrappers.
+
+# Port Specific Configurations
+
+noinst_LTLIBRARIES = libcompat.la
+
+libcompat_la_SOURCES = \
+       assert.h \
+       compat.h \
+       compat_shared.h \
+       fdsetsize.h \
+       osdetect.h \
+       stdvarargs.h \
+       valgrind.h \
+       \
+       os/aix.h \
+       os/dragonfly.h \
+       os/freebsd.h \
+       os/hpux.h \
+       os/linux.h \
+       os/mswin.h \
+       os/next.h \
+       os/openbsd.h \
+       os/os2.h \
+       os/qnx.h \
+       os/sgi.h \
+       os/solaris.h \
+       os/sunos.h \
+       os/windows.h \
+       \
+       assert.cc \
+       compat.cc \
+       GnuRegex.h \
+       GnuRegex.c
+
+
+check_PROGRAMS= testHeaders
+TESTS= $(check_PROGRAMS)
+
+## Special Universal .h dependency test script
+## aborts if error encountered
+testHeaders: $(top_srcdir)/compat/*.h $(top_srcdir)/compat/os/*.h
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/compat/" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/compat/os/" || exit 1
+
+## No such file...
+testHeaders.c:
+       touch testHeaders.c
+CLEANFILES += testHeaders.c
similarity index 94%
rename from lib/assert.c
rename to compat/assert.cc
index 229dbd46c618727457c41f7e9ebaae19032574a8..b1e06e331533a6c396363df3e50e29915e637e0a 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
 
 #include "config.h"
 
+#if HAVE_STDIO_H
 #include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
 
-#include "assert.h"
+#if 0
+#include "compat/assert.h"
+#endif
 
 void xassert(const char *expr, const char *file, int line)
 {
similarity index 91%
rename from include/assert.h
rename to compat/assert.h
index 651bf7cb657bf4b7a2409548b929381238961e20..1bad0a026f20527d15740855d2b09d0fa82dc04e 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
  *
  */
-#ifndef SQUID_ASSERT_H
-#define SQUID_ASSERT_H
 
+#ifndef SQUID_CONFIG_H
 #include "config.h"
+#endif
+
+#ifndef SQUID_ASSERT_H
+#define SQUID_ASSERT_H
 
 #if defined(NODEBUG)
 #define assert(EX) ((void)0)
 #else
 #define assert(EX)  ((EX)?((void)0):xassert("EX", __FILE__, __LINE__))
 #endif
-SQUIDCEXTERN void xassert(const char *, const char *, int);
 
+#ifdef __cplusplus
+extern "C" void
+#else
+extern void
 #endif
+xassert(const char *, const char *, int);
+
+#endif /* SQUID_ASSERT_H */
diff --git a/compat/compat.cc b/compat/compat.cc
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/compat/compat.h b/compat/compat.h
new file mode 100644 (file)
index 0000000..7f5dff0
--- /dev/null
@@ -0,0 +1,95 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_COMPAT_H
+#define _SQUID_COMPAT_H
+
+/*
+ * From discussions it was chosen to push compat code as far down as possible.
+ * That means we can have a seperate compat for most
+ *  compatability and portability hacks and resolutions.
+ * 
+ * This file is meant to collate all those hacks files together and
+ * provide a simple include for them in the core squid headers
+ * (presently squid.h and config.h) 
+ *
+ * It should not be included directly in any of the squid sources.
+ * If your code requires any symbols from here you should be importing
+ * config.h/squid.h at the top line of your .cc or .h file.
+ */
+
+
+/******************************************************/
+/* Define the _SQUID_TYPE_ based on a guess of the OS */
+/* NP: this MUST come first within compat.h           */
+/******************************************************/
+#include "compat/osdetect.h"
+
+
+/*****************************************************/
+/* FDSETSIZE is messy and needs to be done before    */
+/* sys/types.h are defined.                          */
+/*****************************************************/
+#include "compat/fdsetsize.h"
+
+
+/*****************************************************/
+/* Global type re-definitions                        */
+/* this also takes care of the basic system includes */
+/*****************************************************/
+
+/** On linux this must be defined to get PRId64 and friends */
+#define __STDC_FORMAT_MACROS
+
+#include "squid_types.h"
+
+/*****************************************************/
+/* per-OS hacks. One file per OS.                    */
+/* OS-macro wrapping should be done inside the OS .h */
+/*****************************************************/
+
+#include "compat/os/aix.h"
+#include "compat/os/dragonfly.h"
+#include "compat/os/freebsd.h"
+#include "compat/os/hpux.h"
+#include "compat/os/linux.h"
+#include "compat/os/mswin.h"
+#include "compat/os/next.h"
+#include "compat/os/openbsd.h"
+#include "compat/os/os2.h"
+#include "compat/os/qnx.h"
+#include "compat/os/sgi.h"
+#include "compat/os/solaris.h"
+#include "compat/os/sunos.h"
+#include "compat/os/windows.h"
+
+
+/*****************************************************/
+/* portabilities shared between all platforms and    */
+/* components as found to be needed                  */
+/*****************************************************/
+
+#include "compat/compat_shared.h"
+#include "compat/stdvarargs.h"
+#include "compat/assert.h"
+
+/*****************************************************/
+/* component-specific portabilities                  */
+/*****************************************************/
+
+/* Valgrind API macros changed between two versions squid supports */
+#include "compat/valgrind.h"
+
+/* Endian functions are usualy handled by the OS but not always. */
+#include "squid_endian.h"
+
+/**
+ * A Regular Expression library is bundled with Squid.
+ * Default is to use a system provided one, but the bundle
+ * may be used instead with explicit configuration.
+ */
+#include "compat/GnuRegex.h"
+
+
+#endif /* _SQUID_COMPAT_H */
diff --git a/compat/compat_shared.h b/compat/compat_shared.h
new file mode 100644 (file)
index 0000000..a2bc9a4
--- /dev/null
@@ -0,0 +1,211 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_COMPAT_SHARED_H
+#define _SQUID_COMPAT_SHARED_H
+
+/*
+ * This file contains all the compatibility and portability hacks
+ * Which are general-case and shared between all OS and support programs.
+ * 
+ * If an OS-specific hack is needed there are per-OS files for that in
+ * the os/ sub-directory here.
+ *
+ * These hacks should be platform and location agnostic.
+ * A quick look-over of the code already here should give you an idea
+ * of the requirements for wrapping your hack for safe portability.
+ */
+
+
+/*
+ * sys/resource.h and sys/time.h are apparently order-dependant.
+ */
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>       /* needs sys/time.h above it */
+#endif
+
+/*
+ * DIRENT functionality can apparently come from many places.
+ * I believe these should really be done by OS-specific compat
+ * files, but for now its left here.
+ */
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#define NAMLEN(dirent) strlen((dirent)->d_name)
+
+#else /* if not HAVE_DIRENT_H */
+#define dirent direct
+#define NAMLEN(dirent) (dirent)->d_namlen
+#if HAVE_SYS_NDIR_H
+#include <sys/ndir.h>
+#endif /* HAVE_SYS_NDIR_H */
+#if HAVE_SYS_DIR_H
+#include <sys/dir.h>
+#endif /* HAVE_SYS_DIR_H */
+#if HAVE_NDIR_H
+#include <ndir.h>
+#endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
+
+
+/*
+ * Filedescriptor limits in the different select loops
+ * 
+ * NP: FreeBSD 7 defines FD_SETSIZE as unsigned but Squid needs
+ *     it to be signed to compare it with signed values.
+ *     Linux and others including FreeBSD <7, define it as signed.
+ *     If this causes any issues please contact squid-dev@squid-cache.org
+ */
+#if defined(USE_SELECT) || defined(USE_SELECT_WIN32)
+/* Limited by design */
+# define SQUID_MAXFD_LIMIT    ((signed int)FD_SETSIZE)
+
+#elif defined(USE_POLL)
+/* Limited due to delay pools */
+# define SQUID_MAXFD_LIMIT    ((signed int)FD_SETSIZE)
+
+#elif defined(USE_KQUEUE) || defined(USE_EPOLL)
+# define SQUID_FDSET_NOUSE 1
+
+#else
+# error Unknown select loop model!
+#endif
+
+
+
+#if !HAVE_STRUCT_RUSAGE
+/**
+ * If we don't have getrusage() then we create a fake structure
+ * with only the fields Squid cares about.  This just makes the
+ * source code cleaner, so we don't need lots of #ifdefs in other
+ * places
+ */
+struct rusage
+{
+    struct timeval ru_stime;
+    struct timeval ru_utime;
+    int ru_maxrss;
+    int ru_majflt;
+};
+#endif /* !HAVE_STRUCT_RUSAGE */
+
+
+/* templates require C++ */
+#ifdef __cplusplus
+
+#ifndef min
+/**
+ * min() comparison may not always be provided.
+ * Squid bundles this template for when its needed.
+ * May be used on any type which provides operator '<'
+ */
+template<class A>
+inline A const &
+min(A const & lhs, A const & rhs)
+{
+    if (rhs < lhs)
+        return rhs;
+    return lhs;
+}
+#endif
+#define XMIN(x,y) (min (x,y))
+
+#ifndef max
+/**
+ * max() comparison may not always be provided.
+ * Squid bundles this template for when its needed.
+ * May be used on any type which provides operator '>'
+ */
+template<class A>
+inline A const &
+max(A const & lhs, A const & rhs)
+{
+    if (rhs > lhs)
+        return rhs;
+    return lhs;
+}
+#endif
+#define XMAX(a,b) (max (a,b))
+
+#endif /* __cplusplus */
+
+/**
+ * tempnam() not provided by all systems
+ * TODO: detect WHICH systems and move to their OS-specific compat files
+ */
+#if !HAVE_TEMPNAM
+#include "tempnam.h"
+#endif
+
+/**
+ * strsep() not provided by all systems
+ * TODO: detect WHICH systems and move to their OS-specific compat files
+ */
+#if !HAVE_STRSEP
+#include "strsep.h"
+#endif
+
+/**
+ * strtoll() not provided by all systems
+ * TODO: detect WHICH systems and move to their OS-specific compat files
+ */
+#if !HAVE_STRTOLL
+#include "strtoll.h"
+#endif
+
+/**
+ * Common shared definition of what whitespace consists of for string tests
+ */
+#define w_space     " \t\n\r"
+
+/**
+ * initgroups() not provided by all systems
+ * TODO: detect WHICH systems and move to their OS-specific compat files
+ */
+#if !HAVE_INITGROUPS
+#include "initgroups.h"
+#endif
+
+
+/* REQUIRED for the below logics. If they move this needs to as well */
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if defined(O_NONBLOCK)
+/**
+ * We used to assume O_NONBLOCK was broken on Solaris, but evidence
+ * now indicates that its fine on Solaris 8, and in fact required for
+ * properly detecting EOF on FIFOs.  So now we assume that if
+ * its defined, it works correctly on all operating systems.
+ */
+#define SQUID_NONBLOCK O_NONBLOCK
+#else
+/** O_NDELAY is our fallback. */
+#define SQUID_NONBLOCK O_NDELAY
+#endif
+
+
+/**
+ * Signalling flags are apparently not always provided.
+ * TODO find out if these can be moved into specific OS portability files.
+ */
+#ifndef SA_RESTART
+#define SA_RESTART 0
+#endif
+#ifndef SA_NODEFER
+#define SA_NODEFER 0
+#endif
+#ifndef SA_RESETHAND
+#define SA_RESETHAND 0
+#endif
+#if SA_RESETHAND == 0 && defined(SA_ONESHOT)
+#undef SA_RESETHAND
+#define SA_RESETHAND SA_ONESHOT
+#endif
+
+
+#endif /* _SQUID_COMPAT_SHARED_H */
diff --git a/compat/fdsetsize.h b/compat/fdsetsize.h
new file mode 100644 (file)
index 0000000..ad8ddf6
--- /dev/null
@@ -0,0 +1,90 @@
+#ifndef SQUID_FDSETSIZE_H
+#define SQUID_FDSETSIZE_H
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/* FD_SETSIZE must be redefined before including sys/types.h */
+#if 0
+/* AYJ: would dearly like to use this to enforce include order
+       but at present some helpers don't follow the squid include methodology.
+       that will need fixing later.
+*/
+#ifdef _SYS_TYPES_H
+#error squid_fdsetsize.h for FDSETSIZE must be included before sys/types.h
+#error Make sure that squid.h or config.h is the first file included by your .cc
+#endif
+#endif /* 0 */
+/*
+ * On some systems, FD_SETSIZE is set to something lower than the
+ * actual number of files which can be opened.  IRIX is one case,
+ * NetBSD is another.  So here we increase FD_SETSIZE to our
+ * configure-discovered maximum *before* any system includes.
+ */
+#define CHANGE_FD_SETSIZE 1
+
+/*
+ * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
+ * with glibc 2.2 (or later? remains to be seen). We do this by including
+ * bits/types.h which defines __FD_SETSIZE first, then we redefine
+ * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
+ * directly, so this is a dirty hack!
+ */
+#if defined(_SQUID_LINUX_)
+#undef CHANGE_FD_SETSIZE
+#define CHANGE_FD_SETSIZE 0
+#include <features.h>
+#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+#if SQUID_MAXFD > DEFAULT_FD_SETSIZE
+#include <bits/types.h>
+#undef __FD_SETSIZE
+#define __FD_SETSIZE SQUID_MAXFD
+#endif
+#endif
+#endif
+
+/*
+ * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
+ * to return EINVAL.
+ * --Marian Durkovic <marian@svf.stuba.sk>
+ * --Peter Wemm <peter@spinner.DIALix.COM>
+ */
+#if defined(_SQUID_FREEBSD_)
+#include <osreldate.h>
+#if __FreeBSD_version < 220000
+#undef CHANGE_FD_SETSIZE
+#define CHANGE_FD_SETSIZE 0
+#endif
+#endif
+
+/*
+ * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
+ * on Mac OS X Server.
+ */
+#if defined(_SQUID_APPLE_)
+#undef CHANGE_FD_SETSIZE
+#define CHANGE_FD_SETSIZE 0
+#endif
+
+/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
+#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
+#define FD_SETSIZE SQUID_MAXFD
+#endif
+
+
+/*
+ * Trap unintentional use of fd_set. Must not be used outside the
+ * select code as it only supports FD_SETSIZE number of filedescriptors
+ * and Squid may be running with a lot more..
+ * But only for code linked into Squid, not the helpers.. (unlinkd, pinger)
+ */
+#ifdef SQUID_FDSET_NOUSE
+# ifndef SQUID_HELPER
+#  define fd_set ERROR_FD_SET_USED
+# endif
+#endif
+
+#endif /* SQUID_FDSETSIZE_H */
diff --git a/compat/os/aix.h b/compat/os/aix.h
new file mode 100644 (file)
index 0000000..3286eb4
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_AIX_H
+#define SQUID_OS_AIX_H
+
+#ifdef _SQUID_AIX_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+/*
+ * Syslog facility on AIX requires some portability wrappers
+ */
+#ifdef HAVE_SYSLOG_H
+#define _XOPEN_EXTENDED_SOURCE
+#define _XOPEN_SOURCE_EXTENDED 1
+#endif
+
+
+#endif /* _SQUID_AIX_ */
+#endif /* SQUID_OS_AIX_H */
diff --git a/compat/os/dragonfly.h b/compat/os/dragonfly.h
new file mode 100644 (file)
index 0000000..e7fa904
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_DRAGONFLY_H
+#define SQUID_OS_DRAGONFLY_H
+
+#ifdef _SQUID_DRAGONFLY_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * Don't allow inclusion of malloc.h
+ */
+#if defined(HAVE_MALLOC_H)
+#undef HAVE_MALLOC_H
+#endif
+
+
+#endif /* _SQUID_DRAGONFLY_ */
+#endif /* SQUID_OS_DRAGONFLY_H */
diff --git a/compat/os/freebsd.h b/compat/os/freebsd.h
new file mode 100644 (file)
index 0000000..e4fb395
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_FREEBSD_H
+#define SQUID_OS_FREEBSD_H
+
+#ifdef _SQUID_FREEBSD_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+#if USE_ASYNC_IO && defined(LINUXTHREADS)
+#define _SQUID_LINUX_THREADS_
+#endif
+
+/*
+ * Don't allow inclusion of malloc.h
+ */
+#if defined(HAVE_MALLOC_H)
+#undef HAVE_MALLOC_H
+#endif
+
+#define _etext etext
+
+#endif /* _SQUID_FREEBSD_ */
+#endif /* SQUID_OS_FREEBSD_H */
diff --git a/compat/os/hpux.h b/compat/os/hpux.h
new file mode 100644 (file)
index 0000000..993d14d
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_HPUX_H
+#define SQUID_OS_PHUX_H
+
+#ifdef _SQUID_HPUX_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+#if !defined(HAVE_GETPAGESIZE)
+#define HAVE_GETPAGESIZE
+#define getpagesize( )   sysconf(_SC_PAGE_SIZE)
+#endif
+
+/*
+ * getrusage(...) not available on some HPUX
+ */
+#if !HAVE_GETRUSAGE
+#define HAVE_GETRUSAGE 1
+#define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
+#endif
+
+
+#endif /* _SQUID_HPUX_ */
+#endif /* SQUID_OS_HPUX_H */
diff --git a/compat/os/linux.h b/compat/os/linux.h
new file mode 100644 (file)
index 0000000..947de98
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_LINUX_H
+#define SQUID_OS_LINUX_H
+
+#ifdef _SQUID_LINUX_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+#if USE_ASYNC_IO
+#define _SQUID_LINUX_THREADS_
+#endif
+
+/*
+ * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
+ */
+#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
+#define res_init  __res_init
+#define HAVE_RES_INIT  HAVE___RES_INIT
+#endif
+
+
+#endif /* _SQUID_LINUX_ */
+#endif /* SQUID_OS_LINUX_H */
diff --git a/compat/os/mswin.h b/compat/os/mswin.h
new file mode 100644 (file)
index 0000000..fd0860c
--- /dev/null
@@ -0,0 +1,768 @@
+/*
+ * $Id$
+ *
+ * AUTHOR: Andrey Shorin <tolsty@tushino.com>
+ * AUTHOR: Guido Serassio <serassio@squid-cache.org>
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  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.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_MSWIN_H
+#define SQUID_OS_MSWIN_H
+
+#ifdef _SQUID_WIN32_
+
+#define ACL WindowsACL
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#if _MSC_VER == 1400
+#define _CRT_SECURE_NO_DEPRECATE
+#pragma warning( disable : 4290 )
+#pragma warning( disable : 4996 )
+#endif
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64   1
+#endif
+
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+
+typedef long pid_t;
+
+#if defined __USE_FILE_OFFSET64
+typedef int64_t off_t;
+typedef uint64_t ino_t;
+
+#else
+typedef long off_t;
+typedef unsigned long ino_t;
+
+#endif
+
+#define INT64_MAX _I64_MAX
+#define INT64_MIN _I64_MIN
+
+#include "default_config_file.h"
+/* Some tricks for MS Compilers */
+#define __STDC__ 1
+#define THREADLOCAL __declspec(thread)
+
+#elif defined(__GNUC__) /* gcc environment */
+
+#define THREADLOCAL __attribute__((section(".tls")))
+
+#endif
+
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define alloca _alloca
+#endif
+#define chdir _chdir
+#define dup _dup
+#define dup2 _dup2
+#define fdopen _fdopen
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define fileno _fileno
+#define fstat _fstati64
+#endif
+#define ftruncate WIN32_ftruncate
+#define getcwd _getcwd
+#define getpid _getpid
+#define getrusage WIN32_getrusage
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define lseek _lseeki64
+#define memccpy _memccpy
+#define mkdir(p) _mkdir(p)
+#define mktemp _mktemp
+#endif
+#define pclose _pclose
+#define pipe WIN32_pipe
+#define popen _popen
+#define putenv _putenv
+#define setmode _setmode
+#define sleep(t) Sleep((t)*1000)
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define snprintf _snprintf
+#define stat _stati64
+#define strcasecmp _stricmp
+#define strdup _strdup
+#define strlwr _strlwr
+#define strncasecmp _strnicmp
+#define tempnam _tempnam
+#endif
+#define truncate WIN32_truncate
+#define umask _umask
+#define unlink _unlink
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define vsnprintf _vsnprintf
+#endif
+
+#define O_RDONLY        _O_RDONLY
+#define O_WRONLY        _O_WRONLY
+#define O_RDWR          _O_RDWR
+#define O_APPEND        _O_APPEND
+
+#define O_CREAT         _O_CREAT
+#define O_TRUNC         _O_TRUNC
+#define O_EXCL          _O_EXCL
+
+#define O_TEXT          _O_TEXT
+#define O_BINARY        _O_BINARY
+#define O_RAW           _O_BINARY
+#define O_TEMPORARY     _O_TEMPORARY
+#define O_NOINHERIT     _O_NOINHERIT
+#define O_SEQUENTIAL    _O_SEQUENTIAL
+#define O_RANDOM        _O_RANDOM
+#define O_NDELAY       0
+
+#define S_IFMT   _S_IFMT
+#define S_IFDIR  _S_IFDIR
+#define S_IFCHR  _S_IFCHR
+#define S_IFREG  _S_IFREG
+#define S_IREAD  _S_IREAD
+#define S_IWRITE _S_IWRITE
+#define S_IEXEC  _S_IEXEC
+
+#define S_IRWXO 007
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#define        S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
+#endif
+
+#define        SIGHUP  1       /* hangup */
+#define        SIGKILL 9       /* kill (cannot be caught or ignored) */
+#define        SIGBUS  10      /* bus error */
+#define        SIGPIPE 13      /* write on a pipe with no one to read it */
+#define        SIGCHLD 20      /* to parent on child stop or exit */
+#define SIGUSR1 30     /* user defined signal 1 */
+#define SIGUSR2 31     /* user defined signal 2 */
+
+typedef unsigned short int ushort;
+typedef int uid_t;
+typedef int gid_t;
+
+struct passwd {
+    char    *pw_name;      /* user name */
+    char    *pw_passwd;    /* user password */
+    uid_t   pw_uid;        /* user id */
+    gid_t   pw_gid;        /* group id */
+    char    *pw_gecos;     /* real name */
+    char    *pw_dir;       /* home directory */
+    char    *pw_shell;     /* shell program */
+};
+
+struct group {
+    char    *gr_name;      /* group name */
+    char    *gr_passwd;    /* group password */
+    gid_t   gr_gid;        /* group id */
+    char    **gr_mem;      /* group members */
+};
+
+struct statfs {
+    long    f_type;     /* type of filesystem (see below) */
+    long    f_bsize;    /* optimal transfer block size */
+    long    f_blocks;   /* total data blocks in file system */
+    long    f_bfree;    /* free blocks in fs */
+    long    f_bavail;   /* free blocks avail to non-superuser */
+    long    f_files;    /* total file nodes in file system */
+    long    f_ffree;    /* free file nodes in fs */
+    long    f_fsid;     /* file system id */
+    long    f_namelen;  /* maximum length of filenames */
+    long    f_spare[6]; /* spare for later */
+};
+
+#ifndef HAVE_GETTIMEOFDAY
+struct timezone {
+    int        tz_minuteswest; /* minutes west of Greenwich */
+    int        tz_dsttime;     /* type of dst correction */
+};
+#endif
+
+#define CHANGE_FD_SETSIZE 1
+#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
+#define FD_SETSIZE SQUID_MAXFD
+#endif
+
+#include <stddef.h>
+#include <process.h>
+#include <errno.h>
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#include <winsock2.h>
+#endif
+#include <ws2tcpip.h>
+#if (EAI_NODATA == EAI_NONAME)
+#undef EAI_NODATA
+#define EAI_NODATA WSANO_DATA
+#endif
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+/* Hack to suppress compiler warnings on FD_SET() & FD_CLR() */
+#pragma warning (push)
+#pragma warning (disable:4142)
+#endif
+/* prevent inclusion of wingdi.h */
+#define NOGDI
+#include <ws2spi.h>
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+#pragma warning (pop)
+#endif
+#include <io.h>
+#include <stdlib.h>
+
+typedef char * caddr_t;
+
+#undef FD_CLOSE
+#undef FD_OPEN
+#undef FD_READ
+#undef FD_WRITE
+#define EISCONN WSAEISCONN
+#define EINPROGRESS WSAEINPROGRESS
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EALREADY WSAEALREADY
+#define ETIMEDOUT WSAETIMEDOUT
+#define ECONNREFUSED WSAECONNREFUSED
+#define ECONNRESET WSAECONNRESET
+#define ENOTCONN WSAENOTCONN
+#define ERESTART WSATRY_AGAIN
+#define EAFNOSUPPORT WSAEAFNOSUPPORT
+
+#undef h_errno
+#define h_errno errno /* we'll set it ourselves */
+
+#undef FD_CLR
+#define FD_CLR(fd, set) do { \
+    u_int __i; \
+    SOCKET __sock = _get_osfhandle(fd); \
+    for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \
+        if (((fd_set FAR *)(set))->fd_array[__i] == __sock) { \
+            while (__i < ((fd_set FAR *)(set))->fd_count-1) { \
+                ((fd_set FAR *)(set))->fd_array[__i] = \
+                    ((fd_set FAR *)(set))->fd_array[__i+1]; \
+                __i++; \
+            } \
+            ((fd_set FAR *)(set))->fd_count--; \
+            break; \
+        } \
+    } \
+} while(0)
+
+#undef FD_SET
+#define FD_SET(fd, set) do { \
+    u_int __i; \
+    SOCKET __sock = _get_osfhandle(fd); \
+    for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
+        if (((fd_set FAR *)(set))->fd_array[__i] == (__sock)) { \
+            break; \
+        } \
+    } \
+    if (__i == ((fd_set FAR *)(set))->fd_count) { \
+        if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
+            ((fd_set FAR *)(set))->fd_array[__i] = (__sock); \
+            ((fd_set FAR *)(set))->fd_count++; \
+        } \
+    } \
+} while(0)
+
+#undef FD_ISSET
+#define FD_ISSET(fd, set) Win32__WSAFDIsSet(fd, (fd_set FAR *)(set))
+
+/* internal to Microsoft CRTLIB */
+typedef struct {
+    long osfhnd;    /* underlying OS file HANDLE */
+    char osfile;    /* attributes of file (e.g., open in text mode?) */
+    char pipech;    /* one char buffer for handles opened on pipes */
+#ifdef _MT
+    int lockinitflag;
+    CRITICAL_SECTION lock;
+#endif  /* _MT */
+}   ioinfo;
+#define IOINFO_L2E          5
+#define IOINFO_ARRAY_ELTS   (1 << IOINFO_L2E)
+#define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1)) )
+#define _osfile(i)  ( _pioinfo(i)->osfile )
+#define _osfhnd(i)  ( _pioinfo(i)->osfhnd )
+#define FOPEN           0x01    /* file handle open */
+
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+
+SQUIDCEXTERN _CRTIMP ioinfo * __pioinfo[];
+SQUIDCEXTERN int __cdecl _free_osfhnd(int);
+
+#elif defined(__MINGW32__) /* MinGW environment */
+
+__MINGW_IMPORT ioinfo * __pioinfo[];
+SQUIDCEXTERN int _free_osfhnd(int);
+
+#endif
+
+SQUIDCEXTERN THREADLOCAL int ws32_result;
+
+#define strerror(e) WIN32_strerror(e)
+
+#ifdef __cplusplus
+
+inline
+int close(int fd)
+{
+    char l_so_type[sizeof(int)];
+    int l_so_type_siz = sizeof(l_so_type);
+    SOCKET sock = _get_osfhandle(fd);
+
+    if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0) {
+        int result = 0;
+        if (closesocket(sock) == SOCKET_ERROR) {
+            errno = WSAGetLastError();
+            result = 1;
+        }
+        _free_osfhnd(fd);
+        _osfile(fd) = 0;
+        return result;
+    } else
+        return _close(fd);
+}
+
+#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
+
+#ifndef _S_IREAD
+#define _S_IREAD 0x0100
+#endif
+
+#ifndef _S_IWRITE
+#define _S_IWRITE 0x0080
+#endif
+
+inline
+int open(const char *filename, int oflag, int pmode = 0)
+{
+    return _open(filename, oflag, pmode & (_S_IREAD | _S_IWRITE));
+}
+#endif
+
+inline
+int read(int fd, void * buf, size_t siz)
+{
+    char l_so_type[sizeof(int)];
+    int l_so_type_siz = sizeof(l_so_type);
+    SOCKET sock = _get_osfhandle(fd);
+
+    if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0)
+        return ::recv(sock, (char FAR *) buf, (int)siz, 0);
+    else
+        return _read(fd, buf, (unsigned int)siz);
+}
+
+inline
+int write(int fd, const void * buf, size_t siz)
+{
+    char l_so_type[sizeof(int)];
+    int l_so_type_siz = sizeof(l_so_type);
+    SOCKET sock = _get_osfhandle(fd);
+
+    if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0)
+        return ::send(sock, (char FAR *) buf, siz, 0);
+    else
+        return _write(fd, buf, siz);
+}
+
+inline
+char *index(const char *s, int c)
+{
+    return (char *)strchr(s,c);
+}
+
+/** \cond AUTODOCS-IGNORE */
+namespace Squid
+{
+/** \endcond */
+
+inline
+int accept(int s, struct sockaddr * a, size_t * l)
+{
+    SOCKET result;
+    if ((result = ::accept(_get_osfhandle(s), a, (int *)l)) == INVALID_SOCKET) {
+        if (WSAEMFILE == (errno = WSAGetLastError()))
+            errno = EMFILE;
+        return -1;
+    } else
+        return _open_osfhandle(result, 0);
+}
+
+inline
+int bind(int s, struct sockaddr * n, int l)
+{
+    if (::bind(_get_osfhandle(s),n,l) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+int connect(int s, const struct sockaddr * n, int l)
+{
+    if (::connect(_get_osfhandle(s),n,l) == SOCKET_ERROR) {
+        if (WSAEMFILE == (errno = WSAGetLastError()))
+            errno = EMFILE;
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+struct hostent * gethostbyname (const char *n) {
+    HOSTENT FAR * result;
+    if ((result = ::gethostbyname(n)) == NULL)
+        errno = WSAGetLastError();
+    return result;
+}
+#define gethostbyname(n) Squid::gethostbyname(n)
+
+inline
+SERVENT FAR* getservbyname (const char * n, const char * p)
+{
+    SERVENT FAR * result;
+    if ((result = ::getservbyname(n, p)) == NULL)
+        errno = WSAGetLastError();
+    return result;
+}
+#define getservbyname(n,p) Squid::getservbyname(n,p)
+
+inline
+HOSTENT FAR * gethostbyaddr(const char * a, int l, int t)
+{
+    HOSTENT FAR * result;
+    if ((result = ::gethostbyaddr(a, l, t)) == NULL)
+        errno = WSAGetLastError();
+    return result;
+}
+#define gethostbyaddr(a,l,t) Squid::gethostbyaddr(a,l,t)
+
+inline
+int getsockname(int s, struct sockaddr * n, size_t * l)
+{
+    if ((::getsockname(_get_osfhandle(s), n, (int *)l)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+int gethostname(char * n, size_t l)
+{
+    if ((::gethostname(n, l)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+#define gethostname(n,l) Squid::gethostname(n,l)
+
+inline
+int getsockopt(int s, int l, int o, void * v, int * n)
+{
+    Sleep(1);
+    if ((::getsockopt(_get_osfhandle(s), l, o,(char *) v, n)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+/* Simple ioctl() emulation */
+inline
+int ioctl(int s, int c, void * a)
+{
+    if ((::ioctlsocket(_get_osfhandle(s), c, (u_long FAR *)a)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+int ioctlsocket(int s, long c, u_long FAR * a)
+{
+    if ((::ioctlsocket(_get_osfhandle(s), c, a)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+int listen(int s, int b)
+{
+    if (::listen(_get_osfhandle(s), b) == SOCKET_ERROR) {
+        if (WSAEMFILE == (errno = WSAGetLastError()))
+            errno = EMFILE;
+        return -1;
+    } else
+        return 0;
+}
+#define listen(s,b) Squid::listen(s,b)
+
+inline
+int recv(int s, void * b, size_t l, int f)
+{
+    int result;
+    if ((result = ::recv(_get_osfhandle(s), (char *)b, l, f)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return result;
+}
+
+inline
+int recvfrom(int s, void * b, size_t l, int f, struct sockaddr * fr, size_t * fl)
+{
+    int result;
+    if ((result = ::recvfrom(_get_osfhandle(s), (char *)b, l, f, fr, (int *)fl)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return result;
+}
+
+inline
+int select(int n, fd_set * r, fd_set * w, fd_set * e, struct timeval * t)
+{
+    int result;
+    if ((result = ::select(n,r,w,e,t)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return result;
+}
+#define select(n,r,w,e,t) Squid::select(n,r,w,e,t)
+
+inline
+int send(int s, const void * b, size_t l, int f)
+{
+    int result;
+    if ((result = ::send(_get_osfhandle(s), (char *)b, l, f)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return result;
+}
+
+inline
+int sendto(int s, const void * b, size_t l, int f, const struct sockaddr * t, int tl)
+{
+    int result;
+    if ((result = ::sendto(_get_osfhandle(s), (char *)b, l, f, t, tl)) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return result;
+}
+
+inline
+int setsockopt(SOCKET s, int l, int o, const char * v, int n)
+{
+    SOCKET socket;
+
+    socket = ((s == INVALID_SOCKET) ? s : (SOCKET)_get_osfhandle((int)s));
+
+    if (::setsockopt(socket, l, o, v, n) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+#define setsockopt(s,l,o,v,n) Squid::setsockopt(s,l,o,v,n)
+
+inline
+int shutdown(int s, int h)
+{
+    if (::shutdown(_get_osfhandle(s),h) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+inline
+int socket(int f, int t, int p)
+{
+    SOCKET result;
+    if ((result = ::socket(f, t, p)) == INVALID_SOCKET) {
+        if (WSAEMFILE == (errno = WSAGetLastError()))
+            errno = EMFILE;
+        return -1;
+    } else
+        return _open_osfhandle(result, 0);
+}
+#define socket(f,t,p) Squid::socket(f,t,p)
+
+inline
+int WSAAsyncSelect(int s, HWND h, unsigned int w, long e)
+{
+    if (::WSAAsyncSelect(_get_osfhandle(s), h, w, e) == SOCKET_ERROR) {
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+#undef WSADuplicateSocket
+inline
+int WSADuplicateSocket(int s, DWORD n, LPWSAPROTOCOL_INFO l)
+{
+#ifdef UNICODE
+    if (::WSADuplicateSocketW(_get_osfhandle(s), n, l) == SOCKET_ERROR) {
+#else
+    if (::WSADuplicateSocketA(_get_osfhandle(s), n, l) == SOCKET_ERROR) {
+#endif
+        errno = WSAGetLastError();
+        return -1;
+    } else
+        return 0;
+}
+
+#undef WSASocket
+inline
+int WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f) {
+    SOCKET result;
+#ifdef UNICODE
+    if ((result = ::WSASocketW(a, t, p, i, g, f)) == INVALID_SOCKET) {
+#else
+    if ((result = ::WSASocketA(a, t, p, i, g, f)) == INVALID_SOCKET) {
+#endif
+        if (WSAEMFILE == (errno = WSAGetLastError()))
+            errno = EMFILE;
+        return -1;
+    } else
+        return _open_osfhandle(result, 0);
+}
+
+} /* namespace Squid */
+
+#else /* #ifdef __cplusplus */
+#define connect(s,n,l) \
+       (SOCKET_ERROR == connect(_get_osfhandle(s),n,l) ? \
+       (WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1, -1) : 0)
+#define gethostbyname(n) \
+       (NULL == ((HOSTENT FAR*)(ws32_result = (int)gethostbyname(n))) ? \
+       (errno = WSAGetLastError()), (HOSTENT FAR*)NULL : (HOSTENT FAR*)ws32_result)
+#define gethostname(n,l) \
+       (SOCKET_ERROR == gethostname(n,l) ? \
+       (errno = WSAGetLastError()), -1 : 0)
+#define recv(s,b,l,f) \
+       (SOCKET_ERROR == (ws32_result = recv(_get_osfhandle(s),b,l,f)) ? \
+       (errno = WSAGetLastError()), -1 : ws32_result)
+#define sendto(s,b,l,f,t,tl) \
+       (SOCKET_ERROR == (ws32_result = sendto(_get_osfhandle(s),b,l,f,t,tl)) ? \
+       (errno = WSAGetLastError()), -1 : ws32_result)
+#define select(n,r,w,e,t) \
+       (SOCKET_ERROR == (ws32_result = select(n,r,w,e,t)) ? \
+       (errno = WSAGetLastError()), -1 : ws32_result)
+#define socket(f,t,p) \
+       (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)socket(f,t,p))) ? \
+       ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \
+       (SOCKET)_open_osfhandle(ws32_result,0))
+#define write      _write /* Needed in util.c */
+#define open       _open /* Needed in win32lib.c */
+#endif /* #ifdef __cplusplus */
+
+#define        RUSAGE_SELF     0               /* calling process */
+#define        RUSAGE_CHILDREN -1              /* terminated child processes */
+
+struct rusage {
+    struct timeval ru_utime;   /* user time used */
+    struct timeval ru_stime;   /* system time used */
+    long ru_maxrss;                    /* integral max resident set size */
+    long ru_ixrss;                     /* integral shared text memory size */
+    long ru_idrss;                     /* integral unshared data size */
+    long ru_isrss;                     /* integral unshared stack size */
+    long ru_minflt;                    /* page reclaims */
+    long ru_majflt;                    /* page faults */
+    long ru_nswap;                     /* swaps */
+    long ru_inblock;           /* block input operations */
+    long ru_oublock;           /* block output operations */
+    long ru_msgsnd;                    /* messages sent */
+    long ru_msgrcv;                    /* messages received */
+    long ru_nsignals;          /* signals received */
+    long ru_nvcsw;                     /* voluntary context switches */
+    long ru_nivcsw;                    /* involuntary context switches */
+};
+
+#undef ACL
+
+
+/** \cond AUTODOCS-IGNORE */
+using namespace Squid;
+/** \endcond */
+
+
+/* win32lib.c */
+SQUIDCEXTERN int chroot (const char *);
+SQUIDCEXTERN int ftruncate(int, off_t);
+#ifndef HAVE_GETTIMEOFDAY
+SQUIDCEXTERN int gettimeofday(struct timeval * ,void *);
+#endif
+SQUIDCEXTERN int kill(pid_t, int);
+SQUIDCEXTERN int statfs(const char *, struct statfs *);
+SQUIDCEXTERN int truncate(const char *, off_t);
+SQUIDCEXTERN const char * wsastrerror(int);
+SQUIDCEXTERN struct passwd *getpwnam(char *);
+SQUIDCEXTERN struct group *getgrnam(char *);
+SQUIDCEXTERN uid_t geteuid(void);
+SQUIDCEXTERN uid_t getuid(void);
+SQUIDCEXTERN int setuid(uid_t);
+SQUIDCEXTERN int seteuid(uid_t);
+SQUIDCEXTERN gid_t getgid(void);
+SQUIDCEXTERN gid_t getegid(void);
+SQUIDCEXTERN int setgid(gid_t);
+SQUIDCEXTERN int setegid(gid_t);
+SQUIDCEXTERN const char *WIN32_strerror(int);
+SQUIDCEXTERN void WIN32_maperror(unsigned long);
+
+// Moved in from squid.h and other duplicates.
+// BUT was already included up the top there with a wrapped conditional.
+// that may need checking....
+//#include <io.h>
+
+/* Windows may lack getpagesize() prototype */
+// Moved in from squid.h
+// NP: there may be a header include needed before this to prevent duplicate-definitions
+//     if that is true it will need including here as part of the hack.
+//     if not then this comment can be dropped.
+#if !defined(getpagesize)
+SQUIDCEXTERN size_t getpagesize(void);
+#endif
+
+
+#endif /* _SQUID_WIN32_ */
+#endif /* SQUID_OS_MSWIN_H */
diff --git a/compat/os/next.h b/compat/os/next.h
new file mode 100644 (file)
index 0000000..5278f1c
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_NEXT_H
+#define SQUID_OS_NEXT_H
+
+#ifdef _SQUID_NEXT_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+/*
+ * Don't allow inclusion of malloc.h
+ */
+#if defined(HAVE_MALLOC_H)
+#undef HAVE_MALLOC_H
+#endif
+
+/*
+ * S_ISDIR() may not be defined on Next
+ */
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if !defined(S_ISDIR)
+#define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
+#endif
+
+/*
+ * WAS: lots of special wrappers labeled only 'protect NEXTSTEP'
+ * I'm assuming its an incomplete definition problem on that OS.
+ * Or a missing safety wrapper by the looks of the _SQUID_NETDB_H_
+ * 
+ * Anyway, this file is included before all general non-type headers.
+ * doing the include here for Next and undefining HAVE_NETDB_H will
+ * save us from including it again in general.
+ */
+// All the hacks included this first without safety wrapping, then netdb.h.
+#include <netinet/in_systm.h>
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#undef HAVE_NETDB_H
+#define HAVE_NETDB_H 0
+
+
+#endif /* _SQUID_NEXT_ */
+#endif /* SQUID_OS_NEXT_H */
diff --git a/compat/os/openbsd.h b/compat/os/openbsd.h
new file mode 100644 (file)
index 0000000..eae2cdf
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_OPENBSD_H
+#define SQUID_OS_OPENBSD_H
+
+#ifdef _SQUID_OPENBSD_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * Don't allow inclusion of malloc.h
+ */
+#ifdef HAVE_MALLOC_H
+#undef HAVE_MALLOC_H
+#endif
+
+
+#endif /* _SQUID_OPENBSD_ */
+#endif /* SQUID_OS_OPENBSD_H */
diff --git a/compat/os/os2.h b/compat/os/os2.h
new file mode 100644 (file)
index 0000000..92f99f1
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_OS2_H
+#define SQUID_OS_OS2_H
+
+#ifdef _SQUID_OS2_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+*  FIXME: the os2 port of bash seems to have problems checking
+*  the return codes of programs in if statements.  These options
+*  need to be overridden.
+*/
+
+
+#endif /* _SQUID_OS2_ */
+#endif /* SQUID_OS_OS2_H */
diff --git a/compat/os/qnx.h b/compat/os/qnx.h
new file mode 100644 (file)
index 0000000..f1f4940
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_QNX_H
+#define SQUID_OS_QNX_H
+
+#ifdef _SQUID_QNX_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * Requires unix.h header file
+ */
+#include <unix.h>
+
+
+#endif /* _SQUID_QNX_ */
+#endif /* SQUID_OS_QNX_H */
diff --git a/compat/os/sgi.h b/compat/os/sgi.h
new file mode 100644 (file)
index 0000000..5fc9e67
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_SGI_H
+#define SQUID_OS_SGI_H
+
+#if _SQUID_SGI_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+#if !defined(_SVR4_SOURCE)
+#define _SVR4_SOURCE           /* for tempnam(3) */
+#endif
+
+#if USE_ASYNC_IO
+#define _ABI_SOURCE
+#endif /* USE_ASYNC_IO */
+
+
+#endif /* _SQUID_SGI_ */
+#endif /* SQUID_OS_SGI_H */
diff --git a/compat/os/solaris.h b/compat/os/solaris.h
new file mode 100644 (file)
index 0000000..40ffdb7
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_SOLARIS_H
+#define SQUID_OS_SOLARIS_H
+
+#ifdef _SQUID_SOLARIS_
+
+/*
+ * On Solaris 9 x86, gcc may includes a "fixed" set of old system
+ * include files that is incompatible with the updated Solaris
+ * header files.
+ */
+#if defined(i386) || defined(__i386)
+#ifndef HAVE_PAD128_T
+typedef union {
+       long double     _q;
+       int32_t         _l[4];
+} pad128_t;
+#endif
+#ifndef HAVE_UPAD128_T
+typedef union {
+       long double     _q;
+       uint32_t        _l[4];
+} upad128_t;
+#endif
+#endif
+
+/**
+ * prototypes for system function missing from system includes
+ */
+SQUIDCEXTERN int getrusage(int, struct rusage *);
+
+
+/**
+ * prototypes for system function missing from system includes
+ * on some Solaris systems.
+ */
+SQUIDCEXTERN int getpagesize(void);
+#if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
+        (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
+SQUIDCEXTERN int gethostname(char *, int);
+#endif
+
+
+
+#endif /* _SQUID_SOLARIS_ */
+#endif /* SQUID_OS_SOALRIS_H */
diff --git a/compat/os/sunos.h b/compat/os/sunos.h
new file mode 100644 (file)
index 0000000..25f891e
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_SUNOS_H
+#define SQUID_OS_SUNOS_H
+
+#ifdef _SQUID_SUNOS_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+
+/*
+ * We assume O_NONBLOCK is broken, or does not exist, on SunOS.
+ */
+#define SQUID_NONBLOCK O_NDELAY
+
+
+
+#endif /* _SQUID_SUNOS_ */
+#endif /* SQUID_OS_SUNOS_H */
diff --git a/compat/os/windows.h b/compat/os/windows.h
new file mode 100644 (file)
index 0000000..ad11de1
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * $Id$
+ *
+ * AUTHOR: Guido Serassio <serassio@squid-cache.org>
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  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.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_WINDOWS_H
+#define SQUID_OS_WINDOWS_H
+
+#ifdef _SQUID_WIN32_
+
+#ifndef ACL
+#define ACL WindowsACL
+#define _MSWIN_ACL_WAS_NOT_DEFINED 1
+#endif
+#include <windows.h>
+#if _MSWIN_ACL_WAS_NOT_DEFINED
+#undef ACL
+#undef _MSWIN_ACL_WAS_NOT_DEFINED
+#endif
+
+#endif /* _SQUID_WIN32_ */
+#endif /* SQUID_OS_WINDOWS_H */
diff --git a/compat/osdetect.h b/compat/osdetect.h
new file mode 100644 (file)
index 0000000..fb1eb9a
--- /dev/null
@@ -0,0 +1,87 @@
+#ifndef SQUID_COMPAT_OSDETECT_H
+#define SQUID_COMPAT_OSDETECT_H
+
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * Define the _SQUID_TYPE_ based on a guess of the OS.
+ *
+ * NP: This MUST come first in compat.h with no OS-specific includes
+ *     or other definitions within this if-else structure.
+ */
+
+#if defined(__sun__) || defined(__sun) /* SUN */
+# define _SQUID_SUN_
+# if defined(__SVR4)           /* SOLARIS */
+#  define _SQUID_SOLARIS_
+# else /* SUNOS */
+#  define _SQUID_SUNOS_
+# endif
+
+#elif defined(__hpux)          /* HP-UX - SysV-like? */
+#define _SQUID_HPUX_
+#define _SQUID_SYSV_
+
+#elif defined(__osf__)         /* OSF/1 */
+#define _SQUID_OSF_
+
+#elif defined(__ultrix)                /* Ultrix */
+#define _SQUID_ULTRIX_
+
+#elif defined(_AIX)            /* AIX */
+#define _SQUID_AIX_
+
+#elif defined(__linux__)       /* Linux */
+#define _SQUID_LINUX_
+
+#elif defined(__FreeBSD__)     /* FreeBSD */
+#define _SQUID_FREEBSD_
+
+#elif defined(__sgi__) || defined(sgi) || defined(__sgi)       /* SGI */
+#define _SQUID_SGI_
+
+#elif defined(__NeXT__)
+#define _SQUID_NEXT_
+
+#elif defined(__bsdi__)
+#define _SQUID_BSDI_           /* BSD/OS */
+
+#elif defined(__NetBSD__)
+#define _SQUID_NETBSD_
+
+#elif defined(__OpenBSD__)
+#define _SQUID_OPENBSD_
+
+#elif defined(__DragonFly__)
+#define _SQUID_DRAGONFLY_
+
+#elif defined(__CYGWIN32__)  || defined(__CYGWIN__)
+#define _SQUID_CYGWIN_
+#define _SQUID_WIN32_
+
+#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
+#define _SQUID_MSWIN_
+#define _SQUID_WIN32_
+
+#elif defined(__APPLE__)
+#define _SQUID_APPLE_
+
+#elif defined(sony_news) && defined(__svr4)
+#define _SQUID_NEWSOS6_
+
+#elif defined(__QNX__)
+#define _SQUID_QNX_
+
+#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
+#define _SQUID_OS2_
+
+#endif /* OS automatic detection */
+
+
+
+#endif /* SQUID_COMPAT_OSDETECT_H */
diff --git a/compat/stdvarargs.h b/compat/stdvarargs.h
new file mode 100644 (file)
index 0000000..c38a2cf
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_STDVARARGS_H
+#define _SQUID_STDVARARGS_H
+
+/*
+ * va_* variables come from various places on different platforms.
+ * We provide a clean set of wrappers for the variosu operations
+ * Depending on what is available and needed.
+ */
+#if defined(HAVE_STDARG_H)
+#include <stdarg.h>
+#define HAVE_STDARGS            /* let's hope that works everywhere (mj) */
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap, f)
+#define VA_SHIFT(v,t) ;         /* no-op for ANSI */
+#define VA_END va_end(ap)
+#else
+#if defined(HAVE_VARARGS_H)
+#include <varargs.h>
+#undef HAVE_STDARGS
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap)        /* f is ignored! */
+#define VA_SHIFT(v,t) v = va_arg(ap,t)
+#define VA_END va_end(ap)
+#else
+#error XX **NO VARARGS ** XX
+#endif
+#endif
+
+/* Make sure syslog goes after stdarg/varargs */
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#endif /* _SQUID_STDVARARGS_H */
diff --git a/compat/valgrind.h b/compat/valgrind.h
new file mode 100644 (file)
index 0000000..737ee8f
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_VALGRIND_H
+#define SQUID_VALGRIND_H
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * valgrind debug support
+ */
+#if WITH_VALGRIND
+# include <valgrind/memcheck.h>
+/* A little glue for older valgrind version prior to 3.2.0 */
+# ifndef VALGRIND_MAKE_MEM_NOACCESS
+#  define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
+#  define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
+#  define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
+#  define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
+# else
+#  undef VALGRIND_MAKE_NOACCESS
+#  undef VALGRIND_MAKE_WRITABLE
+#  undef VALGRIND_MAKE_READABLE
+# endif
+#else
+# define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
+# define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
+# define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
+# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
+# define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
+# define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
+# define VALGRIND_FREELIKE_BLOCK(a,b)
+# define RUNNING_ON_VALGRIND 0
+#endif /* WITH_VALGRIND */
+
+#endif /* SQUID_CONFIG_H */
index c8880c6b45746f3116493259e5373ab2d58063b7..9ae59e02f00fe9043dc3f96a2880c6fc6ffe3db3 100644 (file)
@@ -84,7 +84,7 @@ AC_PROG_RANLIB
 
 CRYPTLIB=''
 REGEXLIB=''    # -lregex
-LIBREGEX=''    # libregex.a
+# LIBREGEX=''  # libregex.a
 
 dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
 AC_EXEEXT
@@ -281,15 +281,6 @@ if test -z "$PRESET_LDFLAGS"; then
     fi
 fi
 
-AC_ARG_ENABLE(gnuregex,
-  AC_HELP_STRING([--enable-gnuregex],
-                 [Compile GNUregex.  Unless you have reason to use 
-                 this option, you should not enable it.
-                 This library file is usually only required on Windows and 
-                 very old Unix boxes which do not have their own regex 
-                 library built in.]),
-[USE_GNUREGEX=$enableval])
-
 SquidInline="yes"
 
 AC_ARG_ENABLE(optimizations,
@@ -3199,6 +3190,14 @@ if test "$LINUX_TPROXY2" ; then
     fi
 fi
 
+AC_ARG_ENABLE(gnuregex,
+  AC_HELP_STRING([--enable-gnuregex],
+                 [Compile GNUregex.  Unless you have reason to use 
+                 this option, you should not enable it.
+                 This library file is usually only required on Windows and 
+                 very old Unix boxes which do not have their own regex 
+                 library built in.]),
+[USE_GNUREGEX=$enableval])
 if test -z "$USE_GNUREGEX" ; then
     case "$host" in
     *-sun-solaris2.[[0-4]])
@@ -3222,12 +3221,12 @@ fi
 fi
 AC_MSG_RESULT($USE_GNUREGEX)
 if test "$USE_GNUREGEX" = "yes"; then
-       REGEXLIB="-lregex"
-       LIBREGEX="libregex.a"
+       # override system regex with ours. Not good. But what was asked for.
+       REGEXLIB=""
        AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
 fi
 AC_SUBST(REGEXLIB)
-AC_SUBST(LIBREGEX)
+#AC_SUBST(LIBREGEX)
 
 dnl Not cached since people are likely to tune this
 AC_MSG_CHECKING(Default FD_SETSIZE value)
@@ -3788,6 +3787,7 @@ rm -f core
 
 AC_CONFIG_FILES([\
        Makefile \
+       compat/Makefile \
        lib/Makefile \
        scripts/Makefile \
        scripts/RunCache \
index 1f5679393061cca48b541c1478be3df52e662f16..5c5d19ab6770dc5a84fa6f0b4f009843c9c1d806 100644 (file)
@@ -11,5 +11,13 @@ man_MANS             = squid_ldap_auth.8
 EXTRA_DIST             = squid_ldap_auth.8
 squid_ldap_auth_SOURCES        = squid_ldap_auth.c
 
-LDADD = -L$(top_builddir)/lib -lmiscutil $(LIB_LDAP) $(LIB_LBER) $(XTRA_LIBS)
-INCLUDES      = -I$(top_srcdir)/include
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(LIB_LDAP) \
+       $(LIB_LBER) \
+       $(XTRA_LIBS)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
index e007fc621a02360628b403b9c1db916f3a1998a4..b08e3a725c71d4ef02a4a4564dabf0bab598feec 100644 (file)
@@ -28,9 +28,12 @@ EXTRA_DIST = \
 sysconf_DATA = \
        msntauth.conf.default
 
-LDADD = -L$(top_builddir)/lib -lmiscutil $(XTRA_LIBS)
+LDADD = -L$(top_builddir)/lib -lmiscutil $(XTRA_LIBS) $(top_builddir)/compat/libcompat.la
 
-INCLUDES      = -I$(top_srcdir)/include
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src
 
 confload.o: confload.c
        $(COMPILE) -DSYSCONFDIR=\"$(sysconfdir)\" -c $(srcdir)/confload.c -o $@
index fc7e8c706d822b78d73c693ba474e3c9e856d408..5d0cc2de7b0f472649879c9c6c86cfce1e23f300 100644 (file)
@@ -10,5 +10,14 @@ libexec_PROGRAMS     = ncsa_auth
 ncsa_auth_SOURCES      = ncsa_auth.c crypt_md5.c crypt_md5.h
 man_MANS               = ncsa_auth.8
 EXTRA_DIST             = ncsa_auth.8
-LDADD                  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS) $(SSLLIB)
-INCLUDES      = -I$(top_srcdir)/include
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS) \
+       $(SSLLIB)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src
index 4ffc5219f55237b9c51d9662d543aa248cc9c6dd..b33262002ec476f8173c35ebbbbb7c38ca0a2476 100644 (file)
@@ -6,9 +6,16 @@
 #  Uncomment and customize the following to suit your needs:
 #
 
-INCLUDES       = -I$(top_srcdir)/include
-
 man_MANS               = pam_auth.8
 EXTRA_DIST             = pam_auth.8
 libexec_PROGRAMS       = pam_auth
-LDADD                  = -L$(top_builddir)/lib -lmiscutil -lpam $(XTRA_LIBS)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       -lpam \
+       $(XTRA_LIBS)
index 428bc60b496e7eff86c99824fcfa63065c7a2f96..b2bed770e36defaf6d7afb738b4e8a55cceeecd7 100644 (file)
@@ -6,8 +6,16 @@
 #  Uncomment and customize the following to suit your needs:
 #
 
-INCLUDES       = -I$(top_srcdir)/include
-
 libexec_PROGRAMS       = sasl_auth
-LDADD                  = -L$(top_builddir)/lib -lmiscutil $(LIBSASL) $(XTRA_LIBS)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(LIBSASL) \
+       $(XTRA_LIBS)
+
 EXTRA_DIST             = squid_sasl_auth squid_sasl_auth.conf
index 97efe5fe722170b885e3a6e0ce12c29c116f6444..89eabe400c530a1be77a666031f640e23508369b 100644 (file)
@@ -22,6 +22,11 @@ libexec_PROGRAMS = smb_auth
 smb_auth_CFLAGS = -DSAMBAPREFIX=\"$(SAMBAPREFIX)\" -DHELPERSCRIPT=\"$(SMB_AUTH_HELPER_PATH)\"
 EXTRA_DIST = smb_auth.sh COPYING-2.0
 
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(XTRA_LIBS)
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
 
-INCLUDES       = -I$(top_srcdir)/include
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(XTRA_LIBS)
index 7f08bb8b35fdfa4dbe627e5c1daea9a303b3fda8..37b111ba2d81fb68cb83f0ef75f3fe71a357d2a7 100644 (file)
@@ -7,5 +7,13 @@
 
 libexec_PROGRAMS = yp_auth
 yp_auth_SOURCES        = yp_auth.c nis_support.h nis_support.c
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
-INCLUDES       = -I$(top_srcdir)/include
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS)
index d28550e461a125050ec653306ed044e6a0ddc94c..4685071f067c214a6b2265f612b0715e303ab962 100644 (file)
@@ -11,5 +11,13 @@ libexec_PROGRAMS = getpwname_auth
 
 getpwname_auth_SOURCES = getpwnam_auth.c 
 
-INCLUDES      = -I$(top_srcdir)/include
-LDADD = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS)
index ec4997a9f1fc090f046d768ccf9be72d5496b7e4..f404b7deb35037d8b52768e5f6f2fe45de6f863c 100644 (file)
@@ -11,9 +11,15 @@ libexec_PROGRAMS = mswin_auth
 
 mswin_auth_SOURCES = mswin_auth.c valid.c valid.h
 
-LDADD  = -L$(top_builddir)/lib -lnetapi32 -ladvapi32 -lsspwin32 \
-          -lmiscutil $(XTRA_LIBS)
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       -lnetapi32 -ladvapi32 -lsspwin32 \
+       $(XTRA_LIBS)
 
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
 EXTRA_DIST = readme.txt
index e543f60323ccb2620fab3ebca66dbc6d8c045911..73990f66e6e1ee97f95d32c7824d05ad45acaf69 100644 (file)
@@ -15,5 +15,12 @@ squid_radius_auth_SOURCES = \
                        radius-util.c \
                        radius-util.h
 
-LDADD                  = -L$(top_builddir)/lib -lmiscutil $(SSLLIB) $(XTRA_LIBS)
-INCLUDES               = -I$(top_srcdir)/include
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(SSLLIB) \
+       $(XTRA_LIBS)
index 679f800f348b7765f43f5d6551ddee94f1322bc5..5c3e095c1bfb4093fdb42bde63b16299a7d09212 100644 (file)
@@ -13,7 +13,18 @@ digest_edir_auth_SOURCES = digest_pw_auth.c \
        ldap_backend.h \
        edir_ldapext.c \
        edir_ldapext.h
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
 
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(LIB_LDAP) $(LIB_LBER) $(CRYPTLIB) $(XTRA_LIBS) $(SSLLIB)
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(LIB_LDAP) \
+       $(LIB_LBER) \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS) \
+       $(SSLLIB)
index 5d7c5f44b55d43d0c109abb01e43da9ed2ced936..a96bcbc7e0f1e68b411f32107d12eb76ead31c32 100644 (file)
@@ -11,7 +11,18 @@ digest_ldap_auth_SOURCES = digest_pw_auth.c \
        digest_common.h \
        ldap_backend.c \
        ldap_backend.h
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
 
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(LIB_LDAP) $(LIB_LBER) $(CRYPTLIB) $(XTRA_LIBS) $(SSLLIB)
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(LIB_LDAP) \
+       $(LIB_LBER) \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS) \
+       $(SSLLIB)
index 966063b7d62575c1bd21f3e12dd261e9cf3f731a..83ea6313352ce634a6e96a5dd2a4f2149000967e 100644 (file)
@@ -11,7 +11,16 @@ digest_pw_auth_SOURCES = digest_pw_auth.c \
        digest_common.h \
        text_backend.c \
        text_backend.h
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
 
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS) $(SSLLIB)
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS) \
+       $(SSLLIB)
index 81cfff95231f4cfedad2c8a7c1d5274059a563b8..870b3a163c47c444868213e9d70e082b8bd28c6f 100644 (file)
@@ -15,7 +15,6 @@ ip_user_check_SOURCES = \
        main.c \
        match.c
 
-
 EXTRA_DIST = \
        example.conf \
        example-deny_all_but.conf \
@@ -24,5 +23,13 @@ EXTRA_DIST = \
 
 # sysconf_DATA = 
 
-LDADD          = -L$(top_builddir)/lib -lmiscutil @XTRA_LIBS@
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       @XTRA_LIBS@
index 9f84b705be69ba0d7daec3c1aa308c9a98da2f37..ea6e25a1e8413625f478cb0920ef398641c3b3da 100644 (file)
@@ -11,5 +11,15 @@ man_MANS                     = squid_ldap_group.8
 EXTRA_DIST                     = squid_ldap_group.8
 squid_ldap_group_SOURCES       = squid_ldap_group.c
 
-LDADD          = -L$(top_builddir)/lib -lmiscutil $(LIB_LDAP) $(LIB_LBER) @XTRA_LIBS@
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(LIB_LDAP) \
+       $(LIB_LBER) \
+       @XTRA_LIBS@
index 666bd717efe594dd58da1e35a1922c9765e56914..049a00809084df1909bfac299c5e7a952643b598 100644 (file)
@@ -11,9 +11,16 @@ libexec_PROGRAMS = mswin_check_ad_group
 
 mswin_check_ad_group_SOURCES = mswin_check_ad_group.c mswin_check_ad_group.h
 
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include
 
-LDADD   = -L$(top_builddir)/lib -lmiscutil -lnetapi32 -ladvapi32 \
-          -lntdll $(XTRA_LIBS)
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       -lnetapi32 \
+       -ladvapi32 \
+       -lntdll \
+       $(XTRA_LIBS)
 
 EXTRA_DIST = readme.txt
index af2add15e5168ab7ec46867a5a635bc3ec0b8f39..414fc5833ce1a0f9280def95fdb444946b43b5db 100644 (file)
@@ -11,9 +11,17 @@ libexec_PROGRAMS = mswin_check_lm_group
 
 mswin_check_lm_group_SOURCES = win32_check_group.c win32_check_group.h
 
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
-LDADD   = -L$(top_builddir)/lib -lmiscutil -lnetapi32 -ladvapi32 \
-          -lntdll $(XTRA_LIBS)
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       -lnetapi32 \
+       -ladvapi32 \
+       -lntdll \
+       $(XTRA_LIBS)
 
 EXTRA_DIST = readme.txt
index 0c45b0a06f00c009a00b807d819e81d9d1a7aba8..9bc99ab18c7d8e1dee97a6569f53a81251f6fe5b 100644 (file)
@@ -11,6 +11,12 @@ man_MANS                     = squid_session.8
 EXTRA_DIST                     = squid_session.8
 squid_session_SOURCES          = squid_session.c
 
-LDADD = @LIB_DB@
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       @LIB_DB@
index 37efbddcc0323830cd74913a3b63a2cb4b4d7c1c..a5625eaf80778c1cf1f55655f7d17ce726494ba5 100644 (file)
@@ -11,5 +11,13 @@ man_MANS                     = squid_unix_group.8
 EXTRA_DIST                     = squid_unix_group.8
 squid_unix_group_SOURCES       = check_group.c
 
-LDADD          = -L$(top_builddir)/lib -lmiscutil @XTRA_LIBS@
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       @XTRA_LIBS@
index 2330b2af9dc3af96bea4f8c3654dc110a5c06667..0b0930858ee1109665f6762c23e6a1c7cb92aae9 100644 (file)
@@ -425,7 +425,7 @@ AC_ARG_WITH([squid],
 )
 
 eval ac_p_include=$includedir
-CPPFLAGS="$CPPFLAGS -I$ac_p_include -I../../../ -I../../../include/ -I$squid_dir/include -I$squid_dir/src "
+CPPFLAGS="$CPPFLAGS -I$ac_p_include -I../../../ -I../../../include/ -I$squid_dir/include -I$squid_dir/src -I$squid_dir"
 AC_CACHE_CHECK([for SQUID at '$squid_dir' ],ac_cv_have_squid,[
 AC_TRY_RUN([
 #include <config.h>
index 1c1272557f3a058a034568e79ebbb50c8cea1325..d62ac772ecd5b6e311f9126f5a1944dfd3dfcbea 100644 (file)
@@ -8,6 +8,15 @@
 
 libexec_PROGRAMS = fakeauth_auth
 fakeauth_auth_SOURCES  = fakeauth_auth.c ntlm.h
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
-LDADD  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS)
index a4062fa674c8d442c9f958ce517d9becd31dc48e..a757c5d9b6c3a38a8794dcb5892e1b0bcc11b3c5 100644 (file)
@@ -8,9 +8,18 @@ libexec_PROGRAMS = mswin_ntlm_auth
 
 mswin_ntlm_auth_SOURCES = libntlmssp.c ntlm_auth.c ntlm.h
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
-LDADD          = -L$(top_builddir)/lib -lntlmauth -lsspwin32 -lnetapi32 \
-                 -ladvapi32 -lmiscutil $(XTRA_LIBS)
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil -lntlmauth \
+       -lsspwin32 \
+       -lnetapi32 \
+       -ladvapi32 \
+       $(XTRA_LIBS)
 
 EXTRA_DIST = readme.txt
index 4f63f10f1e8f3101fbb3c9bb871df259b601d44e..b898adc5dbd21f87d46496d53d048426fbf5912e 100644 (file)
@@ -6,7 +6,18 @@ SUBDIRS = smbval
 
 libexec_PROGRAMS = ntlm_smb_lm_auth
 ntlm_smb_lm_auth_SOURCES = libntlmssp.c ntlm_smb_lm_auth.c ntlm_smb_lm_auth.h
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/ -I$(srcdir)/smbval
-LDADD          = smbval/libsmbvalid.a -L$(top_builddir)/lib -lntlmauth \
-                 -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src \
+       -I$(srcdir)/smbval
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lntlmauth -lmiscutil \
+       smbval/libsmbvalid.a \
+       $(CRYPTLIB) \
+       $(XTRA_LIBS)
index d783611d79d96e45cb6cb767a82fbdaa049544aa..bad9fc9c1d339fd58c2d5cdaef9bf71ad9705738 100644 (file)
@@ -1,9 +1,13 @@
 # makefile for smblib
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
 noinst_LIBRARIES = libsmbvalid.a
+
 libsmbvalid_a_SOURCES = valid.c session.c rfcnb-util.c rfcnb-io.c \
        smblib-util.c smblib.c smbencrypt.c smbdes.c md4.c byteorder.h \
        rfcnb-error.h  rfcnb-util.h  smbencrypt.h     smblib.h        valid.h \
index f687e4c206cf7fdf64d6ad26908feb8be10fd6a8..052545d92ed5bb97f6f930572bb67e13a8824e4e 100644 (file)
@@ -41,7 +41,7 @@
 #include "util.h"
 
 /* users of this template also need assert() */
-#include "assert.h"
+#include "compat/assert.h"
 
 /* iterator support */
 
index 95b773b9c88a74460396b3a5e2fae69dd472519c..4abd92dac66760db247c473b60bfad1a119503de 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include "config.h"
-#include "assert.h"
 #include "util.h"
 
 #include "memMeter.h"
index a267e258d1c3a9f4d7817c388dcccb97fc83a73d..76d18fc3bc8a84263bdf76d3cf1953755efb5d98 100644 (file)
  *--------------------------------------------------------------------------*
  ****************************************************************************/
 
+#include "compat/compat.h"
+
 #ifdef USE_POSIX_REGEX
 #ifndef USE_RE_SYNTAX
 #define USE_RE_SYNTAX  REG_EXTENDED    /* default Syntax */
 #endif
 #endif
 
-/* define the _SQUID_TYPE_ based on a guess of the OS */
-#if defined(__sun__) || defined(__sun) /* SUN */
-#define _SQUID_SUN_
-#if defined(__SVR4)            /* SOLARIS */
-#define _SQUID_SOLARIS_
-#else /* SUNOS */
-#define _SQUID_SUNOS_
-#endif
-
-#elif defined(__hpux)          /* HP-UX - SysV-like? */
-#define _SQUID_HPUX_
-#define _SQUID_SYSV_
-
-#elif defined(__osf__)         /* OSF/1 */
-#define _SQUID_OSF_
-
-#elif defined(__ultrix)                /* Ultrix */
-#define _SQUID_ULTRIX_
-
-#elif defined(_AIX)            /* AIX */
-#define _SQUID_AIX_
-
-#elif defined(__linux__)       /* Linux */
-#define _SQUID_LINUX_
-#if USE_ASYNC_IO
-#define _SQUID_LINUX_THREADS_
-#endif
-
-#elif defined(__FreeBSD__)     /* FreeBSD */
-#define _SQUID_FREEBSD_
-#if USE_ASYNC_IO && defined(LINUXTHREADS)
-#define _SQUID_LINUX_THREADS_
-#endif
-
-#elif defined(__sgi__) || defined(sgi) || defined(__sgi)       /* SGI */
-#define _SQUID_SGI_
-#if !defined(_SVR4_SOURCE)
-#define _SVR4_SOURCE           /* for tempnam(3) */
-#endif
-#if USE_ASYNC_IO
-#define _ABI_SOURCE
-#endif /* USE_ASYNC_IO */
-
-#elif defined(__NeXT__)
-#define _SQUID_NEXT_
-
-#elif defined(__bsdi__)
-#define _SQUID_BSDI_           /* BSD/OS */
-
-#elif defined(__NetBSD__)
-#define _SQUID_NETBSD_
-
-#elif defined(__OpenBSD__)
-#define _SQUID_OPENBSD_
-
-#elif defined(__DragonFly__)
-#define _SQUID_DRAGONFLY_
-
-#elif defined(__CYGWIN32__)  || defined(__CYGWIN__)
-#define _SQUID_CYGWIN_
-#define _SQUID_WIN32_
-
-#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
-#define _SQUID_MSWIN_
-#define _SQUID_WIN32_
-#include "squid_mswin.h"
-
-#elif defined(__APPLE__)
-#define _SQUID_APPLE_
-
-#elif defined(sony_news) && defined(__svr4)
-#define _SQUID_NEWSOS6_
-
-#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
-#define _SQUID_OS2_
-/*
-*  FIXME: the os2 port of bash seems to have problems checking
-*  the return codes of programs in if statements.  These options
-*  need to be overridden.
-*/
-#endif
-
-/* FD_SETSIZE must be redefined before including sys/types.h */
-
-/*
- * On some systems, FD_SETSIZE is set to something lower than the
- * actual number of files which can be opened.  IRIX is one case,
- * NetBSD is another.  So here we increase FD_SETSIZE to our
- * configure-discovered maximum *before* any system includes.
- */
-#define CHANGE_FD_SETSIZE 1
-
-/*
- * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
- * with glibc 2.2 (or later? remains to be seen). We do this by including
- * bits/types.h which defines __FD_SETSIZE first, then we redefine
- * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
- * directly, so this is a dirty hack!
- */
-#if defined(_SQUID_LINUX_)
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#include <features.h>
-#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
-#if SQUID_MAXFD > DEFAULT_FD_SETSIZE
-#include <bits/types.h>
-#undef __FD_SETSIZE
-#define __FD_SETSIZE SQUID_MAXFD
-#endif
-#endif
-#endif
-
-/*
- * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
- * to return EINVAL.
- * --Marian Durkovic <marian@svf.stuba.sk>
- * --Peter Wemm <peter@spinner.DIALix.COM>
- */
-#if defined(_SQUID_FREEBSD_)
-#include <osreldate.h>
-#if __FreeBSD_version < 220000
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-#endif
-
-/*
- * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
- * on Mac OS X Server.
- */
-#if defined(_SQUID_APPLE_)
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-
-/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
-#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
-#define FD_SETSIZE SQUID_MAXFD
-#endif
 
 /* Typedefs for missing entries on a system */
 
-#include "squid_types.h"
-
 /* int8_t */
 #ifndef HAVE_INT8_T
 #if HAVE_CHAR && SIZEOF_CHAR == 1
@@ -318,40 +179,6 @@ typedef int socklen_t;
 typedef long mtyp_t;
 #endif
 
-/*
- * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
- * that is incompatible with the updated Solaris header files.
- */
-#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
-#ifndef HAVE_PAD128_T
-typedef union {
-    long double        _q;
-    int32_t            _l[4];
-} pad128_t;
-#endif
-#ifndef HAVE_UPAD128_T
-typedef union {
-    long double        _q;
-    uint32_t   _l[4];
-} upad128_t;
-#endif
-#endif
-
-/*
- * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
- */
-#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
-#undef HAVE_MALLOC_H
-#endif
-
-/*
- * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
- */
-#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
-#define res_init  __res_init
-#define HAVE_RES_INIT  HAVE___RES_INIT
-#endif
-
 #if !defined(CACHEMGR_HOSTNAME)
 #define CACHEMGR_HOSTNAME ""
 #else
@@ -435,33 +262,6 @@ typedef union {
 #define LEAK_CHECK_MODE 1
 #endif
 
-/*
- * valgrind debug support
- */
-#if WITH_VALGRIND
-#include <valgrind/memcheck.h>
-/* A little glue for older valgrind version prior to 3.2.0 */
-#ifndef VALGRIND_MAKE_MEM_NOACCESS
-#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
-#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
-#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
-#else
-#undef VALGRIND_MAKE_NOACCESS
-#undef VALGRIND_MAKE_WRITABLE
-#undef VALGRIND_MAKE_READABLE
-#endif
-#else
-#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
-#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
-#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
-#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
-#define VALGRIND_FREELIKE_BLOCK(a,b)
-#define RUNNING_ON_VALGRIND 0
-#endif /* WITH_VALGRIND */
-
 
 /*
  * strnstr() is needed. The OS may not provide a working copy.
index 1723963b39735d6c3bca698df6786ecfe885ca37..46525be49c57ded4f831a1b3ec57817ea85118f5 100644 (file)
@@ -47,13 +47,12 @@ WIN32SRC=
 endif
 
 EXTRA_LIBRARIES = \
-       libregex.a \
        libsspwin32.a
 noinst_LIBRARIES = \
        libmiscutil.a \
        libntlmauth.a \
-       $(LIBSSPWIN32) \
-       @LIBREGEX@
+       $(LIBSSPWIN32)
+
 #
 # dirent.c, encrypt.c and getopt.c are needed for native Windows support.
 #
@@ -90,7 +89,6 @@ libmiscutil_a_SOURCES = \
        stub_memaccount.c \
        util.c \
        uudecode.c \
-       assert.c \
        xusleep.c \
        $(XPROF_STATS_SOURCE) \
        $(WIN32SRC)
@@ -99,8 +97,6 @@ libmiscutil_a_LIBADD = \
        libTrie/src/TrieNode.o \
        @LIBOBJS@
 # $(top_srcdir)/include/version.h should be a dependency
-libregex_a_SOURCES = \
-       GNUregex.c
 libntlmauth_a_SOURCES = \
        ntlmauth.c
 libntlmauth_a_LIBADD = \
@@ -108,7 +104,11 @@ libntlmauth_a_LIBADD = \
 libsspwin32_a_SOURCES = \
        sspwin32.c
 
-INCLUDES       = -I$(top_builddir)/include -I$(top_srcdir)/include @SQUID_CPPUNIT_INC@
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
+       @SQUID_CPPUNIT_INC@
 ##FIXME - set these in configure.in and reuse
 
 check_PROGRAMS= \
@@ -134,7 +134,7 @@ tests_testAll_SOURCES= \
        tests/testMain.cc \
        $(XPROF_STATS_SOURCE) \
        $(WIN32SRC) \
-       util.c assert.c
+       util.c
 
 tests_testAll_LDADD= @SQUID_CPPUNIT_LA@ @SQUID_CPPUNIT_LIBS@
 
index 074b9e83d849c5b6af5d115fda8beee0b197e9c0..5797646f9caf0fe183e155b769787b76be6565e2 100644 (file)
@@ -61,7 +61,6 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#include "assert.h"
 
 #include "util.h"
 
index b86226c51e8689720efc47081230be45992b76eb..30d2512aeaa3b15d24e8c143e54f7d09e623518c 100644 (file)
@@ -10,7 +10,11 @@ libsnmp_a_SOURCES  = asn1.c parse.c snmp_vars.c \
        mib.c snmp_api_error.c   \
        snmp_msg.c \
        snmp_pdu.c  snmplib_debug.c
-INCLUDES       = -I$(top_builddir)/include -I$(top_srcdir)/include
+
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include
 
 VERSION                = 3.4
 DEFS           = -DSQUID_SNMP=1
index 497f99577511b288672da0238276186888fdcfc9..38ce96511f8966960785bb752671a87aa0903d26 100644 (file)
@@ -33,8 +33,8 @@
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
-/* for assert() */
-#include "assert.h"
+#include "config.h"
+
 /* for xstrdup() */
 #include "util.h"
 /* for safe_free() */
index 0767983ff7d2602848339d44d90d71cf1dbdfbcf..d9b716308ea82811e7011e5ba45577f2fd577823 100644 (file)
@@ -3,6 +3,7 @@ AM_CXXFLAGS = @SQUID_CXXFLAGS@
 CLEANFILES =
 
 INCLUDES = \
+       -I$(top_srcdir) \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/include \
         -I$(top_srcdir)/src
index 58e4890189c1c8280d0ca4080713b0523d872c4a..e0e550929f5fb87c62a1a1264ca22c8b283e6adb 100644 (file)
@@ -210,9 +210,15 @@ EXTRA_LIBRARIES = libAIO.a libBlocking.a libDiskDaemon.a libDiskThreads.a
 noinst_LIBRARIES = @DISK_LIBS@
 noinst_LTLIBRARIES = libsquid.la libauth.la
 
-INCLUDES        = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include
-INCLUDES        += -I$(top_builddir)/lib -I$(top_srcdir)/lib
-INCLUDES       += @SQUID_CPPUNIT_INC@
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/src \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/lib/libTrie/include \
+       -I$(top_builddir)/lib \
+       -I$(top_srcdir)/lib \
+       @SQUID_CPPUNIT_INC@
 
 EXTRA_PROGRAMS = \
        DiskIO/DiskDaemon/diskd \
index f9f90b4a1d67be0a60a7178160a77137469580a6..66790f3d65d59a6e908cd299b3e05a31eb52e5c8 100644 (file)
@@ -32,7 +32,7 @@
  *
  */
 
-#include "assert.h"
+#include "config.h"
 #include <cstring>
 
 #ifdef HAVE_STDINT_H
index b848363dec960338d2e4e2673071e9c038b306b0..2dda02b1b2e212e0c9569dc17a9e6edbaaad77a7 100644 (file)
  */
 #include "config.h"
 
-#if 0
-#include "squid.h"
-#include "HttpRequest.h"
-#endif
-
 #include "ACL.h"
 #include "ACLChecklist.h"
 #include "ConfigParser.h"
 #include "dlink.h"
 /* for special-case PURGE test */
 #include "HttpRequestMethod.h"
-/* for Vector<> Instances */
-#include "assert.h"
 
 const char *AclMatchedName = NULL;
 
index 11a760b9c74937d128f58da5db325558d5ade692..dcb27e2b6e04c11004538f996c91f551090b6f6b 100644 (file)
@@ -3,6 +3,7 @@ AM_CXXFLAGS = @SQUID_CXXFLAGS@
 CLEANFILES =
 
 INCLUDES = \
+       -I$(top_srcdir) \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/include \
         -I$(top_srcdir)/src
index c1883e0b5e077c656443a6fb828a6072ab192bea..70749bc172a0844227e693a3bba9f3718618a87b 100644 (file)
@@ -15,7 +15,11 @@ libdigest_a_SOURCES  = digest/auth_digest.cc digest/auth_digest.h
 libntlm_a_SOURCES      = ntlm/auth_ntlm.cc ntlm/auth_ntlm.h
 libnegotiate_a_SOURCES = negotiate/auth_negotiate.cc negotiate/auth_negotiate.h negotiate/negotiateScheme.cc negotiate/negotiateScheme.h
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
        -I$(top_srcdir)/src
 
 check_PROGRAMS= testHeaders
index d3a991321ce0345ac1c39cbca966325f62f84c3f..0180906a27d2de97ea37de467bf79542f7e9c5d9 100644 (file)
@@ -47,7 +47,6 @@
 
 //#include "squid.h"
 #include "config.h"
-#include "assert.h"
 //#include "SquidTime.h"
 #include "cf_gen_defines.h"
 #include "util.h"
index d52aac9b905c09e3042e5328dc66fa8bfabcfac3..e9d1da4d22ec2804f26beaa2a213536dd5183868 100644 (file)
@@ -22,5 +22,9 @@ libeCAP_la_SOURCES = \
        \
        Registry.h
 
-INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
         -I$(top_srcdir)/src
index 91f3b946477b0b5cc87f4ea5c2a46e731865e202..5440e0008ba688e48fc5d58e54b5fbde3b1e39fd 100644 (file)
@@ -1,7 +1,6 @@
 #include "squid.h"
 #include <libecap/adapter/service.h>
 #include "TextException.h"
-#include "assert.h"
 #include "eCAP/ServiceRep.h"
 #include "eCAP/XactionRep.h"
 
index fa106cdf21346f18d567778b008f084c9e3dabcf..e1eb8216b9158c553a080d13bc98066ef21eaa56 100644 (file)
@@ -3,7 +3,6 @@
 #include <libecap/common/delay.h>
 #include <libecap/adapter/xaction.h>
 #include "TextException.h"
-#include "assert.h"
 #include "HttpRequest.h"
 #include "HttpReply.h"
 #include "eCAP/XactionRep.h"
index 67c87c799e90765d36b1dda07788f158a1116058..a5b20eefd072eaf89c140cb7f96e807c92c5b340 100644 (file)
@@ -28,7 +28,11 @@ EXTRA_DIST = \
        coss/StoreFScoss.h \
        ufs/StoreFSufs.h
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
        -I$(top_srcdir)/src
 
 check_PROGRAMS=testHeaders
index f1db789a59165c612788e427eab3a10071a9632f..2e679e9f4f2a4605c1f06b171e2401a6f2399554 100644 (file)
@@ -70,7 +70,6 @@ extern "C"
     extern const char *const version_string;   /* VERSION */
 //MOVED:versions.h:APP_FULLNAME    extern const char *const full_appname_string;       /* PACKAGE "/" VERSION */
     extern const char *const appname_string;   /* PACKAGE */
-    extern const char *const w_space;  /* " \t\n\r" */
     extern char const * visible_appname_string; /* NULL */
     extern const char *fdTypeStr[];
     extern const char *hier_strings[];
index dbdc3debd02318851ca1d3fe6d6e847fbb3d0e94..c2912c5ce4b8c66c3863ca1cbb3b0cd71c3d650b 100644 (file)
@@ -9,7 +9,13 @@ AM_CXXFLAGS = @SQUID_CXXFLAGS@
 DEFS = @DEFS@
 CLEANFILES = 
 
-INCLUDES = -I$(top_srcdir)/src @SQUID_CPPUNIT_INC@ -I$(top_srcdir)/include -I$(top_builddir)/lib
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/src \
+       -I$(top_srcdir)/include \
+       -I$(top_builddir)/lib \
+       @SQUID_CPPUNIT_INC@
+
 $(OBJS): $(top_srcdir)/include/version.h $(top_srcdir)/include/autoconf.h
 
 # TODO: get rid of this when config filename is no longer a global constant.
index 75454553832dcf2ad27e19c6f4f4fce363754e6a..e0692bfd24ea27edb9afcdf9cee71cc024cd9981 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef SQUID_SRC_TEST_URL_H
 #define SQUID_SRC_TEST_URL_H
 
-#include <cppunit/extensions/HelperMacros.h>
-
 #include "Icmp.h"
+#include <cppunit/extensions/HelperMacros.h>
 
 #if USE_ICMP
 
index e36db69f4b9897d9598344359add5546e7559b4f..4961985eab4d137532aa1979d8519d2a0f541ff6 100644 (file)
@@ -9,7 +9,13 @@ AM_CXXFLAGS = @SQUID_CXXFLAGS@
 DEFS = @DEFS@
 CLEANFILES = 
 
-INCLUDES = -I$(top_srcdir)/src @SQUID_CPPUNIT_INC@ -I$(top_srcdir)/include -I$(top_builddir)/lib
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -I$(top_builddir)/lib \
+       -I$(top_srcdir)/src \
+       @SQUID_CPPUNIT_INC@ 
+
 $(OBJS): $(top_srcdir)/include/version.h $(top_srcdir)/include/autoconf.h
 
 
@@ -46,6 +52,7 @@ testIpAddress_SOURCES= \
 nodist_testIpAddress_SOURCES= \
        ../tests/testMain.cc
 testIpAddress_LDADD= \
+       $(top_builddir)/compat/libcompat.la \
        libip.la \
        -L$(top_builddir)/lib -lmiscutil \
        @SQUID_CPPUNIT_LA@ \
index 46fa4560e0460407e9109553c150221f239b2a52..22a6bb6e654e16030963a98baf2acdcf5b9aa857 100644 (file)
@@ -16,7 +16,11 @@ noinst_LIBRARIES = @REPL_LIBS@
 liblru_a_SOURCES = lru/store_repl_lru.cc
 libheap_a_SOURCES = heap/store_heap_replacement.h heap/store_heap_replacement.cc heap/store_repl_heap.cc
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
        -I$(top_srcdir)/src
 
 check_PROGRAMS= testHeaders
index ea015a78390271b0ab43f00923fa7acc13350fa0..308d3598f02e0c05ab3b20fa350a8f565f6ee228 100644 (file)
 #ifndef SQUID_H
 #define SQUID_H
 
-/*
- * On linux this must be defined to get PRId64 and friends
- */
-#define __STDC_FORMAT_MACROS
-
 #include "config.h"
 
 #ifdef _SQUID_MSWIN_
@@ -45,8 +40,6 @@ using namespace Squid;
 /** \endcond */
 #endif
 
-#include "assert.h"
-
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -191,26 +184,6 @@ using namespace Squid;
 #endif /* HAVE_POLL_H */
 #endif /* USE_POLL */
 
-/*
- * Filedescriptor limits in the different select loops
- *
- * NP: FreeBSD 7 defines FD_SETSIZE as unsigned but Squid needs
- *     it to be signed to compare it with signed values.
- *     Linux and others including FreeBSD <7, define it as signed.
- *     If this causes any issues please contact squid-dev@squid-cache.org
- */
-#if defined(USE_SELECT) || defined(USE_SELECT_WIN32)
-/* Limited by design */
-# define SQUID_MAXFD_LIMIT ((signed int)FD_SETSIZE)
-#elif defined(USE_POLL)
-/* Limited due to delay pools */
-# define SQUID_MAXFD_LIMIT ((signed int)FD_SETSIZE)
-#elif defined(USE_KQUEUE) || defined(USE_EPOLL)
-# define SQUID_FDSET_NOUSE 1
-#else
-# error Unknown select loop model!
-#endif
-
 
 /*
  * Trap unintentional use of fd_set. Must not be used outside the
@@ -224,35 +197,6 @@ using namespace Squid;
 # endif
 #endif
 
-#if defined(HAVE_STDARG_H)
-#include <stdarg.h>
-#define HAVE_STDARGS           /* let's hope that works everywhere (mj) */
-#define VA_LOCAL_DECL va_list ap;
-#define VA_START(f) va_start(ap, f)
-#define VA_SHIFT(v,t) ;                /* no-op for ANSI */
-#define VA_END va_end(ap)
-#else
-#if defined(HAVE_VARARGS_H)
-#include <varargs.h>
-#undef HAVE_STDARGS
-#define VA_LOCAL_DECL va_list ap;
-#define VA_START(f) va_start(ap)       /* f is ignored! */
-#define VA_SHIFT(v,t) v = va_arg(ap,t)
-#define VA_END va_end(ap)
-#else
-#error XX **NO VARARGS ** XX
-#endif
-#endif
-
-/* Make sure syslog goes after stdarg/varargs */
-#ifdef HAVE_SYSLOG_H
-#ifdef _SQUID_AIX_
-#define _XOPEN_EXTENDED_SOURCE
-#define _XOPEN_SOURCE_EXTENDED 1
-#endif
-#include <syslog.h>
-#endif
-
 #if HAVE_MATH_H
 #include <math.h>
 #endif
@@ -266,13 +210,6 @@ using namespace Squid;
 #define MAXPATHLEN SQUID_MAXPATHLEN
 #endif
 
-#if !HAVE_GETRUSAGE
-#if defined(_SQUID_HPUX_)
-#define HAVE_GETRUSAGE 1
-#define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
-#endif
-#endif
-
 #if !HAVE_STRUCT_RUSAGE
 /*
  * If we don't have getrusage() then we create a fake structure
@@ -329,20 +266,6 @@ SQUIDCEXTERN size_t getpagesize(void);
 #define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
 #endif
 
-#ifdef USE_GNUREGEX
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include "GNUregex.h"
-#ifdef __cplusplus
-}
-
-#endif
-#elif HAVE_REGEX_H
-#include <regex.h>
-#endif
-
 #include "md5.h"
 
 #if USE_SSL
@@ -392,36 +315,6 @@ extern "C"
 #include "initgroups.h"
 #endif
 
-#ifndef min
-
-template<class A>
-inline A const &
-min(A const & lhs, A const & rhs)
-{
-    if (rhs < lhs)
-        return rhs;
-
-    return lhs;
-}
-
-#endif
-
-#define XMIN(x,y) (min (x,y))
-#ifndef max
-template<class A>
-inline A const &
-max(A const & lhs, A const & rhs)
-{
-    if (rhs > lhs)
-        return rhs;
-
-    return lhs;
-}
-
-#endif
-
-#define XMAX(a,b) (max (a,b))
-
 #include "structs.h"
 #include "protos.h"
 #include "globals.h"
index 2d1780845de222dfc0886a0774a0d19ed4c9c497..e9f5ddc85470975fbdca22d824765fc794002b19 100644 (file)
@@ -9,9 +9,21 @@ AUTOMAKE_OPTIONS = subdir-objects
 AM_CFLAGS = @SQUID_CFLAGS@
 AM_CXXFLAGS = @SQUID_CXXFLAGS@
 
-INCLUDES        = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src
+
+LDADD = \
+       $(top_builddir)/compat/libcompat.la \
+       -L$(top_builddir)/lib -lmiscutil \
+       $(top_builddir)/src/globals.o \
+       $(top_builddir)/src/time.o
 
 EXTRA_PROGRAMS = mem_node_test membanger splay tcp-banger2 rfc1738
+
 EXTRA_DIST = testheaders.sh
 
 ESI_ALL_TESTS = \
@@ -50,7 +62,6 @@ check_PROGRAMS= debug \
                VirtualDeleteOperator
 
 
-LDADD =$(top_builddir)/src/globals.o $(top_builddir)/src/time.o -L$(top_builddir)/lib -lmiscutil
 tcp_banger2_LDADD = -L$(top_builddir)/lib -lmiscutil
 DEBUG_SOURCE = test_tools.cc
 debug_SOURCES = debug.cc $(DEBUG_SOURCE)
index c05a9f69afa540c40b0bca86277c7bd91035ccda..9b8dda7cd17d7128787f475ab1ddf92293ec0bd1 100644 (file)
@@ -7,8 +7,15 @@
 
 AUTOMAKE_OPTIONS = subdir-objects
 
-INCLUDES        = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include -I$(top_srcdir)/src
-INCLUDES       += @SQUID_CPPUNIT_INC@
+INCLUDES = \
+       -I$(top_srcdir) \
+       -I. \
+       -I$(top_builddir)/include \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src \
+       @SQUID_CPPUNIT_INC@
+#      -I$(top_srcdir)/lib/libTrie/include
+#      -I$(srcdir)
 
 TESTS=$(check_PROGRAMS)
 #check_PROGRAMS= testHeaders
@@ -36,7 +43,11 @@ squidclient_SOURCES = squidclient.cc
 cachemgr__CGIEXT__SOURCES = cachemgr.cc
 cachemgr__CGIEXT__CXXFLAGS = -DDEFAULT_CACHEMGR_CONFIG=\"$(DEFAULT_CACHEMGR_CONFIG)\" $(AM_CXXFLAGS)
 
-LDADD = ../src/ip/libip.la -L../lib -lmiscutil $(XTRA_LIBS)
+LDADD = \
+       ../compat/libcompat.la \
+       ../src/ip/libip.la \
+       -L../lib -lmiscutil \
+       $(XTRA_LIBS)
 
 EXTRA_DIST = \
        cachemgr.conf
index 53a4333f514189d1fc56d3e029c8b8e612136945..211a29c899e1df53f98e3e0d0feb3a3329289643 100644 (file)
@@ -129,7 +129,6 @@ extern "C"
 }
 #endif
 
-#include "assert.h"
 #include "util.h"
 #include "ip/IpAddress.h"
 #include "getfullhostname.h"