1 dnl Process this file with autoconf to produce a configure script.
4 AC_PREFIX_DEFAULT(/usr/local/citadel)
5 if test "$prefix" = NONE; then
6 AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix")
8 AC_DEFINE_UNQUOTED(BBSDIR, "$prefix")
11 AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled if possible)])
13 AC_ARG_ENABLE(ansi-color, [ --enable-ansi-color enable ANSI color (default is disabled)],[if test "$enableval" = yes; then
17 dnl By default, we only build the client (citadel and whobbs) unless we can
18 dnl figure out how to build with POSIX threads.
21 dnl Check for Digital Unix: it has a different way of building for pthreads,
22 dnl and we can't build pthreads programs with gcc due to header problems.
26 if test -z "$CC"; then
29 SERVER_LDFLAGS=-pthread
30 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)
40 SERVER_LDFLAGS=-rdynamic
45 missing_dir=`cd $ac_aux_dir && pwd`
46 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
48 dnl Checks for libraries.
50 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
51 dnl Makefile only passes $(LIBS) to that target. If other programs start
52 dnl requiring additional libraries, we'll have to use other variables, as is
55 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
56 dnl passwords and/or PAM...
57 if test "$enable_autologin" != no; then
58 AC_CHECK_LIB(crypt, crypt)
61 AC_CHECK_LIB(dl, dlopen)
62 AC_CHECK_LIB(gdbm, gdbm_open)
63 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
65 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
66 dnl -pthread flag takes care of this.) If we find one of the libraries, then
67 dnl set up the TARGETS variable to build the server as well as the client.
68 if test "$SERVER_LDFLAGS" != -pthread; then
69 AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"
70 TARGETS="client server utils serv_modules"])
71 AC_CHECK_LIB(pthreads, pthread_create, [LIBS="$LIBS -lpthreads"
72 TARGETS="client server utils serv_modules"])
75 dnl Checks for header files.
79 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)
81 dnl Checks for typedefs, structures, and compiler characteristics.
88 dnl Checks for library functions.
90 AC_PROG_GCC_TRADITIONAL
93 AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror)
95 dnl Enable autologin if the feature is requested (which is the default) and
96 dnl a crypt() function is available.
97 if test "$enable_autologin" != no; then
98 AC_CHECK_FUNC(crypt, AC_DEFINE(ENABLE_AUTOLOGIN))
101 dnl Tell the Makefile whether we need to use our snprintf() replacement.
102 if test "$ac_cv_func_snprintf" = no; then
106 dnl Done! Now write the Makefile and sysdep.h
109 AC_SUBST(SERVER_LDFLAGS)
112 AC_CONFIG_HEADER(sysdep.h)