From 8e2661d724df903a649ccdeb8dbc897549efd930 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Thu, 7 Dec 2000 16:59:02 +0000 Subject: [PATCH] added --with-db and --with-gdbm options to configure --- citadel/ChangeLog | 4 ++++ citadel/Makefile.in | 5 +++-- citadel/configure.in | 41 +++++++++++++++++++++++++++++++++++++---- citadel/database.c | 2 -- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 02609d1de..f87b8b972 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 573.41 2000/12/07 16:59:02 nbryant + added --with-db and --with-gdbm options to configure + Revision 573.40 2000/12/07 04:50:33 ajc * Wrap housekeeper and timer events in transaction open/close functions * Checkpoint the DB as an EVT_TIMER event instead of after each session @@ -2188,3 +2191,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 8fce2b0ff..6d6ac0e51 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -71,13 +71,14 @@ INSTALL_DATA=@INSTALL_DATA@ SHELL=/bin/sh AUTOCONF=@AUTOCONF@ YACC=@YACC@ +DATABASE=@DATABASE@ # End configuration section VPATH=$(srcdir) SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \ - config.c control.c database.c dynloader.c file_ops.c \ + config.c control.c $(DATABASE) dynloader.c file_ops.c \ housekeeping.c internetmail.c ipc_c_tcp.c locate_host.c \ logging.c mailinglist.c messages.c msgbase.c msgform.c netmailer.c \ netpoll.c netproc.c netsetup.c policy.c proxy.c rcit.c readlog.c \ @@ -131,7 +132,7 @@ netpoll: netpoll.o config.o ipc_c_tcp.o tools.o $(LIBOBJS) SERV_OBJS = citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \ msgbase.ro config.ro sysdep.ro locate_host.ro housekeeping.ro \ - database.ro control.ro logging.ro policy.ro dynloader.ro tools.ro \ + $(DATABASE:.c=.ro) control.ro logging.ro policy.ro dynloader.ro tools.ro \ mime_parser.ro html.ro internet_addressing.ro \ parsedate.ro genstamp.ro clientsocket.ro \ $(AUTH) $(LIBOBJS:.o=.ro) diff --git a/citadel/configure.in b/citadel/configure.in index 72cbac057..a0ffc4618 100644 --- a/citadel/configure.in +++ b/citadel/configure.in @@ -17,6 +17,26 @@ AC_ARG_ENABLE(threaded-client, [ --disable-threaded-client AC_ARG_WITH(pam, [ --with-pam use PAM if present (see PAM.txt before you try this)]) AC_ARG_WITH(kthread, [ --with-kthread use kernel threads (on FreeBSD) (not recommended yet)]) +AC_ARG_WITH(gdbm, [ --with-gdbm[=DIR] use GDBM [DIR=/usr/local]]) +AC_ARG_WITH(db, [ --with-db[=DIR] use Sleepycat DB 3.1 [DIR=/usr/local/BerkeleyDB.3.1]]) + +if test "x$with_gdbm" != xno -a "x$with_gdbm" != xyeso -a "$with_gdbm"; then + db_dir="$with_gdbm" + with_gdbm=yes +else + test -f /usr/local/lib/libgdbm.a -o -f /usr/local/lib/libgdbm.so && db_dir=/usr/local +fi + +if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then + db_dir="$with_db" + with_db=yes +else + test -d /usr/local/BerkeleyDB.3.1 && db_dir=/usr/local/BerkeleyDB.3.1 +fi + +if test "x$with_gdbm" = xyes -a "x$with_db" = xyes; then + AC_MSG_ERROR(can't enable both gdbm and db) +fi dnl By default, we only build the client (citadel and whobbs) unless we can dnl figure out how to build with POSIX threads. @@ -168,8 +188,20 @@ if test "$enable_autologin" != no; then fi fi -test -f /usr/local/lib/libgdbm.a && LDFLAGS="$LDFLAGS -L/usr/local/lib" -AC_CHECK_LIB(gdbm, gdbm_open, GDBM="$GDBM -lgdbm") +test "$db_dir" && LDFLAGS="$LDFLAGS -L$db_dir/lib" +if test "x$with_gdbm" != xno -a "x$with_db" != xyes; then + AC_CHECK_LIB(gdbm, gdbm_open, + [GDBM="$GDBM -lgdbm" + DATABASE=database.c + with_db=no]) +fi + +if test "x$with_db" != xno -a "x$with_gdbm" != xyes; then + AC_CHECK_LIB(db, db_env_create, + [GDBM="$GDBM -ldb" + DATABASE=database_sleepycat.c + with_gdbm=no]) +fi test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_CHECK_LIB(resolv, res_query, RESOLV="$RESOLV -lresolv") @@ -194,8 +226,8 @@ dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT -test -f /usr/local/include/gdbm.h && CPPFLAGS="$CPPFLAGS -I/usr/local/include" -AC_CHECK_HEADERS(curses.h dl.h dlfcn.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h gdbm.h utmp.h utmpx.h paths.h) +test "$db_dir" && CPPFLAGS="$CPPFLAGS -I$db_dir/include" +AC_CHECK_HEADERS(curses.h dl.h dlfcn.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h utmp.h utmpx.h paths.h) dnl some systems require -pthread, -D_REENTRANT, etc to be passed to cc if we dnl include pthread.h: @@ -321,5 +353,6 @@ AC_SUBST(PTHREAD_LIBS) AC_SUBST(CLIENT_PTLIBS) AC_SUBST(CL_LIBOBJS) AC_SUBST(CX) +AC_SUBST(DATABASE) AC_CONFIG_HEADER(sysdep.h) AC_OUTPUT(Makefile weekly) diff --git a/citadel/database.c b/citadel/database.c index 0276e7b1f..ae16edc64 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -23,9 +23,7 @@ #include #include #include -#ifdef HAVE_GDBM_H #include -#endif #include "citadel.h" #include "server.h" #include "database.h" -- 2.30.2