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.
18 dnl Check for Digital Unix: it has a different way of building for pthreads,
19 dnl and we can't build pthreads programs with gcc due to header problems.
23 if test -z "$CC"; then
26 SERVER_LDFLAGS=-pthread
27 TARGETS="client server utils serv_modules"
34 dnl Checks for programs.
36 if test "$GCC" = yes; then
37 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
38 dnl pass -rdynamic to the linker to enable dlopen() modules to
39 dnl refer to symbols in the main executable (applies to citserver)
44 SERVER_LDFLAGS=-rdynamic
51 missing_dir=`cd $ac_aux_dir && pwd`
52 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
54 dnl Checks for libraries.
56 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
57 dnl Makefile only passes $(LIBS) to that target. If other programs start
58 dnl requiring additional libraries, we'll have to use other variables, as is
61 dnl We want to test for crypt() and dlopen() in libc before checking for
62 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
63 AC_CHECK_FUNCS(crypt dlopen)
65 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
66 dnl passwords and/or PAM...
67 if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then
68 AC_CHECK_LIB(crypt, crypt)
71 dnl Enable autologin if the feature is requested (which is the default) and
72 dnl a crypt() functin is available.
73 if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then
74 AC_DEFINE(ENABLE_AUTOLOGIN)
77 if test "$ac_cv_func_dlopen" = no; then
78 AC_CHECK_LIB(dl, dlopen)
81 AC_CHECK_LIB(gdbm, gdbm_open)
82 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
84 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
85 dnl -pthread flag takes care of this.) If we find one of the libraries, then
86 dnl set up the TARGETS variable to build the server as well as the client.
87 if test "$SERVER_LDFLAGS" != -pthread; then
88 AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"
89 TARGETS="client server utils serv_modules"])
90 AC_CHECK_LIB(pthreads, pthread_create, [LIBS="$LIBS -lpthreads"
91 TARGETS="client server utils serv_modules"])
94 dnl Checks for header files.
98 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)
100 dnl Checks for typedefs, structures, and compiler characteristics.
107 dnl Checks for library functions.
109 AC_PROG_GCC_TRADITIONAL
112 AC_CHECK_FUNCS(mkdir mkfifo mktime rmdir select socket strerror)
113 AC_REPLACE_FUNCS(snprintf getutline)
115 dnl Done! Now write the Makefile and sysdep.h
118 AC_SUBST(SERVER_LDFLAGS)
121 AC_CONFIG_HEADER(sysdep.h)
122 AC_OUTPUT(Makefile weekly)