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)])
13 AC_ARG_ENABLE(chkpwd, [ --enable-chkpwd build 'chkpwd' (use this if you have shadow passwords)])
14 AC_ARG_WITH(pam, [ --with-pam use PAM if present])
16 dnl By default, we only build the client (citadel and whobbs) unless we can
17 dnl figure out how to build with POSIX threads.
23 dnl BSDI 3.0 wants relocatable object modules instead of shared libs
24 dnl for dlopen(), and has a wrapper script to link with shared libs.
25 dnl Also has stupid non-reentrant gethostbyaddr() and friends.
27 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
29 AC_DEFINE(HAVE_NONREENTRANT_NETDB)
31 dnl Digital Unix has an odd way to build for pthreads, and we can't
32 dnl build pthreads programs with gcc due to header problems.
34 test -z "$CC" && CC=cc
35 SERVER_LDFLAGS=-pthread
42 dnl Checks for programs.
45 dnl Set up system-dependent compiler flags.
46 if test "$GCC" = yes; then
47 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
55 SERVER_LDFLAGS=-rdynamic
62 missing_dir=`cd $ac_aux_dir && pwd`
63 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
65 dnl Checks for libraries.
67 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
68 dnl Makefile only passes $(LIBS) to that target. If other programs start
69 dnl requiring additional libraries, we'll have to use other variables, as is
72 dnl We want to test for crypt() and dlopen() in libc before checking for
73 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
74 AC_CHECK_FUNCS(crypt dlopen)
76 if test "$ac_cv_func_dlopen" = no; then
77 AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"
81 dnl Determine the system's authentication capabilities, if autologin is
82 dnl requested. We currently support PAM, standard getpwnam(), and getspnam()
83 dnl (Linux shadow passwords)
84 if test "$enable_autologin" != no; then
85 if test "$with_pam" = yes; then
87 AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS"
89 AC_CHECK_FUNCS(pam_start)
90 test "$enable_chkpwd" = yes && LIBS=$save_LIBS
92 if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then
93 AC_CHECK_LIB(shadow, getspnam)
94 if test "$ac_cv_func_crypt" = no; then
95 AC_CHECK_LIB(crypt, crypt, [chkpwd_LIBS=-lcrypt
96 test "$enable_chkpwd" != yes && \
97 LIBS="-lcrypt $LIBS"])
100 if test "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes -o "$ac_cv_func_pam_start" = yes; then
101 AC_DEFINE(ENABLE_AUTOLOGIN)
102 if test "$enable_chkpwd" = yes; then
103 AC_DEFINE(ENABLE_CHKPWD)
111 AC_CHECK_LIB(gdbm, gdbm_open)
114 AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"
116 AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES")
119 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
120 dnl -pthread flag takes care of this.)
121 if test "$SERVER_LDFLAGS" != -pthread; then
122 AC_CHECK_LIB(pthread, pthread_create)
123 AC_CHECK_LIB(pthreads, pthread_create)
126 dnl Checks for header files.
130 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)
132 dnl Checks for typedefs, structures, and compiler characteristics.
139 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
140 [AC_TRY_COMPILE([#include <utmp.h>], [struct utmp ut; ut.ut_type;],
141 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
142 if test $ac_cv_struct_ut_type = yes; then
143 AC_DEFINE(HAVE_UT_TYPE)
146 dnl Checks for library functions.
148 AC_PROG_GCC_TRADITIONAL
151 AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
152 AC_CHECK_FUNC(pthread_create, TARGETS="client server utils serv_modules")
153 AC_REPLACE_FUNCS(snprintf getutline)
155 dnl Done! Now write the Makefile and sysdep.h
160 AC_SUBST(chkpwd_LIBS)
162 AC_SUBST(SERVER_LDFLAGS)
165 AC_CONFIG_HEADER(sysdep.h)
166 AC_OUTPUT(Makefile weekly)