]> code.citadel.org Git - citadel.git/blob - citadel/configure.in
7b7bcaae914b4657ef7bc92696edff39b0eeb0a5
[citadel.git] / citadel / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id$
3 AC_PREREQ(2.13)
4 AC_INIT(citserver.c)
5 AC_PREFIX_DEFAULT(/usr/local/citadel)
6 if test "$prefix" = NONE; then
7         AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix")
8 else
9         AC_DEFINE_UNQUOTED(BBSDIR, "$prefix")
10 fi
11
12 AC_ARG_ENABLE(autologin, [  --disable-autologin     disable autologin (default is enabled if possible)])
13
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.
16 TARGETS=client
17
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.
20 AC_CANONICAL_HOST
21 case "$host" in
22         alpha*-dec-osf*)
23                 if test -z "$CC"; then
24                         CC=cc
25                 fi
26                 SERVER_LDFLAGS=-pthread
27                 TARGETS="client server utils serv_modules"
28         ;;
29         *-*-cygwin32)
30                 SUFFIX=.exe
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         case "$host" in
41                 mips*-sgi-irix*)
42                 ;;
43                 *)
44                         SERVER_LDFLAGS=-rdynamic
45                 ;;
46         esac
47         PICFLAGS=-fPIC
48 fi
49 AC_PROG_RANLIB
50 AC_PROG_INSTALL
51 missing_dir=`cd $ac_aux_dir && pwd`
52 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
53
54 dnl Checks for libraries.
55
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
59 dnl done with curses.
60
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)
64
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)
69 fi
70
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)
75 fi
76
77 if test "$ac_cv_func_dlopen" = no; then
78         AC_CHECK_LIB(dl, dlopen)
79 fi
80
81 AC_CHECK_LIB(gdbm, gdbm_open)
82 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
83
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"])
92 fi
93
94 dnl Checks for header files.
95 AC_HEADER_DIRENT
96 AC_HEADER_STDC
97 AC_HEADER_SYS_WAIT
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)
99
100 dnl Checks for typedefs, structures, and compiler characteristics.
101 AC_C_CONST
102 AC_TYPE_PID_T
103 AC_TYPE_SIZE_T
104 AC_HEADER_TIME
105 AC_STRUCT_TM
106
107 dnl Checks for library functions.
108 AC_FUNC_GETPGRP
109 AC_PROG_GCC_TRADITIONAL
110 AC_TYPE_SIGNAL
111 AC_FUNC_VPRINTF
112 AC_CHECK_FUNCS(mkdir mkfifo mktime rmdir select socket strerror)
113 AC_REPLACE_FUNCS(snprintf getutline)
114
115 dnl Done! Now write the Makefile and sysdep.h
116 AC_SUBST(CURSES)
117 AC_SUBST(TARGETS)
118 AC_SUBST(SERVER_LDFLAGS)
119 AC_SUBST(PICFLAGS)
120 AC_SUBST(SUFFIX)
121 AC_CONFIG_HEADER(sysdep.h)
122 AC_OUTPUT(Makefile weekly)