added --with-db and --with-gdbm options to configure
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 7 Dec 2000 16:59:02 +0000 (16:59 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 7 Dec 2000 16:59:02 +0000 (16:59 +0000)
citadel/ChangeLog
citadel/Makefile.in
citadel/configure.in
citadel/database.c

index 02609d1de09fa594d498ab0fe475e9bfea8669ec..f87b8b972609ca572c08b0096553823fb3daaa04 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 8fce2b0ff8ce9c2e5a79fef1441fa982c3c2fbf6..6d6ac0e51efa4ea540e629c55902be4d73d9dd68 100644 (file)
@@ -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)
index 72cbac057a865e0f7a33b9298f3624e2a666d278..a0ffc4618fdba679d434483d0ce53bea54300c9f 100644 (file)
@@ -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)
index 0276e7b1fe82a9730563eb33c421336d722f1f87..ae16edc64e3230c130e743ae9d43e26db4651aa3 100644 (file)
@@ -23,9 +23,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_GDBM_H
 #include <gdbm.h>
-#endif
 #include "citadel.h"
 #include "server.h"
 #include "database.h"