1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([Citadel], [7.37], [http://www.citadel.org/])
5 AC_REVISION([$Revision: 5108 $])
6 AC_CONFIG_SRCDIR([citserver.c])
7 AC_PREFIX_DEFAULT(/usr/local/citadel)
8 if test "$prefix" = NONE; then
9 AC_DEFINE_UNQUOTED(CTDLDIR, "$ac_default_prefix", [define this to the Citadel home directory])
10 ssl_dir="$ac_default_prefix/keys"
12 AC_DEFINE_UNQUOTED(CTDLDIR, "$prefix", [define this to the Citadel home directory])
13 ssl_dir="$prefix/keys"
16 dnl Make sure we see all GNU and Solaris extensions.
20 dnl Checks for the Datadir
22 [ --with-datadir directory to store the databases under],
23 [ if test "x$withval" != "xno" ; then
24 AC_DEFINE(HAVE_DATA_DIR,[],[use alternate database location?])
25 AC_DEFINE_UNQUOTED(DATA_DIR, "$withval",[define, if the user suplied a data-directory to use.])
26 MAKE_DATA_DIR=$withval
27 AC_SUBST(MAKE_DATA_DIR)
32 dnl Checks for the Datadir
33 AC_ARG_WITH(staticdatadir,
34 [ --with-staticdatadir directory to store citadels system messages under],
35 [ if test "x$withval" != "xno" ; then
36 AC_DEFINE(HAVE_STATICDATA_DIR, [], [should we activate an alternate static text location?])
37 AC_DEFINE_UNQUOTED(STATICDATA_DIR, "$withval", [where do we put our static text data?])
38 MAKE_STATICDATA_DIR=$withval
39 AC_SUBST(MAKE_STATICDATA_DIR)
45 dnl Checks for the SSLdir
46 dnl this is a bit different than the rest,
47 dnl because of the citadel used to have a keys/ subdir.
49 [ --with-ssldir directory to store the ssl certificates under],
50 [ if test "x$withval" != "xno" ; then
54 AC_SUBST(MAKE_SSL_DIR)
57 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
60 dnl Checks for the spooldir
62 [ --with-spooldir directory to keep queues under],
63 [ if test "x$withval" != "xno" ; then
64 AC_DEFINE(HAVE_SPOOL_DIR, [], [enable alternate spool dir?])
65 AC_DEFINE_UNQUOTED(SPOOL_DIR,"$withval", [where do we place our spool dirs?])
66 MAKE_SPOOL_DIR=$withval
67 AC_SUBST(MAKE_SPOOL_DIR)
73 dnl Checks for the Configdir
74 AC_ARG_WITH(sysconfdir,
75 [ --with-sysconfdir directory to store the configs under],
76 [ if test "x$withval" != "xno" ; then
77 AC_DEFINE(HAVE_ETC_DIR, [], [should we search our system config in an alternate place?])
78 AC_DEFINE_UNQUOTED(ETC_DIR, "$withval", [where to search our config files])
80 AC_SUBST(MAKE_ETC_DIR)
85 dnl Checks for where to put our utilities
86 AC_ARG_WITH(utility-bindir,
87 [ --with-utility-bindir directory where to find helper binaries],
88 [ if test "x$withval" != "xno" ; then
89 AC_DEFINE(HAVE_UTILBIN_DIR,[],[should we put our helper binaries to another location?])
90 AC_DEFINE_UNQUOTED(UTILBIN_DIR, "$withval", [were to put our helper programs])
91 MAKE_UTILBIN_DIR=$withval
92 AC_SUBST(MAKE_UTILBIN_DIR)
98 dnl Checks for the run-dir for the sockets
100 [ --with-rundir directory to place runtime files (UDS) to?],
101 [ if test "x$withval" != "xno" ; then
102 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
103 AC_DEFINE_UNQUOTED(RUN_DIR, "$withval", [define, where the config should go in unix style])
104 MAKE_RUN_DIR=$withval
105 AC_SUBST(MAKE_RUN_DIR)
111 dnl Checks for the Pseudo Random Generator sockets TODO: this keeps being default.
112 AC_DEFINE_UNQUOTED(EGD_POOL, "/var/run/egd-pool", [place to keep our pseudo random generator file])
114 [ --with-egdpool the socket from Pseudo Random Generator, defaults to /var/run/egd-pool],
115 [ if test "x$withval" != "xno" ; then
116 AC_DEFINE_UNQUOTED(EGD_POOL, "$withval", [the socket from Pseudo Random Generator])
123 [ --with-docdir where to install the documentation. default: /usr/local/citadel/],
124 [ if test "x$withval" != "xno" ; then
125 MAKE_DOC_DIR=$withval
126 AC_SUBST(MAKE_DOC_DIR)
132 dnl Here is the check for a libc integrated iconv
134 [ --disable-iconv do not use iconv charset conversion],
135 ok_iconv=no, ok_iconv=yes)
137 AC_MSG_CHECKING(Checking to see if your system supports iconv)
141 iconv_t ic = (iconv_t)(-1) ;
142 ic = iconv_open("UTF-8", "us-ascii");
157 dnl Check for iconv in external libiconv
158 if test "$ok_iconv" = no; then
159 AC_MSG_CHECKING(Checking for an external libiconv)
160 OLD_LDFLAGS="$LDFLAGS"
161 LDFLAGS="$LDFLAGS -liconv"
165 iconv_t ic = (iconv_t)(-1) ;
166 ic = iconv_open("UTF-8", "us-ascii");
176 LDFLAGS="$OLD_LDFLAGS"
181 if test "$ok_iconv" != "no"; then
182 AC_MSG_RESULT(WebCit will be built with character set conversion.)
183 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
185 AC_MSG_RESULT(WebCit will be built without character set conversion.)
188 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
192 AC_ARG_ENABLE(threaded-client, [ --disable-threaded-client
193 disable multithreaded client])
195 AC_ARG_ENABLE(pie, [ --enable-pie build position-independent executables])
197 AC_ARG_WITH(pam, [ --with-pam use PAM if present (see PAM.txt before you try this)])
198 AC_ARG_WITH(kthread, [ --with-kthread use kernel threads (on FreeBSD) (not recommended yet)])
199 AC_ARG_WITH(db, [ --with-db@<:@=DIR@:>@ use Berkeley DB 3.x @<:@DIR=/usr/local/BerkeleyDB.3.@<:@123@:>@@:>@])
201 [ --with-ssl=PATH Specify path to OpenSSL installation ],
203 if test "x$withval" != "xno" ; then
208 AC_ARG_WITH(ncurses, [ --without-ncurses don't use ncurses])
210 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
211 AC_ARG_WITH(with_ldap, [ --with-ldap use OpenLDAP client library])
212 AC_ARG_WITH(with_libdspam, [ --with-libdspam use libdspam mail spam scanning library])
214 if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then
218 test -f /usr/local/lib/libdb.a -o -f /usr/local/lib/libdb.so \
219 -o -f /usr/local/lib/libdb4.a -o -f /usr/local/lib/libdb4.so \
222 test -d /usr/local/BerkeleyDB.4.1 && db_dir=/usr/local/BerkeleyDB.4.1
223 test -d /usr/local/BerkeleyDB.4.2 && db_dir=/usr/local/BerkeleyDB.4.2
224 test -d /usr/local/BerkeleyDB.4.3 && db_dir=/usr/local/BerkeleyDB.4.3
225 test -d /usr/local/BerkeleyDB.4.4 && db_dir=/usr/local/BerkeleyDB.4.4
226 test -d /usr/local/BerkeleyDB.4.5 && db_dir=/usr/local/BerkeleyDB.4.5
229 dnl By default, we only build the client (citadel and whobbs) unless we can
230 dnl figure out how to build with POSIX threads.
234 PTHREAD_DEFS=-D_REENTRANT
235 AC_MSG_CHECKING([how to compile with POSIX threads])
237 dnl BSDI 3.0 wants relocatable object modules instead of shared libs
238 dnl for dlopen(), and has a wrapper script to link with shared libs.
239 dnl Also has stupid non-reentrant gethostbyaddr() and friends.
241 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
242 AC_DEFINE(HAVE_NONREENTRANT_NETDB,[], [define this if the OS has broken non-reentrant gethostby{name,addr}() ])
243 AC_MSG_RESULT([Old BSDI])
246 AC_DEFINE(HAVE_NONREENTRANT_NETDB, [], [define this if the OS has broken non-reentrant gethostby{name,addr}() ])
247 AC_MSG_RESULT([BSD/OS])
249 dnl Curses support on Mac OS X is kind of screwed at the moment.
250 dnl TCP buffering isn't ideal under OS X. This define should also be
251 dnl checked in other cases of OS X-Linux differences.
253 AC_DEFINE(DISABLE_CURSES,[],[define this to disable use of curses])
254 AC_DEFINE(HAVE_DARWIN, [], [define if using OS X/Darwin])
255 AC_MSG_RESULT([Mac OS X])
257 dnl Digital Unix has an odd way to build for pthreads, and we can't
258 dnl build pthreads programs with gcc due to header problems.
260 test -z "$CC" && CC=cc
261 LIBS="-lpthread -lexc $LIBS"
263 AC_MSG_RESULT([Tru64 or Digital UNIX])
265 dnl FreeBSD is similar to Digital UNIX with DEC C, which has a -pthread flag:
267 if test "$with_kthread" = yes; then
268 LIBS="-kthread $LIBS"
270 LIBS="-pthread $LIBS"
273 PTHREAD_DEFS=-D_THREAD_SAFE
274 AC_MSG_RESULT([FreeBSD])
277 LIBS="-pthread $LIBS"
279 PTHREAD_DEFS=-pthread
280 AC_MSG_RESULT([OpenBSD])
283 PTHREAD_DEFS="-D_REENTRANT -pthread"
284 AC_MSG_RESULT([Linux])
287 PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS"
288 AC_MSG_RESULT([Solaris])
291 SERVER_LDFLAGS="-Wl,-subsystem,windows"
292 AC_MSG_RESULT([Cygwin])
295 AC_MSG_RESULT([default])
298 dnl DEFS="$DEFS $PTHREAD_DEFS"
301 dnl Checks for programs.
306 dnl Set up system-dependent compiler flags.
307 if test "$GCC" = yes; then
308 if test "$CC" = icc; then
312 *-*-solaris*|alpha*-dec-osf*)
313 CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wno-char-subscripts $PTHREAD_DEFS"
316 CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes $PTHREAD_DEFS"
322 if test "x$enable_pie" = xyes; then
323 save_CFLAGS="$CFLAGS"
324 save_LDFLAGS="$LDFLAGS"
325 CFLAGS="$CFLAGS -fpie"
326 LDFLAGS="$LDFLAGS -pie -fpie"
327 AC_CACHE_CHECK([whether compiler accepts -pie -fpie], ac_cv_pie_fpie,
329 ac_cv_pie_fpie=yes, ac_cv_pie_fpie=no)])
330 if test $ac_cv_pie_fpie = no; then
331 CFLAGS="$save_CFLAGS"
332 LDFLAGS="$save_LDFLAGS"
336 AC_MSG_CHECKING([how to create dependancy checks])
337 if test -n "`$CC -V 2>&1 |grep Sun`"; then
342 AC_SUBST(DEPEND_FLAG)
347 missing_dir=`cd $ac_aux_dir && pwd`
348 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
349 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
351 dnl Checks for system services.
353 dnl Check the size of various builtin types; see typesize.h (error)
354 AC_CHECK_SIZEOF(char, 0)
355 AC_CHECK_SIZEOF(short, 0)
356 AC_CHECK_SIZEOF(int, 0)
357 AC_CHECK_SIZEOF(long, 0)
358 AC_CHECK_SIZEOF(size_t, 0)
359 dnl AC_CHECK_SIZEOF(long long, 0)
361 dnl Checks for libraries.
363 dnl We want to test for the following in libc before checking for their
364 dnl respective libraries, because some systems (like Irix) have both, and the
365 dnl non-libc versions may be broken.
366 AC_CHECK_FUNCS(crypt gethostbyname connect flock getpwnam_r getpwuid_r)
369 dnl disable backtrace if we don't want it.
370 AC_ARG_WITH(backtrace,
371 [ --with-backtrace enable backtrace dumps in the syslog],
372 [ if test "x$withval" != "xno" ; then
373 CFLAGS="$CFLAGS -rdynamic "
374 LDFLAGS="$LDFLAGS -rdynamic "
375 SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic "
376 AC_CHECK_FUNCS(backtrace)
381 dnl disable backtrace if we don't want it.
383 [ --with-gprof enable profiling],
384 [ if test "x$withval" != "xno" ; then
385 CFLAGS="$CFLAGS -pg "
386 LDFLAGS="$LDFLAGS -pg "
387 SERVER_LDFLAGS="$SERVER_LDFLAGS -pg "
392 dnl disable thread table reporting
393 AC_ARG_WITH(threadlog,
394 [ --with-threadlog enable logging of thread table],
395 [ if test "x$withval" != "xno" ; then
396 AC_DEFINE(WITH_THREADLOG, [], [Define if you want logging of the thread tables.])
402 if test "$ac_cv_func_gethostbyname" = no; then
403 AC_CHECK_LIB(nsl, gethostbyname)
406 if test "$ac_cv_func_connect" = no; then
407 AC_CHECK_LIB(socket, connect)
410 dnl Check for Solaris realtime support
411 AC_CHECK_LIB(rt, sched_yield)
413 dnl Determine the system's authentication capabilities.
414 dnl We currently support PAM, standard getpwnam(), and getspnam()
415 dnl (Linux shadow passwords)
417 if test "$with_pam" = yes; then
419 AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS"
421 AC_CHECK_FUNCS(pam_start)
422 test "$enable_chkpwd" != no && LIBS=$save_LIBS
424 if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then
426 AC_SEARCH_LIBS(getspnam, shadow, [
427 if test "$ac_cv_search_getspnam" = -lshadow; then
428 chkpwd_LIBS="-lshadow $chkpwd_LIBS"
430 test "$enable_chkpwd" != no && LIBS=$save_LIBS
431 if test "$ac_cv_func_crypt" = no; then
432 AC_CHECK_LIB(crypt, crypt, [
433 chkpwd_LIBS="-lcrypt $chkpwd_LIBS"
434 test "$enable_chkpwd" = no && \
435 LIBS="-lcrypt $LIBS"])
439 if test "x$with_ncurses" != "xno"; then
440 AC_SEARCH_LIBS(tgetent, [ncurses curses termcap])
441 AC_SEARCH_LIBS(scrollok, [ncurses curses])
442 AC_SEARCH_LIBS(initscr, [ncurses curses])
444 AC_SEARCH_LIBS(tgetent, [curses termcap])
445 AC_SEARCH_LIBS(initscr, [curses])
447 AC_CHECK_FUNCS(vw_printw wcolor_set resizeterm wresize)
449 dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On
450 dnl which the -pthread flag takes care of this.)
451 if test "$check_pthread" != no; then
452 AC_CHECK_LIB(pthread, pthread_create)
453 AC_CHECK_LIB(pthreads, pthread_create)
456 test -d /usr/kerberos/include && CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
459 dnl Check for libcitadel
460 AC_CHECK_HEADER(libcitadel.h,
461 [AC_CHECK_LIB(citadel, libcitadel_version_string,
463 LIBS="-lcitadel $LIBS"
466 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
471 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
478 # The big search for OpenSSL
479 if test "$with_ssl" != "no"; then
481 saved_LDFLAGS="$LDFLAGS"
482 saved_CFLAGS="$CFLAGS"
483 if test "x$prefix" != "xNONE"; then
484 tryssldir="$tryssldir $prefix"
486 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
487 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
488 CFLAGS="$saved_CFLAGS"
489 LDFLAGS="$saved_LDFLAGS"
490 LIBS="$saved_LIBS -lssl -lcrypto"
492 # Skip directories if they don't exist
493 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
496 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
497 # Try to use $ssldir/lib if it exists, otherwise
499 if test -d "$ssldir/lib" ; then
500 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
501 if test ! -z "$need_dash_r" ; then
502 LDFLAGS="-R$ssldir/lib $LDFLAGS"
505 LDFLAGS="-L$ssldir $saved_LDFLAGS"
506 if test ! -z "$need_dash_r" ; then
507 LDFLAGS="-R$ssldir $LDFLAGS"
510 # Try to use $ssldir/include if it exists, otherwise
512 if test -d "$ssldir/include" ; then
513 CFLAGS="-I$ssldir/include $saved_CFLAGS"
515 CFLAGS="-I$ssldir $saved_CFLAGS"
519 # Basic test to check for compatible version and correct linking
520 # *does not* test for RSA - that comes later.
524 #include <openssl/rand.h>
528 memset(a, 0, sizeof(a));
529 RAND_add(a, sizeof(a), sizeof(a));
530 return(RAND_status() <= 0);
539 if test ! -z "$found_crypto" ; then
544 if test -z "$ssldir" ; then
548 if test ! -z "$found_crypto" ; then
549 ac_cv_openssldir=$ssldir
551 ac_cv_openssldir="no"
555 LDFLAGS="$saved_LDFLAGS"
556 CFLAGS="$saved_CFLAGS"
558 if test "x$ac_cv_openssldir" != "xno" ; then
559 AC_DEFINE(HAVE_OPENSSL, [], [Define if you have OpenSSL.])
560 LIBS="-lssl -lcrypto $LIBS"
561 dnl Need to recover ssldir - test above runs in subshell
562 ssldir=$ac_cv_openssldir
563 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
564 # Try to use $ssldir/lib if it exists, otherwise
566 if test -d "$ssldir/lib" ; then
567 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
568 if test ! -z "$need_dash_r" ; then
569 LDFLAGS="-R$ssldir/lib $LDFLAGS"
572 LDFLAGS="-L$ssldir $saved_LDFLAGS"
573 if test ! -z "$need_dash_r" ; then
574 LDFLAGS="-R$ssldir $LDFLAGS"
577 # Try to use $ssldir/include if it exists, otherwise
579 if test -d "$ssldir/include" ; then
580 CFLAGS="-I$ssldir/include $saved_CFLAGS"
582 CFLAGS="-I$ssldir $saved_CFLAGS"
588 if test "x$with_db" != xno; then
589 test "$db_dir" && LDFLAGS="$LDFLAGS -L$db_dir/lib"
593 if test -d "$db_dir/include/db4"; then
594 CPPFLAGS="$CPPFLAGS -I$db_dir/include/db4"
596 elif test "$db_dir"; then
597 CPPFLAGS="$CPPFLAGS -I$db_dir/include"
598 elif test -d /usr/include/db4; then
599 CPPFLAGS="$CPPFLAGS -I/usr/include/db4"
604 AC_CHECK_DB([db db-4.1 db-4 db4],
608 AC_MSG_ERROR([[Can not locate a suitable Berkeley DB
609 library. Use --with-db=PATH to specify
614 dnl Checks for the zlib compression library.
615 if test "x$with_zlib" != xno ; then
616 AC_CHECK_HEADERS(zlib.h,
617 [AC_CHECK_LIB(z, zlibVersion,
622 if test "x$ok_zlib" = xyes ; then
623 SERVER_LIBS="-lz $SERVER_LIBS"
624 AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
630 dnl Checks for the OpenLDAP client library.
631 if test "x$with_ldap" != xno ; then
632 AC_CHECK_HEADERS(ldap.h,
633 [AC_CHECK_LIB(ldap, ldap_init,
638 if test "x$ok_ldap" = xyes ; then
639 SERVER_LIBS="-lldap $SERVER_LIBS"
640 AC_DEFINE(HAVE_LDAP, [], [define this if you have OpenLDAP client available])
647 dnl Checks for the libdspam mail spam scanning library.
648 if test "x$with_libdspam" != xno ; then
649 AC_CHECK_HEADERS(dspam/libdspam.h,
650 [AC_CHECK_LIB(dspam, dspam_init,
655 if test "x$ok_libdspam" = xyes ; then
656 SERVER_LIBS="-ldspam $SERVER_LIBS"
657 AC_DEFINE(HAVE_LIBDSPAM, [], [define this if you have the libdspam mail spam scanning library available])
662 dnl Checks for the Expat XML parser.
663 AC_CHECK_HEADER(expat.h,
664 [AC_CHECK_LIB(expat, XML_ParserCreateNS,
666 SERVER_LIBS="-lexpat $SERVER_LIBS"
669 AC_MSG_ERROR(The Expat XML parser was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
674 AC_MSG_ERROR(expat.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
684 dnl Checks for libcurl.
685 AC_CHECK_HEADER(curl/curl.h,
686 [AC_CHECK_LIB(curl, curl_version,
688 SERVER_LIBS="-lcurl $SERVER_LIBS"
691 AC_MSG_ERROR(libcurl was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
696 AC_MSG_ERROR(curl/curl.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
706 dnl Checks for the libical iCalendar library.
707 AC_CHECK_HEADER(libical/ical.h,
708 [AC_CHECK_LIB(ical, icalcomponent_new,
710 SERVER_LIBS="-lical $SERVER_LIBS"
713 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
718 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
723 dnl Checks for the libsieve mailbox sorting library.
724 AC_CHECK_HEADER(sieve2.h,
725 [AC_CHECK_LIB(sieve, sieve2_license,
727 SERVER_LIBS="-lsieve $SERVER_LIBS"
730 AC_MSG_ERROR(libsieve was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
735 AC_MSG_ERROR(sieve2.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
742 dnl Checks for header files.
748 dnl TODO: for the DB header checks, we should check whether the headers
749 dnl define db_env_create, somehow
751 AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.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)
754 dnl need to check if this is actually compilable, sometimes there are
755 dnl conflicts with the system's headers (eg solaris xpg4 style headers)
757 if test "x$with_ncurses" != xno; then
758 AC_CHECK_HEADERS(ncurses.h,,,[ ])
761 AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H, [], [define this if you have the resolv.h header file.]),,
762 [#ifdef HAVE_SYS_TYPES_H
763 #include <sys/types.h>
765 #ifdef HAVE_NETINET_IN_H
766 #include <netinet/in.h>
768 #ifdef HAVE_ARPA_NAMESER_H
769 #include <arpa/nameser.h>
773 dnl Checks for typedefs, structures, and compiler characteristics.
779 dnl defined in acinclude.m4:
782 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
783 [AC_TRY_COMPILE([#include <sys/types.h>
784 #include <utmp.h>], [struct utmp ut; ut.ut_type;],
785 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
786 if test $ac_cv_struct_ut_type = yes; then
787 AC_DEFINE(HAVE_UT_TYPE, [], [define this if struct utmp has an ut_type member])
791 [for call semantics from getpwuid_r],
792 ac_cv_call_getpwuid_r,
793 [AC_TRY_COMPILE([#include <sys/types.h>
796 struct passwd pw, *pwp;
800 getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp);
802 ac_cv_call_getpwuid_r=yes,
803 ac_cv_call_getpwuid_r=no)
806 if test $ac_cv_call_getpwuid_r = no; then
807 AC_DEFINE(SOLARIS_GETPWUID,[],[do we need to use solaris call syntax?])
808 AC_DEFINE(F_UID_T, "%ld", [whats the matching format string for uid_t?])
809 AC_DEFINE(F_PID_T, "%ld", [whats the matching format string for pid_t?])
810 AC_DEFINE(F_XPID_T, "%lx", [whats the matching format string for xpid_t?])
812 AC_DEFINE(F_UID_T, "%d", [whats the matching format string for uid_t?])
813 AC_DEFINE(F_PID_T, "%d", [whats the matching format string for pid_t?])
814 AC_DEFINE(F_XPID_T, "%x", [whats the matching format string for xpid_t?])
818 dnl Our own happy little check for the resolver library.
822 echo "we don't need to check for resolv on openbsd"
825 echo "we don't need to check for resolv on freeBSD"
828 test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
829 AC_CHECK_LIB(resolv, res_query,
830 RESOLV="$RESOLV -lresolv",
831 [dnl Have to include resolv.h as res_query is sometimes defined as a macro
832 AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
834 LIBS="-lresolv $LIBS"
839 [res_query(0,0,0,0,0)],
843 AC_MSG_ERROR(libresolv was not found. Citadel requires the resolver library.)
852 AC_CACHE_CHECK([for ut_host in struct utmp], ac_cv_struct_ut_host,
853 [AC_TRY_COMPILE([#include <sys/types.h>
854 #include <utmp.h>], [struct utmp ut; ut.ut_host;],
855 ac_cv_struct_ut_host=yes, ac_cv_struct_ut_host=no)])
856 if test $ac_cv_struct_ut_host = yes; then
857 AC_DEFINE(HAVE_UT_HOST, [], [define this if struct utmp has an ut_host member])
860 dnl Checks for library functions.
862 AC_PROG_GCC_TRADITIONAL
865 AC_CHECK_FUNCS(getspnam getutxline mkdir mkfifo mktime rmdir select socket strerror strcasecmp strncasecmp)
867 dnl Now check for pthreads
869 dnl On some platforms, AC_CHECK_FUNC[S] doesn't work for pthreads programs;
870 dnl we need to include pthread.h
872 AC_CACHE_CHECK([for pthread_cancel], ac_cv_func_pthread_cancel,
873 [AC_TRY_LINK([#include <pthread.h>],
876 /* The GNU C library defines this for functions which it implements
877 to always fail with ENOSYS. Some functions are actually named
878 something starting with __ and the normal name is an alias. */
879 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
882 pthread_cancel(thread);
884 ac_cv_func_pthread_cancel=yes, ac_cv_func_pthread_cancel=no)])
885 if test "$ac_cv_func_pthread_cancel" = yes; then
886 AC_DEFINE(HAVE_PTHREAD_CANCEL, [], [define this if you have the pthread_cancel() function])
889 AC_CACHE_CHECK([for pthread_create], ac_cv_func_pthread_create,
890 [AC_TRY_LINK([#include <pthread.h>],
891 [ /* The GNU C library defines this for functions which it implements
892 to always fail with ENOSYS. Some functions are actually named
893 something starting with __ and the normal name is an alias. */
894 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
897 pthread_create(NULL, NULL, NULL, NULL);
899 ac_cv_func_pthread_create=yes, ac_cv_func_pthread_create=no)])
900 if test "$ac_cv_func_pthread_create" = yes; then
901 test "$DATABASE" && TARGETS="client server utils"
902 if test "x$enable_threaded_client" != xno; then
903 AC_DEFINE(THREADED_CLIENT, [], [define this if you want to enable the multithreaded client])
907 AC_REPLACE_FUNCS(snprintf getutline)
909 AC_CACHE_CHECK([the weather], ac_cv_weather, [
911 echo $ECHO_N "opening your window... $ECHO_C" >&6
913 month=`date | cut -f 2 -d ' '`
916 ac_cv_weather="it's cold!"
919 ac_cv_weather="it's wet!"
922 ac_cv_weather="it's hot!"
925 ac_cv_weather="it's cool"
928 ac_cv_weather="it's fine"
936 AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [
937 number=`date | cut -c 19`
940 ac_cv_under_the_bed="lunatics and monsters found"
943 ac_cv_under_the_bed="dust bunnies found"
948 dnl Done! Now write the Makefile and sysdep.h
951 AC_SUBST(chkpwd_LIBS)
954 AC_SUBST(SERVER_LDFLAGS)
955 AC_SUBST(SERVER_LIBS)
957 AC_CONFIG_HEADER(sysdep.h)
959 AC_CONFIG_FILES([Makefile])
960 AC_OUTPUT(database_cleanup.sh)
963 if test -z "$DATABASE"; then
964 AC_MSG_WARN([No database driver was found. Please install Berkeley DB.])
967 echo ------------------------------------------------------------------------
968 echo 'zlib compression: ' $ok_zlib
969 echo 'LDAP support: ' $ok_ldap
970 echo 'Character set conversion support:' $ok_iconv
971 echo 'DSpam Scanning support: ' $ok_libdspam
973 echo 'Note: if you are not using Linux, make sure you are using GNU make'
974 echo '(gmake) to compile Citadel.'