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"
31 dnl Checks for programs.
33 if test "$GCC" = yes; then
34 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
35 dnl pass -rdynamic to the linker to enable dlopen() modules to
36 dnl refer to symbols in the main executable (applies to citserver)
41 SERVER_LDFLAGS=-rdynamic
48 missing_dir=`cd $ac_aux_dir && pwd`
49 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
51 dnl Checks for libraries.
53 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
54 dnl Makefile only passes $(LIBS) to that target. If other programs start
55 dnl requiring additional libraries, we'll have to use other variables, as is
58 dnl We want to test for crypt() and dlopen() in libc before checking for
59 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
60 AC_CHECK_FUNCS(crypt dlopen)
62 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
63 dnl passwords and/or PAM...
64 if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then
65 AC_CHECK_LIB(crypt, crypt)
68 dnl Enable autologin if the feature is requested (which is the default) and
69 dnl a crypt() functin is available.
70 if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then
71 AC_DEFINE(ENABLE_AUTOLOGIN)
74 if test "$ac_cv_func_dlopen" = no; then
75 AC_CHECK_LIB(dl, dlopen)
78 AC_CHECK_LIB(gdbm, gdbm_open)
79 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
81 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
82 dnl -pthread flag takes care of this.) If we find one of the libraries, then
83 dnl set up the TARGETS variable to build the server as well as the client.
84 if test "$SERVER_LDFLAGS" != -pthread; then
85 AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"
86 TARGETS="client server utils serv_modules"])
87 AC_CHECK_LIB(pthreads, pthread_create, [LIBS="$LIBS -lpthreads"
88 TARGETS="client server utils serv_modules"])
91 dnl Checks for header files.
95 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)
97 dnl Checks for typedefs, structures, and compiler characteristics.
104 dnl Checks for library functions.
106 AC_PROG_GCC_TRADITIONAL
109 AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror)
111 dnl Tell the Makefile whether we need to use our snprintf() replacement.
112 if test "$ac_cv_func_snprintf" = no; then
116 dnl Done! Now write the Makefile and sysdep.h
119 AC_SUBST(SERVER_LDFLAGS)
122 AC_CONFIG_HEADER(sysdep.h)
123 AC_OUTPUT(Makefile weekly)