From: wessels <> Date: Tue, 9 Apr 1996 05:25:17 +0000 (+0000) Subject: configure confusion; try to use $sysconfdir, etc now X-Git-Tag: SQUID_3_0_PRE1~6258 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a26bdc752ceea2150d3337209e2eb16ba841bf82;p=thirdparty%2Fsquid.git configure confusion; try to use $sysconfdir, etc now --- diff --git a/configure b/configure index b8d45c758f..7314f7b78b 100755 --- a/configure +++ b/configure @@ -446,7 +446,7 @@ echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=include/config.h +ac_unique_file=src/main.c # Find the source files, if location was not specified. if test -z "$srcdir"; then @@ -517,7 +517,7 @@ fi -# From configure.in Revision: 1.12 +# From configure.in Revision: 1.13 ac_aux_dir= for ac_dir in aux $srcdir/aux; do if test -f $ac_dir/install-sh; then @@ -569,7 +569,7 @@ echo "$ac_t""$host" 1>&6 if test -n "$prefix"; then myprefix="$prefix"; else - myprefix='/usr/local/squid'; + myprefix="$ac_default_prefix" fi INSTALL_TOPDIR="$myprefix"; @@ -577,10 +577,27 @@ INSTALL_LIBDIR="$myprefix/lib"; INSTALL_BINDIR="$myprefix/bin"; INSTALL_MANDIR="$myprefix/man"; +eval "sysconfdirval=$sysconfdir" +eval "bindirval=$bindir" + THIS_HOST="`hostname`" XTRA_CFLAGS='' CRYPT_LIB='' +if test -z "$CACHE_HTTP_PORT"; then + CACHE_HTTP_PORT="3128" +fi +if test -z "$CACHE_ICP_PORT"; then + CACHE_ICP_PORT="3130" +fi +if test -z "$CACHE_FTP_PORT"; then + CACHE_FTP_PORT="3132" +fi + + + + + @@ -694,7 +711,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error @@ -708,7 +725,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error @@ -1008,7 +1025,7 @@ if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1048,7 +1065,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext < #include @@ -1164,7 +1181,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1182,7 +1199,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1203,7 +1220,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1261,7 +1278,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1291,7 +1308,7 @@ done cat > conftest.$ac_ext < EOF @@ -1314,7 +1331,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1348,7 +1365,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1382,7 +1399,7 @@ if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } @@ -1414,7 +1431,7 @@ if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF diff --git a/configure.in b/configure.in index 37737f1484..9fb2fe37b3 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.7) dnl -dnl $Id: configure.in,v 1.13 1996/03/28 02:32:49 wessels Exp $ +dnl $Id: configure.in,v 1.14 1996/04/08 23:25:18 wessels Exp $ dnl dnl dnl -AC_INIT(include/config.h) +AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.13 $)dnl +AC_REVISION($Revision: 1.14 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(aux) @@ -20,7 +20,7 @@ dnl Build a copy of prefix if test -n "$prefix"; then myprefix="$prefix"; else - myprefix='/usr/local/squid'; + myprefix="$ac_default_prefix" fi INSTALL_TOPDIR="$myprefix"; @@ -28,10 +28,23 @@ INSTALL_LIBDIR="$myprefix/lib"; INSTALL_BINDIR="$myprefix/bin"; INSTALL_MANDIR="$myprefix/man"; +eval "sysconfdirval=$sysconfdir" +eval "bindirval=$bindir" + THIS_HOST="`hostname`" XTRA_CFLAGS='' CRYPT_LIB='' +if test -z "$CACHE_HTTP_PORT"; then + CACHE_HTTP_PORT="3128" +fi +if test -z "$CACHE_ICP_PORT"; then + CACHE_ICP_PORT="3130" +fi +if test -z "$CACHE_FTP_PORT"; then + CACHE_FTP_PORT="3132" +fi + dnl Subsitutions AC_SUBST(INSTALL_TOPDIR) AC_SUBST(INSTALL_LIBDIR) @@ -40,7 +53,11 @@ AC_SUBST(INSTALL_MANDIR) AC_SUBST(DEFS) AC_SUBST(XTRA_CFLAGS) AC_SUBST(THIS_HOST) -AC_SUBST(SOCKET_PH_TYPE) +AC_SUBST(CACHE_HTTP_PORT) +AC_SUBST(CACHE_ICP_PORT) +AC_SUBST(CACHE_FTP_PORT) +AC_SUBST(sysconfdirval) +AC_SUBST(bindirval) dnl Check for GNU cc AC_PROG_CC @@ -215,9 +232,10 @@ rm -f core AC_OUTPUT(\ ./makefile \ ./lib/Makefile \ - ./src/Makefile \ - ./include/paths.h \ + ./include/config.h \ ./scripts/Makefile \ ./scripts/RunCache \ ./scripts/RunAccel \ + ./src/Makefile \ + ./src/cached.conf \ ) diff --git a/src/Makefile.in b/src/Makefile.in index a27b3c6cac..7f70edfb6c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,21 +1,19 @@ # # Makefile for the Harvest Object Cache server # -# $Id: Makefile.in,v 1.11 1996/04/08 18:28:53 wessels Exp $ +# $Id: Makefile.in,v 1.12 1996/04/08 23:25:19 wessels Exp $ # # Uncomment and customize the following to suit your needs: # LOG_OPT = # -DNO_LOGGGING -PORT_OPT = # -DCACHE_HTTP_PORT=3128 -DCACHE_ICP_PORT=3130 HOST_OPT = # -DCACHEMGR_HOSTNAME="getfullhostname()" -DEFINES = $(LOG_OPT) $(PORT_OPT) $(HOST_OPT) +DEFINES = $(LOG_OPT) $(HOST_OPT) -prefix = @prefix@ -top_srcdir = @top_srcdir@ -INSTALL_BINDIR = $(prefix)/bin -INSTALL_LIBDIR = $(prefix)/lib -INSTALL_MANDIR = $(prefix)/man -INSTALL_CGIDIR = $(prefix)/cgi-bin +prefix = @prefix@ +exec_prefix = @exec_prefix@ +top_srcdir = @top_srcdir@ +bindir = @bindir@ +sysconfdir = @sysconfdir@ CC = @CC@ INSTALL = @INSTALL@ @@ -41,8 +39,6 @@ SHELL = /bin/sh #CC = cc #XTRA_CFLAGS = -D_HARVEST_HPUX_ -d_AIX -D_ALL_SOURCE # -# In addition, add -DBUGGY_AIX_SOCKETS if you suspect your sockets -# implementation is broken. ## LINUX users might need to use these values # @@ -66,11 +62,22 @@ OBJS = blocklist.o cache_cf.o cached_error.o comm.o \ store.o storetoString.o tools.o ttl.o \ url.o wais.o $(XTRA_OBJS) +DEFAULTS = \ + -DDEFAULT_CONFIG_FILE=\"$(sysconfdir)/cached.conf\" \ + -DDEFAULT_FTPGET=\"$(bindir)/ftpget\" \ + -DDEFAULT_DNSSERVER=\"$(bindir)/dnsserver\" \ + -DDEFAULT_CACHE_LOG=\"$(prefix)/logs/cache.log\" \ + -DDEFAULT_ACCESS_LOG=\"$(prefix)/logs/access.log\" \ + -DDEFAULT_HIERARCHY_LOG=\"$(prefix)/logs/hierarchy.log\" + all: $(PROGS) $(UTILS) $(CGIPROGS) cached: $(OBJS) $(CC) -o $@ $(LDFLAGS) $(OBJS) $(CRYPT_LIB) $(LIBS) +cache_cf.o: cache_cf.c + $(CC) -c cache_cf.c $(CFLAGS) $(DEFAULTS) + client: client.o $(CC) -o $@ $(LDFLAGS) $@.o $(CLIENT_LIBS) @@ -83,31 +90,47 @@ cachemgr.cgi: cachemgr.o ftpget: ftpget.o $(CC) -o $@ $(LDFLAGS) ftpget.o $(LIBS) -install: all +install-mkdirs: @if test ! -d $(prefix); then \ echo "mkdir $(prefix)"; \ mkdir $(prefix); \ fi - @if test ! -d $(INSTALL_BINDIR); then \ - echo "mkdir $(INSTALL_BINDIR)"; \ - mkdir $(INSTALL_BINDIR); \ + @if test ! -d $(exec_prefix); then \ + echo "mkdir $(exec_prefix)"; \ + mkdir $(exec_prefix); \ + fi + @if test ! -d $(bindir); then \ + echo "mkdir $(bindir)"; \ + mkdir $(bindir); \ + fi + @if test ! -d $(confdir); then \ + echo "mkdir $(confdir)"; \ + mkdir $(confdir); \ fi + @if test ! -d $(exec_prefix)/logs; then \ + echo "mkdir $(exec_prefix)/logs"; \ + mkdir $(exec_prefix)/logs; \ + fi + +install: all install-mkdirs @for f in $(PROGS); do \ - echo $(INSTALL_BIN) $$f $(INSTALL_BINDIR); \ - $(INSTALL_BIN) $$f $(INSTALL_BINDIR); \ + echo $(INSTALL_BIN) $$f $(bindir); \ + $(INSTALL_BIN) $$f $(bindir); \ done @for f in $(UTILS); do \ - echo $(INSTALL_BIN) $$f $(INSTALL_BINDIR); \ - $(INSTALL_BIN) $$f $(INSTALL_BINDIR); \ + echo $(INSTALL_BIN) $$f $(bindir); \ + $(INSTALL_BIN) $$f $(bindir); \ done - @if test ! -d $(INSTALL_CGIDIR); then \ - echo "mkdir $(INSTALL_CGIDIR)"; \ - mkdir $(INSTALL_CGIDIR); \ - fi @for f in $(CGIPROGS); do \ - echo $(INSTALL_BIN) $$f $(INSTALL_CGIDIR); \ - $(INSTALL_BIN) $$f $(INSTALL_CGIDIR); \ + echo $(INSTALL_BIN) $$f $(bindir); \ + $(INSTALL_BIN) $$f $(bindir); \ done + @if test -f $(confdir)/cached.conf ; then \ + echo "$@ will not overwrite existing $(confdir)/cached.conf" ; \ + else \ + echo "$(INSTALL_FILE) cached.conf $(confdir)"; \ + $(INSTALL_FILE) cached.conf $(confdir); \ + fi clean: -rm -rf *.o *pure_* core $(PROGS) $(UTILS) $(CGIPROGS) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 347ea1f947..9c55c4cfd2 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,4 +1,4 @@ -/* $Id: cache_cf.cc,v 1.24 1996/04/08 18:39:21 wessels Exp $ */ +/* $Id: cache_cf.cc,v 1.25 1996/04/08 23:25:20 wessels Exp $ */ /* DEBUG: Section 3 cache_cf: Configuration file parsing */ @@ -101,14 +101,14 @@ static struct { #define DefaultAsciiPortNum CACHE_HTTP_PORT #define DefaultUdpPortNum CACHE_ICP_PORT -#define DefaultCacheLogFile "cache.log" -#define DefaultAccessLogFile "cache.access.log" -#define DefaultHierarchyLogFile "cache.hierarchy.log" +#define DefaultCacheLogFile DEFAULT_CACHE_LOG +#define DefaultAccessLogFile DEFAULT_ACCESS_LOG +#define DefaultHierarchyLogFile DEFAULT_HIERARCHY_LOG #define DefaultLogRotateNumber 10 #define DefaultAdminEmail "webmaster" -#define DefaultFtpgetProgram "ftpget" +#define DefaultFtpgetProgram DEFAULT_FTPGET #define DefaultFtpgetOptions "" -#define DefaultDnsserverProgram "dnsserver" +#define DefaultDnsserverProgram DEFAULT_DNSSERVER #define DefaultEffectiveUser (char *)NULL /* default NONE */ #define DefaultEffectiveGroup (char *)NULL /* default NONE */ #define DefaultAppendDomain (char *)NULL /* default NONE */ @@ -1487,7 +1487,6 @@ int parseConfigFile(file_name) printf(" For this run, however, cached will use %d minutes for clean_rate.\n", (int) (getCleanRate() / 60)); fflush(stdout); /* print message */ } - storeSanityCheck(); if (accel_ip_acl == NULL) accel_ip_acl = proxy_ip_acl; diff --git a/src/ftp.cc b/src/ftp.cc index 732433f632..3b7893ae48 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,4 +1,4 @@ -/* $Id: ftp.cc,v 1.23 1996/04/08 18:28:56 wessels Exp $ */ +/* $Id: ftp.cc,v 1.24 1996/04/08 23:25:21 wessels Exp $ */ /* * DEBUG: Section 9 ftp: FTP @@ -378,7 +378,7 @@ void ftpConnInProgress(fd, data) debug(9, 5, "ftpConnInProgress: FD %d\n", fd); - if (comm_connect(fd, "localhost", 3131) != COMM_OK) + if (comm_connect(fd, "localhost", CACHE_FTP_PORT) != COMM_OK) switch (errno) { case EINPROGRESS: case EALREADY: @@ -435,7 +435,7 @@ int ftpStart(unusedfd, url, entry) /* Pipe/socket created ok */ /* Now connect ... */ - if ((status = comm_connect(data->ftp_fd, "localhost", 3131))) { + if ((status = comm_connect(data->ftp_fd, "localhost", CACHE_FTP_PORT))) { if (status != EINPROGRESS) { cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); ftpCloseAndFree(data->ftp_fd, data); @@ -502,8 +502,8 @@ int ftpInitialize() /* inherit stdin,stdout,stderr */ for (fd = 3; fd < fdstat_biggest_fd(); fd++) (void) close(fd); - sprintf(pbuf, "%d", 3131); - execlp(ftpget, ftpget, "-D26,1", "-S", pbuf, NULL); + sprintf(pbuf, "%d", CACHE_FTP_PORT); + execlp(ftpget, ftpget, "-S", pbuf, NULL); debug(9, 0, "ftpInitialize: %s: %s\n", ftpget, xstrerror()); _exit(1); return (1); /* eliminate compiler warning */ diff --git a/src/main.cc b/src/main.cc index 6d19b19ee2..fca9e1fa6c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,4 +1,4 @@ -/* $Id: main.cc,v 1.22 1996/04/08 19:32:39 wessels Exp $ */ +/* $Id: main.cc,v 1.23 1996/04/08 23:25:21 wessels Exp $ */ /* DEBUG: Section 1 main: startup and main loop */ @@ -207,8 +207,8 @@ static void mainInitialize() if (theUdpConnection >= 0 && (!httpd_accel_mode || getAccelWithProxy())) neighbors_open(theUdpConnection); - if (!first_time) { - + if (first_time) { + first_time = 0; /* module initialization */ disk_init(); stat_init(&CacheInfo, getAccessLogFile()); @@ -228,7 +228,6 @@ int main(argc, argv) char **argv; { int errcount = 0; - char *s = NULL; int n; /* # of GC'd objects */ time_t last_maintain = 0; @@ -267,14 +266,9 @@ int main(argc, argv) fd_note(1, "STDOUT"); fd_note(2, "STDERR"); - if (config_file == NULL) { - if ((s = getenv("HARVEST_HOME")) != NULL) { - config_file = (char *) xcalloc(1, strlen(s) + 64); - sprintf(config_file, "%s/lib/cached.conf", s); - } else { - config_file = xstrdup("/usr/local/harvest/lib/cached.conf"); - } - } + if (config_file == NULL) + config_file = xstrdup(DEFAULT_CONFIG_FILE); + /* enable syslog by default */ syslog_enable = 0; diff --git a/src/store.cc b/src/store.cc index 1c7b413deb..da12c9d5ab 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,5 +1,5 @@ -/* $Id: store.cc,v 1.32 1996/04/05 17:48:32 wessels Exp $ */ +/* $Id: store.cc,v 1.33 1996/04/08 23:25:22 wessels Exp $ */ /* * DEBUG: Section 20 store @@ -2360,12 +2360,14 @@ int storeInit() { int dir_created; + storeSanityCheck(); file_map_create(MAX_SWAP_FILE); dir_created = storeVerifySwapDirs(zap_disk_store); storeCreateHashTable(urlcmp); sprintf(swaplog_file, "%s/log", swappath(0)); + if (!zap_disk_store) { ok_write_clean_log = 0; storeRebuildFromDisk(); @@ -2436,7 +2438,7 @@ void storeSanityCheck() if (errno != ENOENT) continue; debug(20, 0, "WARNING: Cannot write to '%s' for storage swap area.\n", name); - debug(20, 0, "Forcing a *full restart* (e.g., cached -z)..."); + debug(20, 0, "Forcing a *full restart* (e.g., cached -z)...\n"); zap_disk_store = 1; return; }