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.
23 dnl Also has stupid non-reentrant gethostbyaddr() and friends.
25 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
27 AC_DEFINE(HAVE_NONREENTRANT_NETDB)
29 dnl Digital Unix has an odd way to build pthreads, and we can't build
30 dnl pthreads programs with gcc due to header problems.
32 test -z "$CC" && CC=cc
33 SERVER_LDFLAGS=-pthread
40 dnl Checks for programs.
43 dnl Set up system-dependent compiler flags.
44 if test "$GCC" = yes; then
45 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
53 SERVER_LDFLAGS=-rdynamic
60 missing_dir=`cd $ac_aux_dir && pwd`
61 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
63 dnl Checks for libraries.
65 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
66 dnl Makefile only passes $(LIBS) to that target. If other programs start
67 dnl requiring additional libraries, we'll have to use other variables, as is
70 dnl We want to test for crypt() and dlopen() in libc before checking for
71 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
72 AC_CHECK_FUNCS(crypt dlopen)
74 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
75 dnl passwords and/or PAM...
76 if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then
77 AC_CHECK_LIB(crypt, crypt)
80 dnl Enable autologin if the feature is requested (which is the default) and
81 dnl a crypt() functin is available.
82 if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then
83 AC_DEFINE(ENABLE_AUTOLOGIN)
86 if test "$ac_cv_func_dlopen" = no; then
87 AC_CHECK_LIB(dl, dlopen)
90 AC_CHECK_LIB(gdbm, gdbm_open)
93 AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"
95 AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES")
98 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
99 dnl -pthread flag takes care of this.)
100 if test "$SERVER_LDFLAGS" != -pthread; then
101 AC_CHECK_LIB(pthread, pthread_create)
102 AC_CHECK_LIB(pthreads, pthread_create)
105 dnl Checks for header files.
109 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)
111 dnl Checks for typedefs, structures, and compiler characteristics.
118 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
119 [AC_TRY_COMPILE([#include <utmp.h>], [struct utmp ut; ut.ut_type;],
120 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
121 if test $ac_cv_struct_ut_type = yes; then
122 AC_DEFINE(HAVE_UT_TYPE)
125 dnl Checks for library functions.
127 AC_PROG_GCC_TRADITIONAL
130 AC_CHECK_FUNCS(mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
131 AC_CHECK_FUNC(pthread_create, TARGETS="client server utils serv_modules")
132 AC_REPLACE_FUNCS(snprintf getutline)
134 dnl Done! Now write the Makefile and sysdep.h
138 AC_SUBST(SERVER_LDFLAGS)
141 AC_CONFIG_HEADER(sysdep.h)
142 AC_OUTPUT(Makefile weekly)