]> code.citadel.org Git - citadel.git/blob - citadel/configure.in
* aclocal.m4, missing: new files, also swiped from automake
[citadel.git] / citadel / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.12)
3 AC_INIT(citserver.c)
4 AC_PREFIX_DEFAULT(/usr/local/citadel)
5 if test "$prefix" = NONE; then
6         AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix")
7 else
8         AC_DEFINE_UNQUOTED(BBSDIR, "$prefix")
9 fi
10
11 AC_ARG_ENABLE(autologin, [  --disable-autologin     disable autologin (default is enabled if possible)])
12
13 AC_ARG_ENABLE(ansi-color, [  --enable-ansi-color     enable ANSI color (default is disabled)],[if test "$enableval" = yes; then
14         AC_DEFINE(ANSI_COLOR)
15 fi])
16
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.
19 TARGETS=client
20
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.
23 AC_CANONICAL_HOST
24 case "$host" in
25         alpha*-dec-osf*)
26                 if test -z "$CC"; then
27                         CC=cc
28                 fi
29                 SERVER_LDFLAGS=-pthread
30                 TARGETS="client server utils serv_modules"
31         ;;
32 esac
33
34 dnl Checks for programs.
35 AC_PROG_CC
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
41 fi
42 AC_PROG_RANLIB
43 AC_PROG_INSTALL
44 missing_dir=`cd $ac_aux_dir && pwd`
45 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
46
47 dnl Checks for libraries.
48
49 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
50 dnl Makefile only passes $(LIBS) to that target. If other programs start
51 dnl requiring additional libraries, we'll have to use other variables, as is
52 dnl done with curses.
53
54 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
55 dnl passwords and/or PAM...
56 if test "$enable_autologin" != no; then
57         AC_CHECK_LIB(crypt, crypt)
58 fi
59
60 AC_CHECK_LIB(dl, dlopen)
61 AC_CHECK_LIB(gdbm, gdbm_open)
62 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
63
64 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
65 dnl -pthread flag takes care of this.) If we find one of the libraries, then
66 dnl set up the TARGETS variable to build the server as well as the client.
67 if test "$SERVER_LDFLAGS" != -pthread; then
68         AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"
69                 TARGETS="client server utils serv_modules"])
70         AC_CHECK_LIB(pthreads, pthread_create, [LIBS="$LIBS -lpthreads"
71                 TARGETS="client server utils serv_modules"])
72 fi
73
74 dnl Checks for header files.
75 AC_HEADER_DIRENT
76 AC_HEADER_STDC
77 AC_HEADER_SYS_WAIT
78 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)
79
80 dnl Checks for typedefs, structures, and compiler characteristics.
81 AC_C_CONST
82 AC_TYPE_PID_T
83 AC_TYPE_SIZE_T
84 AC_HEADER_TIME
85 AC_STRUCT_TM
86
87 dnl Checks for library functions.
88 AC_FUNC_GETPGRP
89 AC_PROG_GCC_TRADITIONAL
90 AC_TYPE_SIGNAL
91 AC_FUNC_VPRINTF
92 AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror)
93
94 dnl Enable autologin if the feature is requested (which is the default) and
95 dnl a crypt() function is available.
96 if test "$enable_autologin" != no; then
97         AC_CHECK_FUNC(crypt, AC_DEFINE(ENABLE_AUTOLOGIN))
98 fi
99
100 dnl Tell the Makefile whether we need to use our snprintf() replacement.
101 if test "$ac_cv_func_snprintf" = no; then
102         SNPRINTF=snprintf.o
103 fi
104
105 dnl Done! Now write the Makefile and sysdep.h
106 AC_SUBST(CURSES)
107 AC_SUBST(TARGETS)
108 AC_SUBST(SERVER_LDFLAGS)
109 AC_SUBST(SNPRINTF)
110 AC_CONFIG_HEADER(sysdep.h)
111 AC_OUTPUT(Makefile)