1 dnl Process this file with autoconf to produce a configure script.
5 AC_PREFIX_DEFAULT(/usr/local/citadel)
6 if test "$prefix" = NONE; then
7 AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix")
9 AC_DEFINE_UNQUOTED(BBSDIR, "$prefix")
12 AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled if possible)])
14 dnl By default, we only build the client (citadel and whobbs) unless we can
15 dnl figure out how to build with POSIX threads.
21 dnl BSDI 3.0 wants relocatable object modules instead of shared libs
22 dnl for dlopen(), and has a wrapper script to link with shared libs
24 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
27 dnl Digital Unix has an odd way to build pthreads, and we can't build
28 dnl pthreads programs with gcc due to header problems.
30 test -z "$CC" && CC=cc
31 SERVER_LDFLAGS=-pthread
38 dnl Checks for programs.
41 dnl Set up system-dependent compiler flags.
42 if test "$GCC" = yes; then
43 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
51 SERVER_LDFLAGS=-rdynamic
58 missing_dir=`cd $ac_aux_dir && pwd`
59 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
61 dnl Checks for libraries.
63 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
64 dnl Makefile only passes $(LIBS) to that target. If other programs start
65 dnl requiring additional libraries, we'll have to use other variables, as is
68 dnl We want to test for crypt() and dlopen() in libc before checking for
69 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
70 AC_CHECK_FUNCS(crypt dlopen)
72 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
73 dnl passwords and/or PAM...
74 if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then
75 AC_CHECK_LIB(crypt, crypt)
78 dnl Enable autologin if the feature is requested (which is the default) and
79 dnl a crypt() functin is available.
80 if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then
81 AC_DEFINE(ENABLE_AUTOLOGIN)
84 if test "$ac_cv_func_dlopen" = no; then
85 AC_CHECK_LIB(dl, dlopen)
88 AC_CHECK_LIB(gdbm, gdbm_open)
91 AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"
93 AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES")
96 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
97 dnl -pthread flag takes care of this.)
98 if test "$SERVER_LDFLAGS" != -pthread; then
99 AC_CHECK_LIB(pthread, pthread_create)
100 AC_CHECK_LIB(pthreads, pthread_create)
103 dnl Checks for header files.
107 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 pthread.h gdbm.h utmp.h)
109 dnl Checks for typedefs, structures, and compiler characteristics.
116 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
117 [AC_TRY_COMPILE([#include <utmp.h>], [struct utmp ut; ut.ut_type;],
118 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
119 if test $ac_cv_struct_ut_type = yes; then
120 AC_DEFINE(HAVE_UT_TYPE)
123 dnl Checks for library functions.
125 AC_PROG_GCC_TRADITIONAL
128 AC_CHECK_FUNCS(mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
129 AC_CHECK_FUNC(pthread_create, TARGETS="client server utils serv_modules")
130 AC_REPLACE_FUNCS(snprintf getutline)
132 dnl Done! Now write the Makefile and sysdep.h
136 AC_SUBST(SERVER_LDFLAGS)
139 AC_CONFIG_HEADER(sysdep.h)
140 AC_OUTPUT(Makefile weekly)