]> code.citadel.org Git - citadel.git/blobdiff - citadel/configure.in
* New UI for mailing list setup
[citadel.git] / citadel / configure.in
index 7b2e8963f60e7fbbd2fe6d744b91540723c6f3b5..6a146ded04ebe25d1b88fc34e5157eef23962c38 100644 (file)
@@ -12,15 +12,32 @@ fi
 AC_ARG_ENABLE(autologin, [  --disable-autologin     disable autologin (default is enabled if possible)])
 AC_ARG_ENABLE(chkpwd, [  --disable-chkpwd        don't build 'chkpwd'])
 
-AC_ARG_ENABLE(icq,             [  --enable-icq            include server ICQ support], [
-       if test "x$enableval" = xyes; then
-               SERV_ICQ='modules/serv_icq$(SO)'
-       fi])
 AC_ARG_ENABLE(threaded-client, [  --disable-threaded-client
                          disable multithreaded 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
+       test -d /usr/local/BerkeleyDB.3.2 && db_dir=/usr/local/BerkeleyDB.3.2
+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.
@@ -29,7 +46,7 @@ TARGETS=client
 AC_CANONICAL_HOST
 SO=.so
 PTHREAD_DEFS=-D_REENTRANT
-LINK_SHARED='$(CC) -shared'
+LINK_SHARED='$(CC) -shared -fPIC'
 case "$host" in
        dnl BSDI 3.0 wants relocatable object modules instead of shared libs
        dnl for dlopen(), and has a wrapper script to link with shared libs.
@@ -66,6 +83,9 @@ case "$host" in
                PTHREAD_DEFS=-pthread
                LINK_SHARED="ld -x -Bshareable"
        ;;
+       *-*-solaris*)
+               PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS"
+       ;;
 esac
 
 dnl Checks for programs.
@@ -73,14 +93,24 @@ AC_PROG_CC
 
 dnl Set up system-dependent compiler flags.
 if test "$GCC" = yes; then
-       CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
        case "$host" in
                *-*-bsdi[123]*)
+                       CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
                ;;
                mips*-sgi-irix*)
+                       CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
+                       PICFLAGS=-fPIC
+               ;;
+               *-*-solaris*)
+                       CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
+                       PICFLAGS=-fPIC
+               ;;
+               *-*-hpux*)
+                       SERVER_LDFLAGS="$SERVER_LDFLAGS -Wl,-E"
                        PICFLAGS=-fPIC
                ;;
                *)
+                       CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
                        SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic"
                        PICFLAGS=-fPIC
                ;;
@@ -88,6 +118,7 @@ if test "$GCC" = yes; then
 fi
 AC_PROG_RANLIB
 AC_PROG_INSTALL
+AC_PROG_YACC
 missing_dir=`cd $ac_aux_dir && pwd`
 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
 
@@ -119,6 +150,12 @@ if test "$ac_cv_func_dlopen" = no; then
                test "$with_pam" = yes && chkpwd_LIBS="-ldl $chkpwd_LIBS"])
 fi
 
+dnl Check for HP/UX dyanmic loader. This should only be in -ldld.
+AC_CHECK_LIB(dld, shl_load, LIBS="-ldld $LIBS")
+
+dnl Check for Solaris realtime support
+AC_CHECK_LIB(rt, sched_yield)
+
 dnl Determine the system's authentication capabilities, if autologin is
 dnl requested. We currently support PAM, standard getpwnam(), and getspnam()
 dnl (Linux shadow passwords)
@@ -155,17 +192,29 @@ 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_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], [], [$NETLIBS])
+fi
+
+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
 
 test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
 AC_CHECK_LIB(resolv, res_query, RESOLV="$RESOLV -lresolv")
 
 save_LIBS=$LIBS
-AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"
-       CURSES=-ltermcap])
-AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES", [
-       AC_CHECK_LIB(ncurses, initscr, CURSES="-lncurses")])
+LIBS=$CURSES
+AC_SEARCH_LIBS(tgetent, [curses termcap])
+AC_SEARCH_LIBS(initscr, [curses ncurses])
+CURSES=$LIBS
 LIBS=$save_LIBS
 
 dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On
@@ -181,8 +230,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 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 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:
@@ -198,6 +247,13 @@ AC_TYPE_SIZE_T
 AC_HEADER_TIME
 AC_STRUCT_TM
 
+dnl Check the size of various builtin types; see typesize.h (error)
+AC_CHECK_SIZEOF(char, 0)
+AC_CHECK_SIZEOF(short, 0)
+AC_CHECK_SIZEOF(int, 0)
+AC_CHECK_SIZEOF(long, 0)
+dnl AC_CHECK_SIZEOF(long long, 0)
+
 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <utmp.h>], [struct utmp ut; ut.ut_type;],
@@ -219,7 +275,7 @@ AC_FUNC_GETPGRP
 AC_PROG_GCC_TRADITIONAL
 AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime rmdir select socket strerror)
+AC_CHECK_FUNCS(getspnam getutxline mkdir mkfifo mktime rmdir select socket strerror strcasecmp strncasecmp)
 
 dnl Now check for pthreads -- set up variables so that the compiler will be run
 dnl with proper flags for pthread programs
@@ -294,7 +350,6 @@ AC_SUBST(NETLIBS)
 AC_SUBST(chkpwd_LIBS)
 AC_SUBST(TARGETS)
 AC_SUBST(SERVER_LDFLAGS)
-AC_SUBST(SERV_ICQ)
 AC_SUBST(PICFLAGS)
 AC_SUBST(LINK_SHARED)
 AC_SUBST(PTHREAD_DEFS)
@@ -302,5 +357,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)