]> code.citadel.org Git - citadel.git/blob - citadel/configure.in
irix fixen
[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 esac
30
31 dnl Checks for programs.
32 AC_PROG_CC
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)
37         case "$host" in
38                 mips*-sgi-irix*)
39                 ;;
40                 *)
41                         SERVER_LDFLAGS=-rdynamic
42                 ;;
43         esac
44         PICFLAGS=-fPIC
45 fi
46 AC_PROG_RANLIB
47 AC_PROG_INSTALL
48 missing_dir=`cd $ac_aux_dir && pwd`
49 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
50
51 dnl Checks for libraries.
52
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
56 dnl done with curses.
57
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)
61
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)
66 fi
67
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)
72 fi
73
74 if test "$ac_cv_func_dlopen" = no; then
75         AC_CHECK_LIB(dl, dlopen)
76 fi
77
78 AC_CHECK_LIB(gdbm, gdbm_open)
79 AC_CHECK_LIB(curses, initscr, CURSES=-lcurses)
80
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"])
89 fi
90
91 dnl Checks for header files.
92 AC_HEADER_DIRENT
93 AC_HEADER_STDC
94 AC_HEADER_SYS_WAIT
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)
96
97 dnl Checks for typedefs, structures, and compiler characteristics.
98 AC_C_CONST
99 AC_TYPE_PID_T
100 AC_TYPE_SIZE_T
101 AC_HEADER_TIME
102 AC_STRUCT_TM
103
104 dnl Checks for library functions.
105 AC_FUNC_GETPGRP
106 AC_PROG_GCC_TRADITIONAL
107 AC_TYPE_SIGNAL
108 AC_FUNC_VPRINTF
109 AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror)
110
111 dnl Tell the Makefile whether we need to use our snprintf() replacement.
112 if test "$ac_cv_func_snprintf" = no; then
113         SNPRINTF=snprintf.o
114 fi
115
116 dnl Done! Now write the Makefile and sysdep.h
117 AC_SUBST(CURSES)
118 AC_SUBST(TARGETS)
119 AC_SUBST(SERVER_LDFLAGS)
120 AC_SUBST(SNPRINTF)
121 AC_SUBST(PICFLAGS)
122 AC_CONFIG_HEADER(sysdep.h)
123 AC_OUTPUT(Makefile weekly)