* configure.ac: Add CFLAGS for icc Intel Compiler
[citadel.git] / citadel / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id$
3 AC_PREREQ(2.52)
4 AC_INIT([Citadel], [6.15], [http://uncensored.citadel.org/])
5 AC_REVISION([$Revision$])
6 AC_CONFIG_SRCDIR([citserver.c])
7 AC_PREFIX_DEFAULT(/usr/local/citadel)
8 if test "$prefix" = NONE; then
9         AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix")
10 else
11         AC_DEFINE_UNQUOTED(BBSDIR, "$prefix")
12 fi
13
14 AC_ARG_ENABLE(autologin, [  --disable-autologin     disable autologin (default is enabled if possible)])
15 AC_ARG_ENABLE(chkpwd, [  --disable-chkpwd        don't build 'chkpwd'])
16
17 AC_ARG_ENABLE(threaded-client, [  --disable-threaded-client
18                           disable multithreaded client])
19
20 AC_ARG_ENABLE(pie, [  --enable-pie            build position-independent executables])
21
22 AC_ARG_WITH(pam, [  --with-pam              use PAM if present (see PAM.txt before you try this)])
23 AC_ARG_WITH(kthread, [  --with-kthread          use kernel threads (on FreeBSD) (not recommended yet)])
24 AC_ARG_WITH(db, [  --with-db@<:@=DIR@:>@         use Sleepycat DB 3.x @<:@DIR=/usr/local/BerkeleyDB.3.@<:@123@:>@@:>@])
25 AC_ARG_WITH(ssl,
26         [  --with-ssl=PATH     Specify path to OpenSSL installation ],
27         [
28                 if test "x$withval" != "xno" ; then
29                         tryssldir=$withval
30                 fi
31         ]
32 )
33 AC_ARG_WITH(ncurses, [  --without-ncurses       don't use ncurses])
34
35 AC_ARG_WITH(with_zlib, [  --with-zlib             use zlib compression if present])
36 AC_ARG_WITH(with_ldap, [  --with-ldap             use OpenLDAP client library])
37 AC_ARG_WITH(with_libical, [  --with-libical          use libical calendaring library])
38 AC_ARG_WITH(with_newt, [  --with-newt          use newt window library])
39
40 if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then
41         db_dir="$with_db"
42         with_db=yes
43 else
44         test -f /usr/local/lib/libdb.a -o -f /usr/local/lib/libdb.so \
45           -o -f /usr/local/lib/libdb4.a -o -f /usr/local/lib/libdb4.so \
46           && db_dir=/usr/local
47
48         test -d /usr/local/BerkeleyDB.4.1 && db_dir=/usr/local/BerkeleyDB.4.1
49         test -d /usr/local/BerkeleyDB.4.2 && db_dir=/usr/local/BerkeleyDB.4.2
50 fi
51
52 dnl By default, we only build the client (citadel and whobbs) unless we can
53 dnl figure out how to build with POSIX threads.
54 TARGETS=client
55
56 AC_CANONICAL_HOST
57 PTHREAD_DEFS=-D_REENTRANT
58 AC_MSG_CHECKING([how to compile with POSIX threads])
59 case "$host" in
60         dnl BSDI 3.0 wants relocatable object modules instead of shared libs
61         dnl for dlopen(), and has a wrapper script to link with shared libs.
62         dnl Also has stupid non-reentrant gethostbyaddr() and friends.
63         *-*-bsdi[123]*)
64                 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
65                 AC_DEFINE(HAVE_NONREENTRANT_NETDB)
66                 AC_MSG_RESULT([Old BSDI])
67         ;;
68         *-*-bsdi*)
69                 AC_DEFINE(HAVE_NONREENTRANT_NETDB)
70                 AC_MSG_RESULT([BSD/OS])
71         ;;
72         dnl Curses support on Mac OS X is kind of screwed at the moment.
73         *-*-darwin*)
74                 AC_DEFINE(DISABLE_CURSES)
75                 AC_MSG_RESULT([Mac OS X])
76         ;;
77         dnl Digital Unix has an odd way to build for pthreads, and we can't
78         dnl build pthreads programs with gcc due to header problems.
79         alpha*-dec-osf*)
80                 test -z "$CC" && CC=cc
81                 LIBS="-lpthread -lexc $LIBS"
82                 check_pthread=no
83                 AC_MSG_RESULT([Tru64 or Digital UNIX])
84         ;;
85         dnl FreeBSD is similar to Digital UNIX with DEC C, which has a -pthread flag:
86         *-*-freebsd*)
87                 if test "$with_kthread" = yes; then
88                         LIBS="-kthread $LIBS"
89                 else
90                         LIBS="-pthread $LIBS"
91                 fi
92                 check_pthread=no
93                 PTHREAD_DEFS=-D_THREAD_SAFE
94                 AC_MSG_RESULT([FreeBSD])
95         ;;
96         *-*-openbsd*)
97                 LIBS="-pthread $LIBS"
98                 check_pthread=no
99                 PTHREAD_DEFS=-pthread
100                 AC_MSG_RESULT([OpenBSD])
101         ;;
102         *-*-linux*)
103                 PTHREAD_DEFS="-D_REENTRANT -pthread"
104                 AC_MSG_RESULT([Linux])
105         ;;
106         *-*-solaris*)
107                 PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS"
108                 AC_MSG_RESULT([Solaris])
109         ;;
110         *-*-cygwin*)
111                 SERVER_LDFLAGS="-Wl,-subsystem,windows"
112                 AC_MSG_RESULT([Cygwin])
113         ;;
114         *)
115                 AC_MSG_RESULT([default])
116         ;;
117 esac
118 dnl DEFS="$DEFS $PTHREAD_DEFS"
119
120 dnl Checks for programs.
121 AC_PROG_CC
122
123 dnl Set up system-dependent compiler flags.
124 if test "$GCC" = yes; then
125         if test "$CC" = icc; then
126                 CFLAGS="$CFLAGS -w1"
127         else
128                 case "$host" in
129                         *-*-solaris*|alpha*-dec-osf*)
130                                 CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wno-char-subscripts $PTHREAD_DEFS"
131                         ;;
132                         *)
133                         CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes $PTHREAD_DEFS"
134                         ;;
135                 esac
136         fi
137 fi
138
139 if test "x$enable_pie" = xyes; then
140         save_CFLAGS="$CFLAGS"
141         save_LDFLAGS="$LDFLAGS"
142         CFLAGS="$CFLAGS -fpie"
143         LDFLAGS="$LDFLAGS -pie -fpie"
144         AC_CACHE_CHECK([whether compiler accepts -pie -fpie], ac_cv_pie_fpie,
145         [AC_TRY_LINK([], [],
146         ac_cv_pie_fpie=yes, ac_cv_pie_fpie=no)])
147         if test $ac_cv_pie_fpie = no; then
148                 CFLAGS="$save_CFLAGS"
149                 LDFLAGS="$save_LDFLAGS"
150         fi
151 fi
152
153 AC_PROG_INSTALL
154 AC_PROG_YACC
155 missing_dir=`cd $ac_aux_dir && pwd`
156 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
157 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
158
159 dnl Checks for system services.
160
161 dnl Check the size of various builtin types; see typesize.h (error)
162 AC_CHECK_SIZEOF(char, 0)
163 AC_CHECK_SIZEOF(short, 0)
164 AC_CHECK_SIZEOF(int, 0)
165 AC_CHECK_SIZEOF(long, 0)
166 dnl AC_CHECK_SIZEOF(long long, 0)
167
168 dnl Checks for libraries.
169
170 dnl We want to test for the following in libc before checking for their
171 dnl respective libraries, because some systems (like Irix) have both, and the
172 dnl non-libc versions may be broken.
173 AC_CHECK_FUNCS(crypt gethostbyname connect)
174
175 if test "$ac_cv_func_gethostbyname" = no; then
176         AC_CHECK_LIB(nsl, gethostbyname)
177 fi
178
179 if test "$ac_cv_func_connect" = no; then
180         AC_CHECK_LIB(socket, connect)
181 fi
182
183 dnl Check for Solaris realtime support
184 AC_CHECK_LIB(rt, sched_yield)
185
186 dnl Determine the system's authentication capabilities, if autologin is
187 dnl requested. We currently support PAM, standard getpwnam(), and getspnam()
188 dnl (Linux shadow passwords)
189 if test "$enable_autologin" != no; then
190         if test "$with_pam" = yes; then
191                 save_LIBS=$LIBS
192                 AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS"
193                         LIBS="-lpam $LIBS"])
194                 AC_CHECK_FUNCS(pam_start)
195                 test "$enable_chkpwd" != no && LIBS=$save_LIBS
196         fi
197         if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then
198                 save_LIBS=$LIBS
199                 AC_SEARCH_LIBS(getspnam, shadow, [
200                         if test "$ac_cv_search_getspnam" = -lshadow; then
201                                 chkpwd_LIBS="-lshadow $chkpwd_LIBS"
202                         fi])
203                 test "$enable_chkpwd" != no && LIBS=$save_LIBS
204                 if test "$ac_cv_func_crypt" = no; then
205                         AC_CHECK_LIB(crypt, crypt, [
206                                 chkpwd_LIBS="-lcrypt $chkpwd_LIBS"
207                                 test "$enable_chkpwd" = no && \
208                                         LIBS="-lcrypt $LIBS"])
209                 fi
210         fi
211         if test "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes -o "$ac_cv_func_pam_start" = yes; then
212                 AC_DEFINE(ENABLE_AUTOLOGIN)
213                 if test "$enable_chkpwd" != no; then
214                         AC_DEFINE(ENABLE_CHKPWD)
215                         CHKPWD=chkpwd
216                 else
217                         AUTH=auth.lo
218                 fi
219         fi
220 fi
221
222 test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
223 AC_CHECK_LIB(resolv, res_query, RESOLV="$RESOLV -lresolv")
224
225 if test "x$with_ncurses" != "xno"; then
226         AC_SEARCH_LIBS(tgetent, [ncurses curses termcap])
227         AC_SEARCH_LIBS(scrollok, [ncurses curses])
228         AC_SEARCH_LIBS(initscr, [ncurses curses])
229 else
230         AC_SEARCH_LIBS(tgetent, [curses termcap])
231         AC_SEARCH_LIBS(initscr, [curses])
232 fi
233 AC_CHECK_FUNCS(vw_printw wcolor_set resizeterm wresize)
234
235 dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On
236 dnl which the -pthread flag takes care of this.)
237 if test "$check_pthread" != no; then
238         AC_CHECK_LIB(pthread, pthread_create)
239         AC_CHECK_LIB(pthreads, pthread_create)
240 fi
241
242 test -d /usr/kerberos/include && CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
243
244 # The big search for OpenSSL
245 if test "$with_ssl" != "no"; then
246         saved_LIBS="$LIBS"
247         saved_LDFLAGS="$LDFLAGS"
248         saved_CFLAGS="$CFLAGS"
249         if test "x$prefix" != "xNONE"; then
250                 tryssldir="$tryssldir $prefix"
251         fi
252         AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
253                 for ssldir in $tryssldir "" /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
254                         CFLAGS="$saved_CFLAGS"
255                         LDFLAGS="$saved_LDFLAGS"
256                         LIBS="$saved_LIBS -lssl -lcrypto"
257         
258                         # Skip directories if they don't exist
259                         if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
260                                 continue;
261                         fi
262                         if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
263                                 # Try to use $ssldir/lib if it exists, otherwise
264                                 # $ssldir
265                                 if test -d "$ssldir/lib" ; then
266                                         LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
267                                         if test ! -z "$need_dash_r" ; then
268                                                 LDFLAGS="-R$ssldir/lib $LDFLAGS"
269                                         fi
270                                 else
271                                         LDFLAGS="-L$ssldir $saved_LDFLAGS"
272                                         if test ! -z "$need_dash_r" ; then
273                                                 LDFLAGS="-R$ssldir $LDFLAGS"
274                                         fi
275                                 fi
276                                 # Try to use $ssldir/include if it exists, otherwise
277                                 # $ssldir
278                                 if test -d "$ssldir/include" ; then
279                                         CFLAGS="-I$ssldir/include $saved_CFLAGS"
280                                 else
281                                         CFLAGS="-I$ssldir $saved_CFLAGS"
282                                 fi
283                         fi
284         
285                         # Basic test to check for compatible version and correct linking
286                         # *does not* test for RSA - that comes later.
287                         AC_TRY_RUN(
288                                 [
289         #include <string.h>
290         #include <openssl/rand.h>
291         int main(void)
292         {
293                 char a[2048];
294                 memset(a, 0, sizeof(a));
295                 RAND_add(a, sizeof(a), sizeof(a));
296                 return(RAND_status() <= 0);
297         }
298                                 ],
299                                 [
300                                         found_crypto=1
301                                         break;
302                                 ], []
303                         )
304         
305                         if test ! -z "$found_crypto" ; then
306                                 break;
307                         fi
308                 done
309         
310                 if test -z "$ssldir" ; then
311                         ssldir="(system)"
312                 fi
313         
314                 if test ! -z "$found_crypto" ; then
315                         ac_cv_openssldir=$ssldir
316                 else
317                         ac_cv_openssldir="no"
318                 fi
319         ])
320         LIBS="$saved_LIBS"
321         LDFLAGS="$saved_LDFLAGS"
322         CFLAGS="$saved_CFLAGS"
323         
324         if test "x$ac_cv_openssldir" != "xno" ; then
325                 AC_DEFINE(HAVE_OPENSSL)
326                 LIBS="-lssl -lcrypto $LIBS"
327                 dnl Need to recover ssldir - test above runs in subshell
328                 ssldir=$ac_cv_openssldir
329                 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
330                         # Try to use $ssldir/lib if it exists, otherwise
331                         # $ssldir
332                         if test -d "$ssldir/lib" ; then
333                                 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
334                                 if test ! -z "$need_dash_r" ; then
335                                         LDFLAGS="-R$ssldir/lib $LDFLAGS"
336                                 fi
337                         else
338                                 LDFLAGS="-L$ssldir $saved_LDFLAGS"
339                                 if test ! -z "$need_dash_r" ; then
340                                         LDFLAGS="-R$ssldir $LDFLAGS"
341                                 fi
342                         fi
343                         # Try to use $ssldir/include if it exists, otherwise
344                         # $ssldir
345                         if test -d "$ssldir/include" ; then
346                                 CFLAGS="-I$ssldir/include $saved_CFLAGS"
347                         else
348                                 CFLAGS="-I$ssldir $saved_CFLAGS"
349                         fi
350                 fi
351         fi
352 fi
353
354 if test "x$with_db" != xno; then
355         test "$db_dir" && LDFLAGS="$LDFLAGS -L$db_dir/lib"
356
357         dblib=""
358
359         if test -d "$db_dir/include/db4"; then
360                 CPPFLAGS="$CPPFLAGS -I$db_dir/include/db4"
361                 dblib="db4"
362         elif test "$db_dir"; then
363                 CPPFLAGS="$CPPFLAGS -I$db_dir/include"
364         elif test -d /usr/include/db4; then
365                 CPPFLAGS="$CPPFLAGS -I/usr/include/db4"
366                 dblib="db4"
367         fi
368
369
370         AC_CHECK_DB([db db-4.1 db-4 db4],
371                     [
372                      DATABASE=database_sleepycat.c
373                     ],
374                     AC_MSG_ERROR([[Can not locate a suitable Berkeley DB
375                                   library.  Use --with-db=PATH to specify
376                                   the path]]))
377
378 fi
379
380
381 dnl Checks for the zlib compression library.
382 if test "x$with_zlib" != xno ; then
383         AC_CHECK_HEADERS(zlib.h,
384                 [AC_CHECK_LIB(z, zlibVersion,
385                         [ok_zlib=yes],,
386         )])
387 fi
388
389 if test "x$ok_zlib" = xyes ; then
390         SERVER_LIBS="-lz $SERVER_LIBS"
391         AC_DEFINE(HAVE_ZLIB)
392 fi
393
394
395
396
397 dnl Checks for the OpenLDAP client library.
398 if test "x$with_ldap" != xno ; then
399         AC_CHECK_HEADERS(ldap.h,
400                 [AC_CHECK_LIB(ldap, ldap_init,
401                         [ok_ldap=yes],,
402         )])
403 fi
404
405 if test "x$ok_ldap" = xyes ; then
406         SERVER_LIBS="-lldap $SERVER_LIBS"
407         AC_DEFINE(HAVE_LDAP)
408 fi
409
410
411
412
413 dnl Checks for the newt window library.
414 if test "x$with_newt" != xno ; then
415         AC_CHECK_HEADERS(newt.h,
416                 [AC_CHECK_LIB(newt, newtInit,
417                         [ok_newt=yes],,
418         )])
419 fi
420
421 if test "x$ok_newt" = xyes ; then
422         SETUP_LIBS="-lnewt $SETUP_LIBS"
423         AC_DEFINE(HAVE_NEWT)
424 fi
425
426
427
428
429
430
431 dnl Checks for the libical calendaring library.
432 if test "x$with_libical" != xno ; then
433         AC_CHECK_HEADERS(ical.h,
434                 [AC_CHECK_LIB(ical, icalcomponent_new,
435                         [ok_libical=yes],,
436         )])
437 fi
438
439 if test "x$ok_libical" = xyes ; then
440
441         AC_TRY_RUN(
442                 [
443 #include <ical.h>
444 main() {
445         float v;
446         int i;
447         sscanf(ICAL_VERSION, "%f", &v);
448         printf("libical version: %0.2f\n", v);
449         v = v * 100.0;
450         i = (int) v;
451         if (i >= 24) {
452                 printf("This version is ok.\n");
453                 return(0);
454         }
455         printf("libical 0.24 or newer required.\n");
456         printf("Citadel will be built without calendar support.\n");
457         return(1);
458 }
459                 ], 
460                 [
461                         SERVER_LIBS="-lical $SERVER_LIBS"
462                         AC_DEFINE(HAVE_LIBICAL)
463                 ]
464         )
465 fi
466
467
468
469
470 dnl Checks for header files.
471 AC_HEADER_DIRENT
472 AC_HEADER_STDC
473 AC_HEADER_SYS_WAIT
474
475 dnl
476 dnl TODO: for the DB header checks, we should check whether the headers
477 dnl define db_env_create, somehow
478 dnl
479 AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h)
480
481 dnl
482 dnl need to check if this is actually compilable, sometimes there are
483 dnl conflicts with the system's headers (eg solaris xpg4 style headers)
484 dnl
485 if test "x$with_ncurses" != xno; then
486         AC_CHECK_HEADERS(ncurses.h,,,[ ])
487 fi
488
489 AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H),,
490 [#ifdef HAVE_SYS_TYPES_H
491 #include <sys/types.h>
492 #endif
493 #ifdef HAVE_NETINET_IN_H
494 #include <netinet/in.h>
495 #endif
496 #ifdef HAVE_ARPA_NAMESER_H
497 #include <arpa/nameser.h>
498 #endif])
499
500
501 dnl Checks for typedefs, structures, and compiler characteristics.
502 AC_C_CONST
503 AC_TYPE_PID_T
504 AC_TYPE_SIZE_T
505 AC_HEADER_TIME
506
507 dnl defined in acinclude.m4:
508 CIT_STRUCT_TM
509
510 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
511 [AC_TRY_COMPILE([#include <sys/types.h>
512 #include <utmp.h>], [struct utmp ut; ut.ut_type;],
513 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
514 if test $ac_cv_struct_ut_type = yes; then
515         AC_DEFINE(HAVE_UT_TYPE)
516 fi
517
518 AC_CACHE_CHECK([for ut_host in struct utmp], ac_cv_struct_ut_host,
519 [AC_TRY_COMPILE([#include <sys/types.h>
520 #include <utmp.h>], [struct utmp ut; ut.ut_host;],
521 ac_cv_struct_ut_host=yes, ac_cv_struct_ut_host=no)])
522 if test $ac_cv_struct_ut_host = yes; then
523         AC_DEFINE(HAVE_UT_HOST)
524 fi
525
526 dnl Checks for library functions.
527 AC_FUNC_GETPGRP
528 AC_PROG_GCC_TRADITIONAL
529 AC_TYPE_SIGNAL
530 AC_FUNC_VPRINTF
531 AC_CHECK_FUNCS(getspnam getutxline mkdir mkfifo mktime rmdir select socket strerror strcasecmp strncasecmp)
532
533 dnl Now check for pthreads
534
535 dnl On some platforms, AC_CHECK_FUNC[S] doesn't work for pthreads programs;
536 dnl we need to include pthread.h
537
538 AC_CACHE_CHECK([for pthread_cancel], ac_cv_func_pthread_cancel,
539 [AC_TRY_LINK([#include <pthread.h>],
540 [       pthread_t thread;
541
542         /* The GNU C library defines this for functions which it implements
543            to always fail with ENOSYS.  Some functions are actually named
544            something starting with __ and the normal name is an alias.  */
545 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
546         choke me
547 #else
548         pthread_cancel(thread);
549 #endif],
550 ac_cv_func_pthread_cancel=yes, ac_cv_func_pthread_cancel=no)])
551 if test "$ac_cv_func_pthread_cancel" = yes; then
552         AC_DEFINE(HAVE_PTHREAD_CANCEL)
553 fi
554
555 AC_CACHE_CHECK([for pthread_create], ac_cv_func_pthread_create,
556 [AC_TRY_LINK([#include <pthread.h>],
557 [       /* The GNU C library defines this for functions which it implements
558            to always fail with ENOSYS.  Some functions are actually named
559            something starting with __ and the normal name is an alias.  */
560 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
561         choke me
562 #else
563         pthread_create(NULL, NULL, NULL, NULL);
564 #endif],
565 ac_cv_func_pthread_create=yes, ac_cv_func_pthread_create=no)])
566 if test "$ac_cv_func_pthread_create" = yes; then
567         test "$DATABASE" && TARGETS="client server utils"
568         if test "x$enable_threaded_client" != xno; then
569                 AC_DEFINE(THREADED_CLIENT)
570         fi
571 fi
572
573 AC_REPLACE_FUNCS(snprintf getutline)
574
575 # AC_CACHE_CHECK([the weather], ac_cv_weather, [
576 #       sleep 1
577 #       echo $ECHO_N "opening your window... $ECHO_C" >&6
578 #       sleep 2
579 #       month=`date | cut -f 2 -d ' '`
580 #       case $month in
581 #       Dec | Jan | Feb)
582 #               ac_cv_weather="it's cold!"
583 #               ;;
584 #       Mar | Apr)
585 #               ac_cv_weather="it's wet!"
586 #               ;;
587 #       Jul | Aug)
588 #               ac_cv_weather="it's hot!"
589 #               ;;
590 #       Oct | Nov)
591 #               ac_cv_weather="it's cool"
592 #               ;;
593 #       May | Jun | Sep | *)
594 #               ac_cv_weather="it's fine"
595 #               ;;
596 #       esac
597 #       ])
598
599 AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [
600         number=`date | cut -c 19`
601         case $number in
602         7)
603                 ac_cv_under_the_bed="lunatics and monsters found"
604                 ;;
605         *)
606                 ac_cv_under_the_bed="dust bunnies found"
607                 ;;
608         esac
609         ])
610
611 dnl Done! Now write the Makefile and sysdep.h
612 AC_SUBST(AUTH)
613 AC_SUBST(CHKPWD)
614 AC_SUBST(RESOLV)
615 AC_SUBST(chkpwd_LIBS)
616 AC_SUBST(TARGETS)
617 AC_SUBST(DATABASE)
618 AC_SUBST(SERVER_LDFLAGS)
619 AC_SUBST(SERVER_LIBS)
620 AC_SUBST(SETUP_LIBS)
621 AC_CONFIG_HEADER(sysdep.h)
622 AC_CONFIG_FILES([Makefile])
623 AC_OUTPUT
624
625 if test -z "$DATABASE"; then
626         AC_MSG_WARN([No database driver was found. Please install Berkeley DB.])
627 fi
628
629 echo ...
630 echo ...
631 echo "... On many operating systems, you must use GNU make (gmake) to compile"
632 echo ... Citadel.
633 echo ...
634 echo ...