# 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
-# 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
if test -n "$prefix"; then
myprefix="$prefix";
else
- myprefix='/usr/local/squid';
+ myprefix="$ac_default_prefix"
fi
INSTALL_TOPDIR="$myprefix";
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
+
+
+
+
+
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 698 "configure"
+#line 715 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 712 "configure"
+#line 729 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1012 "configure"
+#line 1029 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1052 "configure"
+#line 1069 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1087 "configure"
+#line 1104 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 1124 "configure"
+#line 1141 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1146 "configure"
+#line 1163 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
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
-#line 1168 "configure"
+#line 1185 "configure"
#include "confdefs.h"
#include <string.h>
EOF
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
-#line 1186 "configure"
+#line 1203 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 1207 "configure"
+#line 1224 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1265 "configure"
+#line 1282 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
cat > conftest.$ac_ext <<EOF
-#line 1295 "configure"
+#line 1312 "configure"
#include "confdefs.h"
#include <malloc.h>
EOF
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1318 "configure"
+#line 1335 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1352 "configure"
+#line 1369 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1386 "configure"
+#line 1403 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() { return 0; }
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1418 "configure"
+#line 1435 "configure"
#include "confdefs.h"
#ifdef __GNUC__
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1477 "configure"
+#line 1494 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1506 "configure"
+#line 1523 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1560 "configure"
+#line 1577 "configure"
#include "confdefs.h"
find_stack_direction ()
{
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1605 "configure"
+#line 1622 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lmalloc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1645 "configure"
+#line 1662 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1679 "configure"
+#line 1696 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1719 "configure"
+#line 1736 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lbsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1759 "configure"
+#line 1776 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-l44bsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1800 "configure"
+#line 1817 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1834 "configure"
+#line 1851 "configure"
#include "confdefs.h"
int main() { return 0; }
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1869 "configure"
+#line 1886 "configure"
#include "confdefs.h"
int main() { return 0; }
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1931 "configure"
+#line 1948 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
trap 'rm -fr `echo "\
./makefile \
./lib/Makefile \
- ./src/Makefile \
- ./include/paths.h \
+ ./include/config.h \
./scripts/Makefile \
./scripts/RunCache \
./scripts/RunAccel \
+ ./src/Makefile \
+ ./src/cached.conf \
include/autoconf.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
s%@INSTALL_MANDIR@%$INSTALL_MANDIR%g
s%@XTRA_CFLAGS@%$XTRA_CFLAGS%g
s%@THIS_HOST@%$THIS_HOST%g
-s%@SOCKET_PH_TYPE@%$SOCKET_PH_TYPE%g
+s%@CACHE_HTTP_PORT@%$CACHE_HTTP_PORT%g
+s%@CACHE_ICP_PORT@%$CACHE_ICP_PORT%g
+s%@CACHE_FTP_PORT@%$CACHE_FTP_PORT%g
+s%@sysconfdirval@%$sysconfdirval%g
+s%@bindirval@%$bindirval%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
CONFIG_FILES=\${CONFIG_FILES-"\
./makefile \
./lib/Makefile \
- ./src/Makefile \
- ./include/paths.h \
+ ./include/config.h \
./scripts/Makefile \
./scripts/RunCache \
./scripts/RunAccel \
+ ./src/Makefile \
+ ./src/cached.conf \
"}
EOF
cat >> $CONFIG_STATUS <<\EOF
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)
if test -n "$prefix"; then
myprefix="$prefix";
else
- myprefix='/usr/local/squid';
+ myprefix="$ac_default_prefix"
fi
INSTALL_TOPDIR="$myprefix";
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)
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
AC_OUTPUT(\
./makefile \
./lib/Makefile \
- ./src/Makefile \
- ./include/paths.h \
+ ./include/config.h \
./scripts/Makefile \
./scripts/RunCache \
./scripts/RunAccel \
+ ./src/Makefile \
+ ./src/cached.conf \
)
#
# 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@
#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
#
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)
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)
-/* $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 */
#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 */
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;
-/* $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
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:
/* 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);
/* 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 */
-/* $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 */
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());
char **argv;
{
int errcount = 0;
- char *s = NULL;
int n; /* # of GC'd objects */
time_t last_maintain = 0;
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;
-/* $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
{
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();
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;
}