]> code.citadel.org Git - citadel.git/blob - citadel/configure.in
weekly is now generated by configure
[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 dnl By default, we only build the client (citadel and whobbs) unless we can
14 dnl figure out how to build with POSIX threads.
15 TARGETS=client
16
17 dnl Check for Digital Unix: it has a different way of building for pthreads,
18 dnl and we can't build pthreads programs with gcc due to header problems.
19 AC_CANONICAL_HOST
20 case "$host" in
21         alpha*-dec-osf*)
22                 if test -z "$CC"; then
23                         CC=cc
24                 fi
25                 SERVER_LDFLAGS=-pthread
26                 TARGETS="client server utils serv_modules"
27         ;;
28 esac
29
30 dnl Checks for programs.
31 AC_PROG_CC
32 if test "$GCC" = yes; then
33         CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
34         dnl pass -rdynamic to the linker to enable dlopen() modules to
35         dnl refer to symbols in the main executable (applies to citserver)
36         SERVER_LDFLAGS=-rdynamic
37         PICFLAGS=-fPIC
38 fi
39 AC_PROG_RANLIB
40 AC_PROG_INSTALL
41 missing_dir=`cd $ac_aux_dir && pwd`
42 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
43
44 dnl Checks for libraries.
45
46 dnl libdl, libgdbm, and libcrypt are only used in the server, so the
47 dnl Makefile only passes $(LIBS) to that target. If other programs start
48 dnl requiring additional libraries, we'll have to use other variables, as is
49 dnl done with curses.
50
51 dnl We only need crypt() if we're using autologin. FIXME: implement shadow
52 dnl passwords and/or PAM...
53 if test "$enable_autologin" != no; then
54         AC_CHECK_LIB(crypt, crypt)
55 fi
56
57 AC_CHECK_LIB(dl, dlopen)
58 AC_CHECK_LIB(gdbm, gdbm_open)
59 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
60
61 dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
62 dnl -pthread flag takes care of this.) If we find one of the libraries, then
63 dnl set up the TARGETS variable to build the server as well as the client.
64 if test "$SERVER_LDFLAGS" != -pthread; then
65         AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"
66                 TARGETS="client server utils serv_modules"])
67         AC_CHECK_LIB(pthreads, pthread_create, [LIBS="$LIBS -lpthreads"
68                 TARGETS="client server utils serv_modules"])
69 fi
70
71 dnl Checks for header files.
72 AC_HEADER_DIRENT
73 AC_HEADER_STDC
74 AC_HEADER_SYS_WAIT
75 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)
76
77 dnl Checks for typedefs, structures, and compiler characteristics.
78 AC_C_CONST
79 AC_TYPE_PID_T
80 AC_TYPE_SIZE_T
81 AC_HEADER_TIME
82 AC_STRUCT_TM
83
84 dnl Checks for library functions.
85 AC_FUNC_GETPGRP
86 AC_PROG_GCC_TRADITIONAL
87 AC_TYPE_SIGNAL
88 AC_FUNC_VPRINTF
89 AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror)
90
91 dnl Enable autologin if the feature is requested (which is the default) and
92 dnl a crypt() function is available.
93 if test "$enable_autologin" != no; then
94         AC_CHECK_FUNC(crypt, AC_DEFINE(ENABLE_AUTOLOGIN))
95 fi
96
97 dnl Tell the Makefile whether we need to use our snprintf() replacement.
98 if test "$ac_cv_func_snprintf" = no; then
99         SNPRINTF=snprintf.o
100 fi
101
102 dnl Done! Now write the Makefile and sysdep.h
103 AC_SUBST(CURSES)
104 AC_SUBST(TARGETS)
105 AC_SUBST(SERVER_LDFLAGS)
106 AC_SUBST(SNPRINTF)
107 AC_SUBST(PICFLAGS)
108 AC_CONFIG_HEADER(sysdep.h)
109 AC_OUTPUT(Makefile weekly)