From: Amos Jeffries Date: Tue, 3 Mar 2009 02:52:23 +0000 (+1300) Subject: SourceLayout: setup libcompat.la for portability primitives X-Git-Tag: SQUID_3_1_0_7~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1400e63864d2086969fd9281b451e5d3d828758;p=thirdparty%2Fsquid.git SourceLayout: setup libcompat.la for portability primitives 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. --- diff --git a/Makefile.am b/Makefile.am index f90fc200bb..327b61c52e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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)/'` diff --git a/lib/GNUregex.c b/compat/GnuRegex.c similarity index 99% rename from lib/GNUregex.c rename to compat/GnuRegex.c index 0091bf51bb..b5ba9eb6b5 100644 --- a/lib/GNUregex.c +++ b/compat/GnuRegex.c @@ -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] - /* 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 */ /* * Local variables: diff --git a/include/GNUregex.h b/compat/GnuRegex.h similarity index 97% rename from include/GNUregex.h rename to compat/GnuRegex.h index 65443fefbf..286e4ff6fb 100644 --- a/include/GNUregex.h +++ b/compat/GnuRegex.h @@ -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 must be included (by the caller) before + * . */ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_REGEX_H +#include +#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 */ /* diff --git a/compat/Makefile.am b/compat/Makefile.am new file mode 100644 index 0000000000..80ed9929a3 --- /dev/null +++ b/compat/Makefile.am @@ -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 diff --git a/lib/assert.c b/compat/assert.cc similarity index 94% rename from lib/assert.c rename to compat/assert.cc index 229dbd46c6..b1e06e3315 100644 --- a/lib/assert.c +++ b/compat/assert.cc @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -34,10 +33,16 @@ #include "config.h" +#if HAVE_STDIO_H #include +#endif +#if HAVE_STDLIB_H #include +#endif -#include "assert.h" +#if 0 +#include "compat/assert.h" +#endif void xassert(const char *expr, const char *file, int line) { diff --git a/include/assert.h b/compat/assert.h similarity index 91% rename from include/assert.h rename to compat/assert.h index 651bf7cb65..1bad0a026f 100644 --- a/include/assert.h +++ b/compat/assert.h @@ -30,10 +30,13 @@ * 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) @@ -42,6 +45,12 @@ #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 index 0000000000..e69de29bb2 diff --git a/compat/compat.h b/compat/compat.h new file mode 100644 index 0000000000..7f5dff032d --- /dev/null +++ b/compat/compat.h @@ -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 index 0000000000..a2bc9a4e9b --- /dev/null +++ b/compat/compat_shared.h @@ -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 +#endif +#if HAVE_SYS_RESOURCE_H +#include /* 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 +#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 +#endif /* HAVE_SYS_NDIR_H */ +#if HAVE_SYS_DIR_H +#include +#endif /* HAVE_SYS_DIR_H */ +#if HAVE_NDIR_H +#include +#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 +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 +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 +#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 index 0000000000..ad8ddf6b0c --- /dev/null +++ b/compat/fdsetsize.h @@ -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 +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) +#if SQUID_MAXFD > DEFAULT_FD_SETSIZE +#include +#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 + * --Peter Wemm + */ +#if defined(_SQUID_FREEBSD_) +#include +#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 index 0000000000..3286eb49a4 --- /dev/null +++ b/compat/os/aix.h @@ -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 index 0000000000..e7fa90448f --- /dev/null +++ b/compat/os/dragonfly.h @@ -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 index 0000000000..e4fb395942 --- /dev/null +++ b/compat/os/freebsd.h @@ -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 index 0000000000..993d14d4c4 --- /dev/null +++ b/compat/os/hpux.h @@ -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 index 0000000000..947de9870a --- /dev/null +++ b/compat/os/linux.h @@ -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 index 0000000000..fd0860c9fa --- /dev/null +++ b/compat/os/mswin.h @@ -0,0 +1,768 @@ +/* + * $Id$ + * + * AUTHOR: Andrey Shorin + * AUTHOR: Guido Serassio + * + * 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 +#include +#include +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#include +#endif +#include +#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 +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#pragma warning (pop) +#endif +#include +#include + +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 + +/* 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 index 0000000000..5278f1c375 --- /dev/null +++ b/compat/os/next.h @@ -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 +#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 +#if HAVE_NETDB_H +#include +#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 index 0000000000..eae2cdf003 --- /dev/null +++ b/compat/os/openbsd.h @@ -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 index 0000000000..92f99f1004 --- /dev/null +++ b/compat/os/os2.h @@ -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 index 0000000000..f1f49405b5 --- /dev/null +++ b/compat/os/qnx.h @@ -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 + + +#endif /* _SQUID_QNX_ */ +#endif /* SQUID_OS_QNX_H */ diff --git a/compat/os/sgi.h b/compat/os/sgi.h new file mode 100644 index 0000000000..5fc9e67ac3 --- /dev/null +++ b/compat/os/sgi.h @@ -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 index 0000000000..40ffdb7ce6 --- /dev/null +++ b/compat/os/solaris.h @@ -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 index 0000000000..25f891e5da --- /dev/null +++ b/compat/os/sunos.h @@ -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 index 0000000000..ad11de15c7 --- /dev/null +++ b/compat/os/windows.h @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * AUTHOR: Guido Serassio + * + * 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 +#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 index 0000000000..fb1eb9acad --- /dev/null +++ b/compat/osdetect.h @@ -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 index 0000000000..c38a2cf2c9 --- /dev/null +++ b/compat/stdvarargs.h @@ -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 +#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 +#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 +#endif + +#endif /* _SQUID_STDVARARGS_H */ diff --git a/compat/valgrind.h b/compat/valgrind.h new file mode 100644 index 0000000000..737ee8f128 --- /dev/null +++ b/compat/valgrind.h @@ -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 +/* 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 */ diff --git a/configure.in b/configure.in index c8880c6b45..9ae59e02f0 100644 --- a/configure.in +++ b/configure.in @@ -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 \ diff --git a/helpers/basic_auth/LDAP/Makefile.am b/helpers/basic_auth/LDAP/Makefile.am index 1f56793930..5c5d19ab67 100644 --- a/helpers/basic_auth/LDAP/Makefile.am +++ b/helpers/basic_auth/LDAP/Makefile.am @@ -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 diff --git a/helpers/basic_auth/MSNT/Makefile.am b/helpers/basic_auth/MSNT/Makefile.am index e007fc621a..b08e3a725c 100644 --- a/helpers/basic_auth/MSNT/Makefile.am +++ b/helpers/basic_auth/MSNT/Makefile.am @@ -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 $@ diff --git a/helpers/basic_auth/NCSA/Makefile.am b/helpers/basic_auth/NCSA/Makefile.am index fc7e8c706d..5d0cc2de7b 100644 --- a/helpers/basic_auth/NCSA/Makefile.am +++ b/helpers/basic_auth/NCSA/Makefile.am @@ -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 diff --git a/helpers/basic_auth/PAM/Makefile.am b/helpers/basic_auth/PAM/Makefile.am index 4ffc5219f5..b33262002e 100644 --- a/helpers/basic_auth/PAM/Makefile.am +++ b/helpers/basic_auth/PAM/Makefile.am @@ -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) diff --git a/helpers/basic_auth/SASL/Makefile.am b/helpers/basic_auth/SASL/Makefile.am index 428bc60b49..b2bed770e3 100644 --- a/helpers/basic_auth/SASL/Makefile.am +++ b/helpers/basic_auth/SASL/Makefile.am @@ -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 diff --git a/helpers/basic_auth/SMB/Makefile.am b/helpers/basic_auth/SMB/Makefile.am index 97efe5fe72..89eabe400c 100644 --- a/helpers/basic_auth/SMB/Makefile.am +++ b/helpers/basic_auth/SMB/Makefile.am @@ -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) diff --git a/helpers/basic_auth/YP/Makefile.am b/helpers/basic_auth/YP/Makefile.am index 7f08bb8b35..37b111ba2d 100644 --- a/helpers/basic_auth/YP/Makefile.am +++ b/helpers/basic_auth/YP/Makefile.am @@ -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) diff --git a/helpers/basic_auth/getpwnam/Makefile.am b/helpers/basic_auth/getpwnam/Makefile.am index d28550e461..4685071f06 100644 --- a/helpers/basic_auth/getpwnam/Makefile.am +++ b/helpers/basic_auth/getpwnam/Makefile.am @@ -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) diff --git a/helpers/basic_auth/mswin_sspi/Makefile.am b/helpers/basic_auth/mswin_sspi/Makefile.am index ec4997a9f1..f404b7deb3 100644 --- a/helpers/basic_auth/mswin_sspi/Makefile.am +++ b/helpers/basic_auth/mswin_sspi/Makefile.am @@ -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 diff --git a/helpers/basic_auth/squid_radius_auth/Makefile.am b/helpers/basic_auth/squid_radius_auth/Makefile.am index e543f60323..73990f66e6 100644 --- a/helpers/basic_auth/squid_radius_auth/Makefile.am +++ b/helpers/basic_auth/squid_radius_auth/Makefile.am @@ -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) diff --git a/helpers/digest_auth/eDirectory/Makefile.am b/helpers/digest_auth/eDirectory/Makefile.am index 679f800f34..5c3e095c1b 100644 --- a/helpers/digest_auth/eDirectory/Makefile.am +++ b/helpers/digest_auth/eDirectory/Makefile.am @@ -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) diff --git a/helpers/digest_auth/ldap/Makefile.am b/helpers/digest_auth/ldap/Makefile.am index 5d7c5f44b5..a96bcbc7e0 100644 --- a/helpers/digest_auth/ldap/Makefile.am +++ b/helpers/digest_auth/ldap/Makefile.am @@ -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) diff --git a/helpers/digest_auth/password/Makefile.am b/helpers/digest_auth/password/Makefile.am index 966063b7d6..83ea631335 100644 --- a/helpers/digest_auth/password/Makefile.am +++ b/helpers/digest_auth/password/Makefile.am @@ -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) diff --git a/helpers/external_acl/ip_user/Makefile.am b/helpers/external_acl/ip_user/Makefile.am index 81cfff9523..870b3a163c 100644 --- a/helpers/external_acl/ip_user/Makefile.am +++ b/helpers/external_acl/ip_user/Makefile.am @@ -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@ diff --git a/helpers/external_acl/ldap_group/Makefile.am b/helpers/external_acl/ldap_group/Makefile.am index 9f84b705be..ea6e25a1e8 100644 --- a/helpers/external_acl/ldap_group/Makefile.am +++ b/helpers/external_acl/ldap_group/Makefile.am @@ -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@ diff --git a/helpers/external_acl/mswin_ad_group/Makefile.am b/helpers/external_acl/mswin_ad_group/Makefile.am index 666bd717ef..049a008090 100644 --- a/helpers/external_acl/mswin_ad_group/Makefile.am +++ b/helpers/external_acl/mswin_ad_group/Makefile.am @@ -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 diff --git a/helpers/external_acl/mswin_lm_group/Makefile.am b/helpers/external_acl/mswin_lm_group/Makefile.am index af2add15e5..414fc5833c 100644 --- a/helpers/external_acl/mswin_lm_group/Makefile.am +++ b/helpers/external_acl/mswin_lm_group/Makefile.am @@ -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 diff --git a/helpers/external_acl/session/Makefile.am b/helpers/external_acl/session/Makefile.am index 0c45b0a06f..9bc99ab18c 100644 --- a/helpers/external_acl/session/Makefile.am +++ b/helpers/external_acl/session/Makefile.am @@ -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@ diff --git a/helpers/external_acl/unix_group/Makefile.am b/helpers/external_acl/unix_group/Makefile.am index 37efbddcc0..a5625eaf80 100644 --- a/helpers/external_acl/unix_group/Makefile.am +++ b/helpers/external_acl/unix_group/Makefile.am @@ -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@ diff --git a/helpers/negotiate_auth/squid_kerb_auth/configure.in b/helpers/negotiate_auth/squid_kerb_auth/configure.in index 2330b2af9d..0b0930858e 100644 --- a/helpers/negotiate_auth/squid_kerb_auth/configure.in +++ b/helpers/negotiate_auth/squid_kerb_auth/configure.in @@ -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 diff --git a/helpers/ntlm_auth/fakeauth/Makefile.am b/helpers/ntlm_auth/fakeauth/Makefile.am index 1c1272557f..d62ac772ec 100644 --- a/helpers/ntlm_auth/fakeauth/Makefile.am +++ b/helpers/ntlm_auth/fakeauth/Makefile.am @@ -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) diff --git a/helpers/ntlm_auth/mswin_sspi/Makefile.am b/helpers/ntlm_auth/mswin_sspi/Makefile.am index a4062fa674..a757c5d9b6 100644 --- a/helpers/ntlm_auth/mswin_sspi/Makefile.am +++ b/helpers/ntlm_auth/mswin_sspi/Makefile.am @@ -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 diff --git a/helpers/ntlm_auth/smb_lm/Makefile.am b/helpers/ntlm_auth/smb_lm/Makefile.am index 4f63f10f1e..b898adc5db 100644 --- a/helpers/ntlm_auth/smb_lm/Makefile.am +++ b/helpers/ntlm_auth/smb_lm/Makefile.am @@ -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) diff --git a/helpers/ntlm_auth/smb_lm/smbval/Makefile.am b/helpers/ntlm_auth/smb_lm/smbval/Makefile.am index d783611d79..bad9fc9c1d 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/Makefile.am +++ b/helpers/ntlm_auth/smb_lm/smbval/Makefile.am @@ -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 \ diff --git a/include/Array.h b/include/Array.h index f687e4c206..052545d92e 100644 --- a/include/Array.h +++ b/include/Array.h @@ -41,7 +41,7 @@ #include "util.h" /* users of this template also need assert() */ -#include "assert.h" +#include "compat/assert.h" /* iterator support */ diff --git a/include/MemPool.h b/include/MemPool.h index 95b773b9c8..4abd92dac6 100644 --- a/include/MemPool.h +++ b/include/MemPool.h @@ -21,7 +21,6 @@ */ #include "config.h" -#include "assert.h" #include "util.h" #include "memMeter.h" diff --git a/include/config.h b/include/config.h index a267e258d1..76d18fc3bc 100644 --- a/include/config.h +++ b/include/config.h @@ -55,156 +55,17 @@ *--------------------------------------------------------------------------* ****************************************************************************/ +#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 -#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) -#if SQUID_MAXFD > DEFAULT_FD_SETSIZE -#include -#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 - * --Peter Wemm - */ -#if defined(_SQUID_FREEBSD_) -#include -#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 -/* 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. diff --git a/lib/Makefile.am b/lib/Makefile.am index 1723963b39..46525be49c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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@ diff --git a/lib/rfc1123.c b/lib/rfc1123.c index 074b9e83d8..5797646f9c 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -61,7 +61,6 @@ #if HAVE_SYS_TIME_H #include #endif -#include "assert.h" #include "util.h" diff --git a/snmplib/Makefile.am b/snmplib/Makefile.am index b86226c51e..30d2512aea 100644 --- a/snmplib/Makefile.am +++ b/snmplib/Makefile.am @@ -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 diff --git a/src/AuthUser.cci b/src/AuthUser.cci index 497f995775..38ce96511f 100644 --- a/src/AuthUser.cci +++ b/src/AuthUser.cci @@ -33,8 +33,8 @@ * Copyright (c) 2003, Robert Collins */ -/* for assert() */ -#include "assert.h" +#include "config.h" + /* for xstrdup() */ #include "util.h" /* for safe_free() */ diff --git a/src/ICAP/Makefile.am b/src/ICAP/Makefile.am index 0767983ff7..d9b716308e 100644 --- a/src/ICAP/Makefile.am +++ b/src/ICAP/Makefile.am @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 58e4890189..e0e550929f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/String.cci b/src/String.cci index f9f90b4a1d..66790f3d65 100644 --- a/src/String.cci +++ b/src/String.cci @@ -32,7 +32,7 @@ * */ -#include "assert.h" +#include "config.h" #include #ifdef HAVE_STDINT_H diff --git a/src/acl.cc b/src/acl.cc index b848363dec..2dda02b1b2 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -33,19 +33,12 @@ */ #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; diff --git a/src/adaptation/Makefile.am b/src/adaptation/Makefile.am index 11a760b9c7..dcb27e2b6e 100644 --- a/src/adaptation/Makefile.am +++ b/src/adaptation/Makefile.am @@ -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 diff --git a/src/auth/Makefile.am b/src/auth/Makefile.am index c1883e0b5e..70749bc172 100644 --- a/src/auth/Makefile.am +++ b/src/auth/Makefile.am @@ -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 diff --git a/src/cf_gen.cc b/src/cf_gen.cc index d3a991321c..0180906a27 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -47,7 +47,6 @@ //#include "squid.h" #include "config.h" -#include "assert.h" //#include "SquidTime.h" #include "cf_gen_defines.h" #include "util.h" diff --git a/src/eCAP/Makefile.am b/src/eCAP/Makefile.am index d52aac9b90..e9d1da4d22 100644 --- a/src/eCAP/Makefile.am +++ b/src/eCAP/Makefile.am @@ -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 diff --git a/src/eCAP/ServiceRep.cc b/src/eCAP/ServiceRep.cc index 91f3b94647..5440e0008b 100644 --- a/src/eCAP/ServiceRep.cc +++ b/src/eCAP/ServiceRep.cc @@ -1,7 +1,6 @@ #include "squid.h" #include #include "TextException.h" -#include "assert.h" #include "eCAP/ServiceRep.h" #include "eCAP/XactionRep.h" diff --git a/src/eCAP/XactionRep.cc b/src/eCAP/XactionRep.cc index fa106cdf21..e1eb8216b9 100644 --- a/src/eCAP/XactionRep.cc +++ b/src/eCAP/XactionRep.cc @@ -3,7 +3,6 @@ #include #include #include "TextException.h" -#include "assert.h" #include "HttpRequest.h" #include "HttpReply.h" #include "eCAP/XactionRep.h" diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 67c87c799e..a5b20eefd0 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -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 diff --git a/src/globals.h b/src/globals.h index f1db789a59..2e679e9f4f 100644 --- a/src/globals.h +++ b/src/globals.h @@ -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[]; diff --git a/src/icmp/Makefile.am b/src/icmp/Makefile.am index dbdc3debd0..c2912c5ce4 100644 --- a/src/icmp/Makefile.am +++ b/src/icmp/Makefile.am @@ -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. diff --git a/src/icmp/testIcmp.h b/src/icmp/testIcmp.h index 7545455383..e0692bfd24 100644 --- a/src/icmp/testIcmp.h +++ b/src/icmp/testIcmp.h @@ -1,9 +1,8 @@ #ifndef SQUID_SRC_TEST_URL_H #define SQUID_SRC_TEST_URL_H -#include - #include "Icmp.h" +#include #if USE_ICMP diff --git a/src/ip/Makefile.am b/src/ip/Makefile.am index e36db69f4b..4961985eab 100644 --- a/src/ip/Makefile.am +++ b/src/ip/Makefile.am @@ -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@ \ diff --git a/src/repl/Makefile.am b/src/repl/Makefile.am index 46fa4560e0..22a6bb6e65 100644 --- a/src/repl/Makefile.am +++ b/src/repl/Makefile.am @@ -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 diff --git a/src/squid.h b/src/squid.h index ea015a7839..308d3598f0 100644 --- a/src/squid.h +++ b/src/squid.h @@ -32,11 +32,6 @@ #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 #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 -#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 -#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 -#endif - #if HAVE_MATH_H #include #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 -#endif - #include "md5.h" #if USE_SSL @@ -392,36 +315,6 @@ extern "C" #include "initgroups.h" #endif -#ifndef min - -template -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 -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" diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index 2d1780845d..e9f5ddc854 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -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) diff --git a/tools/Makefile.am b/tools/Makefile.am index c05a9f69af..9b8dda7cd1 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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 diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 53a4333f51..211a29c899 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -129,7 +129,6 @@ extern "C" } #endif -#include "assert.h" #include "util.h" #include "ip/IpAddress.h" #include "getfullhostname.h"