From: Amos Jeffries Date: Sun, 8 Mar 2009 11:46:19 +0000 (+1300) Subject: Author: Alex Rousskov X-Git-Tag: SQUID_3_1_0_7~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85739b24aec38ac45f0cb039ba587c22425cd950;p=thirdparty%2Fsquid.git Author: Alex Rousskov SourceLayout: src/base, take 0 with tweaks Added src/base directory for fundamental, commonly-used code pieces that are not large enough to warrant their own directories. Currently base/ contains the beginning of AsyncCalls hierarchy, which may eventually get its own directory. Removed src/ip from the top-level SUBDIRS list. Made cf_gen compile without libip. Started building makefile includes, to be used in subdir makefiles: src/Common.am and src/TestHeaders.am. --- diff --git a/Makefile.am b/Makefile.am index 327b61c52e..b4e31975b5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 foreign 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 +SUBDIRS = compat lib @makesnmplib@ scripts 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/configure.in b/configure.in index 9ae59e02f0..facfc67345 100644 --- a/configure.in +++ b/configure.in @@ -3793,6 +3793,7 @@ AC_CONFIG_FILES([\ scripts/RunCache \ scripts/RunAccel \ src/Makefile \ + src/base/Makefile \ src/fs/Makefile \ src/repl/Makefile \ src/auth/Makefile \ diff --git a/src/AsyncJobCalls.h b/src/AsyncJobCalls.h index 306e538c33..0657d36720 100644 --- a/src/AsyncJobCalls.h +++ b/src/AsyncJobCalls.h @@ -6,7 +6,7 @@ #ifndef SQUID_ASYNCJOBCALLS_H #define SQUID_ASYNCJOBCALLS_H -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" /* * *MemFunT are member function (i.e., class method) wrappers. They store diff --git a/src/BodyPipe.h b/src/BodyPipe.h index 7ce016ef3a..bf00268b86 100644 --- a/src/BodyPipe.h +++ b/src/BodyPipe.h @@ -4,7 +4,7 @@ #include "MemBuf.h" #include "AsyncCall.h" -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" class BodyPipe; diff --git a/src/Common.am b/src/Common.am new file mode 100644 index 0000000000..084f108cca --- /dev/null +++ b/src/Common.am @@ -0,0 +1,25 @@ +## Settings common to many Squid Makefiles + +## This file should be included first in all src/subdir/Makefile.am +## so it must not contain stuff specific to or bad for some subdirectories. + +## TODO: make this set by configure? +AM_CFLAGS = @SQUID_CFLAGS@ +AM_CXXFLAGS = @SQUID_CXXFLAGS@ +DEFS = @DEFS@ + +## so that others can always use += for these variables +CLEANFILES = +check_PROGRAMS = +TESTS = + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/include \ + @SQUID_CPPUNIT_INC@ + +## make all compiled sources depend on generated files +## XXX: Do we really need this? Does auto-dependency tracking work? +$(OBJS): $(top_srcdir)/include/version.h $(top_builddir)/include/autoconf.h diff --git a/src/Makefile.am b/src/Makefile.am index e0e550929f..5765cde3f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,7 @@ LOADABLE_MODULES_SOURCES = \ TESTS=$(check_PROGRAMS) check_PROGRAMS= -SUBDIRS = fs repl auth icmp ip +SUBDIRS = base fs repl auth ip icmp if USE_ADAPTATION SUBDIRS += adaptation @@ -210,6 +210,13 @@ EXTRA_LIBRARIES = libAIO.a libBlocking.a libDiskDaemon.a libDiskThreads.a noinst_LIBRARIES = @DISK_LIBS@ noinst_LTLIBRARIES = libsquid.la libauth.la +# libraries used by many targets +COMMON_LIBS = \ + libsquid.la \ + libauth.la \ + base/libbase.la \ + ip/libip.la + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ @@ -247,18 +254,10 @@ libexec_PROGRAMS = \ @DISK_PROGRAMS@ \ $(UNLINKD) -cf_gen_SOURCES = \ - cf_gen.cc \ - defines.h \ - debug.cc \ - time.cc - -nodist_cf_gen_SOURCES = globals.cc +cf_gen_SOURCES = cf_gen.cc nodist_cf_gen_HEADER = cf_gen_defines.h cf_gen_LDADD= \ - libsquid.la \ - libauth.la \ - ip/libip.la \ + ../compat/libcompat.la \ -L../lib -lmiscutil \ @XTRA_LIBS@ \ @EPOLL_LIBS@ \ @@ -432,8 +431,6 @@ libsquid_la_SOURCES = \ CommCalls.h \ DescriptorSet.cc \ DescriptorSet.h \ - ICAP/AsyncJob.cc \ - ICAP/AsyncJob.h \ SquidConfig.cc \ TextException.cc \ TextException.h @@ -695,10 +692,8 @@ nodist_squid_SOURCES = \ string_arrays.c squid_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ -L../lib \ @XTRA_OBJS@ \ @DISK_LINKOBJS@ \ @@ -921,10 +916,8 @@ ufsdump_SOURCES = \ wordlist.cc \ $(WIN32_SOURCE) ufsdump_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @XTRA_OBJS@ \ @REPL_OBJS@ \ @STORE_OBJS@ \ @@ -968,7 +961,7 @@ sysconf_DATA = \ data_DATA = \ mib.txt -LDADD = libsquid.la libauth.la ip/libip.la -L../lib -lmiscutil @XTRA_LIBS@ @EPOLL_LIBS@ @MINGW_LIBS@ +LDADD = $(COMMON_LIBS) -L../lib -lmiscutil @XTRA_LIBS@ @EPOLL_LIBS@ @MINGW_LIBS@ EXTRA_DIST = \ cf_gen_defines \ @@ -1243,9 +1236,7 @@ nodist_tests_testAuth_SOURCES = \ $(TESTSOURCES) tests_testAuth_LDADD= \ - libsquid.la \ - libauth.la \ - ip/libip.la \ + $(COMMON_LIBS) \ @AUTH_LINKOBJS@ @AUTH_OBJS@ \ -L../lib -lmiscutil \ @REGEXLIB@ \ @@ -1317,9 +1308,7 @@ tests_testACLMaxUserIP_SOURCES= \ nodist_tests_testACLMaxUserIP_SOURCES= \ $(TESTSOURCES) tests_testACLMaxUserIP_LDADD= \ - libsquid.la \ - libauth.la \ - ip/libip.la \ + $(COMMON_LIBS) \ -L../lib -lmiscutil \ @REGEXLIB@ \ @SQUID_CPPUNIT_LIBS@ \ @@ -1482,10 +1471,8 @@ nodist_tests_testCacheManager_SOURCES = \ repl_modules.cc \ string_arrays.c tests_testCacheManager_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REPL_OBJS@ \ ${ADAPTATION_LIBS} \ @REGEXLIB@ \ @@ -1509,8 +1496,7 @@ tests_testDiskIO_SOURCES = \ nodist_tests_testDiskIO_SOURCES= \ $(SWAP_TEST_GEN_SOURCES) tests_testDiskIO_LDADD = \ - ip/libip.la \ - libsquid.la \ + $(COMMON_LIBS) \ @DISK_LIBS@ \ $(SWAP_TEST_LDADD) \ SquidConfig.o @@ -1660,10 +1646,8 @@ nodist_tests_testEvent_SOURCES = \ repl_modules.cc \ string_arrays.c tests_testEvent_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REPL_OBJS@ \ ${ADAPTATION_LIBS} \ @REGEXLIB@ \ @@ -1817,10 +1801,8 @@ nodist_tests_testEventLoop_SOURCES = \ repl_modules.cc \ string_arrays.c tests_testEventLoop_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REPL_OBJS@ \ ${ADAPTATION_LIBS} \ @REGEXLIB@ \ @@ -1969,10 +1951,8 @@ nodist_tests_test_http_range_SOURCES = \ repl_modules.cc \ string_arrays.c tests_test_http_range_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REPL_OBJS@ \ @STORE_OBJS@ \ ${ADAPTATION_LIBS} \ @@ -2127,10 +2107,8 @@ nodist_tests_testHttpRequest_SOURCES = \ repl_modules.cc \ string_arrays.c tests_testHttpRequest_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REPL_OBJS@ \ ${ADAPTATION_LIBS} \ @REGEXLIB@ \ @@ -2218,9 +2196,7 @@ nodist_tests_testStore_SOURCES= \ $(STORE_TEST_GEN_SOURCES) tests_testStore_LDADD= \ - libsquid.la \ - libauth.la \ - ip/libip.la \ + $(COMMON_LIBS) \ -L../lib -lmiscutil \ @REGEXLIB@ \ @SQUID_CPPUNIT_LIBS@ \ @@ -2242,8 +2218,7 @@ tests_testString_SOURCES = \ nodist_tests_testString_SOURCES = \ $(TESTSOURCES) tests_testString_LDADD = \ - libsquid.la \ - ip/libip.la \ + $(COMMON_LIBS) \ -L../lib -lmiscutil \ @REGEXLIB@ \ @SQUID_CPPUNIT_LIBS@ \ @@ -2288,7 +2263,6 @@ SWAP_TEST_GEN_SOURCES = \ $(DISKIO_GEN_SOURCE) SWAP_TEST_LDADD = \ - libauth.la \ @REGEXLIB@ \ @STORE_LINKOBJS@ \ @STORE_OBJS@ \ @@ -2314,8 +2288,7 @@ tests_testUfs_SOURCES = \ nodist_tests_testUfs_SOURCES = \ $(SWAP_TEST_GEN_SOURCES) tests_testUfs_LDADD = \ - libsquid.la \ - ip/libip.la \ + $(COMMON_LIBS) \ $(SWAP_TEST_LDADD) \ @SSLLIB@ tests_testUfs_LDFLAGS = $(LIBADD_DL) @@ -2492,10 +2465,8 @@ nodist_tests_testURL_SOURCES = \ repl_modules.cc \ string_arrays.c tests_testURL_LDADD = \ - libsquid.la \ - libauth.la \ + $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ - ip/libip.la \ @REGEXLIB@ \ @REPL_OBJS@ \ ${ADAPTATION_LIBS} \ diff --git a/src/Server.h b/src/Server.h index e7316965f6..ff8ef9e8de 100644 --- a/src/Server.h +++ b/src/Server.h @@ -37,7 +37,7 @@ #include "StoreIOBuffer.h" #include "forward.h" #include "BodyPipe.h" -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #include "CommCalls.h" #if USE_ADAPTATION diff --git a/src/TestHeaders.am b/src/TestHeaders.am new file mode 100644 index 0000000000..c3da20a3ce --- /dev/null +++ b/src/TestHeaders.am @@ -0,0 +1,12 @@ +## Test ./*.h files in a directory using test-suite/testheaders.sh + +## TODO: include in src/Common.am when all testHeaders users are the same. + +TESTS += testHeaders + +## .h dependency test script +## aborts build process on errors; XXX: even with "make -k" +testHeaders: $(srcdir)/*.h + $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)" || exit 1 + +.PHONY: testHeaders diff --git a/src/adaptation/AccessCheck.h b/src/adaptation/AccessCheck.h index 89e54045e2..0d384be582 100644 --- a/src/adaptation/AccessCheck.h +++ b/src/adaptation/AccessCheck.h @@ -1,7 +1,7 @@ #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H #define SQUID_ADAPTATION__ACCESS_CHECK_H -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #include "adaptation/Elements.h" #include "adaptation/forward.h" diff --git a/src/adaptation/Initiate.h b/src/adaptation/Initiate.h index a94c5889e6..eba205f7b8 100644 --- a/src/adaptation/Initiate.h +++ b/src/adaptation/Initiate.h @@ -2,7 +2,7 @@ #define SQUID_ADAPTATION__INITIATE_H #include "AsyncCall.h" -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #include "adaptation/forward.h" class HttpMsg; diff --git a/src/adaptation/Initiator.h b/src/adaptation/Initiator.h index 0d66074850..ba2a1254f1 100644 --- a/src/adaptation/Initiator.h +++ b/src/adaptation/Initiator.h @@ -1,7 +1,7 @@ #ifndef SQUID_ADAPTATION__INITIATOR_H #define SQUID_ADAPTATION__INITIATOR_H -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #include "adaptation/forward.h" /* diff --git a/src/ICAP/AsyncJob.cc b/src/base/AsyncJob.cc similarity index 100% rename from src/ICAP/AsyncJob.cc rename to src/base/AsyncJob.cc diff --git a/src/ICAP/AsyncJob.h b/src/base/AsyncJob.h similarity index 98% rename from src/ICAP/AsyncJob.h rename to src/base/AsyncJob.h index ee6ae45896..287f64e05d 100644 --- a/src/ICAP/AsyncJob.h +++ b/src/base/AsyncJob.h @@ -5,9 +5,6 @@ #ifndef SQUID_ASYNC_JOB_H #define SQUID_ASYNC_JOB_H -/// \todo move src/ICAP/AsyncJob.* to src/ - - #include "AsyncCall.h" #include "TextException.h" diff --git a/src/base/Makefile.am b/src/base/Makefile.am new file mode 100644 index 0000000000..93b11be3f0 --- /dev/null +++ b/src/base/Makefile.am @@ -0,0 +1,9 @@ + +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libbase.la + +libbase_la_SOURCES = \ + AsyncJob.h \ + AsyncJob.cc diff --git a/src/client_side.h b/src/client_side.h index 5bb37172a1..37ad29978e 100644 --- a/src/client_side.h +++ b/src/client_side.h @@ -37,7 +37,7 @@ #include "StoreIOBuffer.h" #include "BodyPipe.h" #include "RefCount.h" -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #include "CommCalls.h" class ConnStateData; diff --git a/src/client_side_request.h b/src/client_side_request.h index 7e7b9b94f8..0d1cd041c0 100644 --- a/src/client_side_request.h +++ b/src/client_side_request.h @@ -41,7 +41,7 @@ #include "client_side.h" #include "AccessLogEntry.h" #include "dlink.h" -#include "ICAP/AsyncJob.h" +#include "base/AsyncJob.h" #if USE_ADAPTATION #include "adaptation/forward.h"