1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([Citadel],m4_esyscmd_s([grep REV_LEVEL citadel.h | sed 's/[^0-9]*//g']),[http://uncensored.citadel.org])
6 AC_REVISION(m4_esyscmd_s([git log --pretty=%h | head -1]))
8 AC_CONFIG_SRCDIR([citserver.c])
9 AC_CONFIG_HEADER([sysdep.h])
10 AC_CONFIG_MACRO_DIR([m4])
11 AC_PREFIX_DEFAULT(/usr/local/citadel)
12 if test "$prefix" = NONE; then
13 AC_DEFINE_UNQUOTED(CTDLDIR, "$ac_default_prefix", [define this to the Citadel home directory])
14 ssl_dir="$ac_default_prefix/keys"
15 localedir=$ac_default_prefix
17 AC_DEFINE_UNQUOTED(CTDLDIR, "$prefix", [define this to the Citadel home directory])
18 ssl_dir="$prefix/keys"
22 dnl Make sure we see all GNU and Solaris extensions.
26 dnl Checks for the Datadir
28 [ --with-datadir directory to store the databases under],
29 [ if test "x$withval" != "xno" ; then
30 AC_DEFINE(HAVE_DATA_DIR,[],[use alternate database location?])
31 AC_DEFINE_UNQUOTED(DATA_DIR, "$withval",[define, if the user suplied a data-directory to use.])
32 MAKE_DATA_DIR=$withval
33 AC_SUBST(MAKE_DATA_DIR)
39 dnl Checks for the helpDatadir
41 [ --with-helpdir directory to store the helpfiles under],
42 [ if test "x$withval" != "xno" ; then
43 AC_DEFINE(HAVE_HELP_DIR,[],[use alternate database location?])
44 AC_DEFINE_UNQUOTED(HELP_DIR, "$withval",[define, if the user suplied a helpfile-directory to use.])
45 MAKE_HELP_DIR=$withval
46 AC_SUBST(MAKE_HELP_DIR)
51 dnl Checks for the Static Datadir
52 AC_ARG_WITH(staticdatadir,
53 [ --with-staticdatadir directory to store citadels system messages under],
54 [ if test "x$withval" != "xno" ; then
55 AC_DEFINE(HAVE_STATICDATA_DIR, [], [should we activate an alternate static text location?])
56 AC_DEFINE_UNQUOTED(STATICDATA_DIR, "$withval", [where do we put our static text data?])
57 MAKE_STATICDATA_DIR=$withval
58 AC_SUBST(MAKE_STATICDATA_DIR)
64 dnl Checks for the SSLdir
65 dnl this is a bit different than the rest,
66 dnl because of the citadel used to have a keys/ subdir.
68 [ --with-ssldir directory to store the ssl certificates under],
69 [ if test "x$withval" != "xno" ; then
73 AC_SUBST(MAKE_SSL_DIR)
76 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
79 dnl Checks for the spooldir
81 [ --with-spooldir directory to keep queues under],
82 [ if test "x$withval" != "xno" ; then
83 AC_DEFINE(HAVE_SPOOL_DIR, [], [enable alternate spool dir?])
84 AC_DEFINE_UNQUOTED(SPOOL_DIR,"$withval", [where do we place our spool dirs?])
85 MAKE_SPOOL_DIR=$withval
86 AC_SUBST(MAKE_SPOOL_DIR)
92 dnl Checks for the Configdir
93 AC_ARG_WITH(sysconfdir,
94 [ --with-sysconfdir directory to store the configs under],
95 [ if test "x$withval" != "xno" ; then
96 AC_DEFINE(HAVE_ETC_DIR, [], [should we search our system config in an alternate place?])
97 AC_DEFINE_UNQUOTED(ETC_DIR, "$withval", [where to search our config files])
99 AC_SUBST(MAKE_ETC_DIR)
104 dnl Checks for the Configdir
105 AC_ARG_WITH(autosysconfdir,
106 [ --with-autosysconfdir directory to store the automaticaly maintained configs under],
107 [ if test "x$withval" != "xno" ; then
108 AC_DEFINE(HAVE_AUTO_ETC_DIR, [], [should we search our automatic config in an alternate place?])
109 AC_DEFINE_UNQUOTED(AUTO_ETC_DIR, "$withval", [where to search our automatic config files])
110 MAKE_AUTO_ETC_DIR=$withval
111 AC_SUBST(MAKE_AUTO_ETC_DIR)
116 dnl Checks for where to put our utilities
117 AC_ARG_WITH(utility-bindir,
118 [ --with-utility-bindir directory where to find helper binaries],
119 [ if test "x$withval" != "xno" ; then
120 AC_DEFINE(HAVE_UTILBIN_DIR,[],[should we put our helper binaries to another location?])
121 AC_DEFINE_UNQUOTED(UTILBIN_DIR, "$withval", [were to put our helper programs])
122 MAKE_UTILBIN_DIR=$withval
123 AC_SUBST(MAKE_UTILBIN_DIR)
129 dnl Checks for the run-dir for the sockets
131 [ --with-rundir directory to place runtime files (UDS) to?],
132 [ if test "x$withval" != "xno" ; then
133 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
134 AC_DEFINE_UNQUOTED(RUN_DIR, "$withval", [define, where the config should go in unix style])
135 MAKE_RUN_DIR=$withval
136 AC_SUBST(MAKE_RUN_DIR)
143 [ --with-docdir where to install the documentation. default: /usr/local/citadel/],
144 [ if test "x$withval" != "xno" ; then
145 MAKE_DOC_DIR=$withval
146 AC_SUBST(MAKE_DOC_DIR)
151 dnl where to put the locale files
152 AC_ARG_WITH(localedir,
153 [ --with-localedir directory to put the locale files to],
154 [ if test "x$withval" != "xno" ; then
159 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
165 dnl Checks for the zlib compression library.
166 saved_CFLAGS="$CFLAGS"
167 CFLAGS="$CFLAGS $SERVER_LIBS"
168 AC_CHECK_HEADER(zlib.h,
169 [AC_CHECK_LIB(z, zlibVersion,
171 LIBS="-lz $LIBS $SERVER_LIBS"
174 AC_MSG_ERROR(zlib was not found or is not usable. Please install zlib.)
179 AC_MSG_ERROR(zlib.h was not found or is not usable. Please install zlib.)
182 CFLAGS="$saved_CFLAGS"
184 dnl Here is the check for a libc integrated iconv
186 [ --disable-iconv do not use iconv charset conversion],
187 ok_iconv=no, ok_iconv=yes)
189 AC_MSG_CHECKING(Checking to see if your system supports iconv)
193 iconv_t ic = (iconv_t)(-1) ;
194 ic = iconv_open("UTF-8", "us-ascii");
209 dnl Check for iconv in external libiconv
210 if test "$ok_iconv" = no; then
211 AC_MSG_CHECKING(Checking for an external libiconv)
212 OLD_LDFLAGS="$LDFLAGS"
213 LDFLAGS="$LDFLAGS -liconv"
217 iconv_t ic = (iconv_t)(-1) ;
218 ic = iconv_open("UTF-8", "us-ascii");
228 LDFLAGS="$OLD_LDFLAGS"
234 if test "$ok_iconv" != "no"; then
235 AC_MSG_RESULT(Citadel will be built with character set conversion.)
236 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
238 AC_MSG_RESULT(Citadel will be built without character set conversion.)
241 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
243 AC_ARG_ENABLE(pie, [ --enable-pie build position-independent executables])
245 AC_ARG_WITH(pam, [ --with-pam use PAM if present (see PAM.txt before you try this)])
246 AC_ARG_WITH(kthread, [ --with-kthread use kernel threads (on FreeBSD) (not recommended yet)])
247 AC_ARG_WITH(db, [ --with-db@<:@=DIR@:>@ use Berkeley DB 3.x @<:@DIR=/usr/local/BerkeleyDB.3.@<:@123@:>@@:>@])
249 [ --with-ssl=PATH Specify path to OpenSSL installation ],
251 if test "x$withval" != "xno" ; then
257 if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then
261 test -f /usr/local/lib/libdb.a -o -f /usr/local/lib/libdb.so \
266 PTHREAD_DEFS=-D_REENTRANT
267 AC_MSG_CHECKING([how to compile with POSIX threads])
269 dnl BSDI 3.0 wants relocatable object modules instead of shared libs
270 dnl for dlopen(), and has a wrapper script to link with shared libs.
271 dnl Also has stupid non-reentrant gethostbyaddr() and friends.
273 test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2
274 AC_DEFINE(HAVE_NONREENTRANT_NETDB,[], [define this if the OS has broken non-reentrant gethostby{name,addr}() ])
275 AC_MSG_RESULT([Old BSDI])
278 AC_DEFINE(HAVE_NONREENTRANT_NETDB, [], [define this if the OS has broken non-reentrant gethostby{name,addr}() ])
279 AC_MSG_RESULT([BSD/OS])
281 dnl Curses support on Mac OS X is kind of screwed at the moment.
282 dnl TCP buffering isn't ideal under OS X. This define should also be
283 dnl checked in other cases of OS X-Linux differences.
285 AC_DEFINE(HAVE_DARWIN, [], [define if using OS X/Darwin])
286 AC_MSG_RESULT([Mac OS X])
288 dnl Digital Unix has an odd way to build for pthreads, and we can't
289 dnl build pthreads programs with gcc due to header problems.
291 test -z "$CC" && CC=cc
292 LIBS="-lpthread -lexc $LIBS"
294 AC_MSG_RESULT([Tru64 or Digital UNIX])
296 dnl FreeBSD is similar to Digital UNIX with DEC C, which has a -pthread flag:
298 if test "$with_kthread" = yes; then
299 LIBS="-kthread $LIBS"
301 LIBS="-pthread $LIBS"
304 PTHREAD_DEFS=-D_THREAD_SAFE
305 AC_MSG_RESULT([FreeBSD])
308 LIBS="-pthread $LIBS"
310 PTHREAD_DEFS=-pthread
311 AC_MSG_RESULT([OpenBSD])
314 PTHREAD_DEFS="-D_REENTRANT -pthread"
315 AC_MSG_RESULT([Linux])
318 PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS"
319 AC_MSG_RESULT([Solaris])
322 SERVER_LDFLAGS="-Wl,-subsystem,windows"
323 AC_MSG_RESULT([Cygwin])
326 AC_MSG_RESULT([default])
329 dnl DEFS="$DEFS $PTHREAD_DEFS"
332 dnl Checks for programs.
337 dnl Set up system-dependent compiler flags.
338 if test "$GCC" = yes; then
339 if test "$CC" = icc; then
343 *-*-solaris*|alpha*-dec-osf*)
344 CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wno-char-subscripts $PTHREAD_DEFS"
347 CFLAGS="$CFLAGS -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-strict-aliasing $PTHREAD_DEFS"
353 if test "x$enable_pie" = xyes; then
354 save_CFLAGS="$CFLAGS"
355 save_LDFLAGS="$LDFLAGS"
356 CFLAGS="$CFLAGS -fpie"
357 LDFLAGS="$LDFLAGS -pie -fpie"
358 AC_CACHE_CHECK([whether compiler accepts -pie -fpie], ac_cv_pie_fpie,
360 ac_cv_pie_fpie=yes, ac_cv_pie_fpie=no)])
361 if test $ac_cv_pie_fpie = no; then
362 CFLAGS="$save_CFLAGS"
363 LDFLAGS="$save_LDFLAGS"
367 AC_MSG_CHECKING([how to create dependancy checks])
368 if test -n "`$CC -V 2>&1 |grep Sun`"; then
373 AC_SUBST(DEPEND_FLAG)
378 AC_PATH_PROG(DIFF,diff)
379 AC_PATH_PROG(PATCH,patch)
380 missing_dir=`cd $ac_aux_dir && pwd`
381 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
382 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
384 dnl Checks for system services.
386 dnl Check the size of various builtin types; see typesize.h (error)
387 AC_CHECK_SIZEOF(char, 0)
388 AC_CHECK_SIZEOF(short, 0)
389 AC_CHECK_SIZEOF(int, 0)
390 AC_CHECK_SIZEOF(long, 0)
391 AC_CHECK_SIZEOF(size_t, 0)
392 AC_CHECK_SIZEOF(loff_t, 0)
393 dnl AC_CHECK_SIZEOF(long long, 0)
395 dnl Checks for libraries.
397 dnl We want to test for the following in libc before checking for their
398 dnl respective libraries, because some systems (like Irix) have both, and the
399 dnl non-libc versions may be broken.
400 AC_CHECK_FUNCS(crypt gethostbyname connect getpwnam_r getpwuid_r getloadavg)
402 AC_CHECK_FUNCS(strftime_l uselocale gettext)
404 if test "$ok_nls" != "no"; then
405 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
409 if test "$ok_nls" != "no"; then
410 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
414 if test "$ok_nls" != "no"; then
415 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
419 if test "$ok_nls" != "no"; then
420 AC_MSG_RESULT(citadel will be built with national language support.)
421 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
422 PROG_SUBDIRS="$PROG_SUBDIRS po/citadel-setup"
424 AC_MSG_RESULT(citadel will be built without national language support.)
427 dnl disable backtrace if we don't want it.
428 AC_ARG_WITH(backtrace,
429 [ --with-backtrace enable backtrace dumps in the syslog],
430 [ if test "x$withval" != "xno" ; then
431 CFLAGS="$CFLAGS -rdynamic "
432 LDFLAGS="$LDFLAGS -rdynamic "
433 SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic "
434 AC_CHECK_FUNCS(backtrace)
439 dnl disable backtrace if we don't want it.
441 [ --with-gprof enable profiling],
442 [ if test "x$withval" != "xno" ; then
443 CFLAGS="$CFLAGS -pg "
444 LDFLAGS="$LDFLAGS -pg "
445 SERVER_LDFLAGS="$SERVER_LDFLAGS -pg "
450 if test "$ac_cv_func_gethostbyname" = no; then
451 AC_CHECK_LIB(nsl, gethostbyname)
454 if test "$ac_cv_func_connect" = no; then
455 AC_CHECK_LIB(socket, connect)
458 dnl Check for Solaris realtime support
459 AC_CHECK_LIB(rt, sched_yield)
461 dnl Determine the system's authentication capabilities.
462 dnl We currently support PAM, standard getpwnam(), and getspnam()
463 dnl (Linux shadow passwords)
466 AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS"
468 AC_CHECK_FUNCS(pam_start)
469 test "$enable_chkpwd" != no && LIBS=$save_LIBS
470 if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then
472 AC_SEARCH_LIBS(getspnam, shadow, [
473 if test "$ac_cv_search_getspnam" = -lshadow; then
474 chkpwd_LIBS="-lshadow $chkpwd_LIBS"
476 test "$enable_chkpwd" != no && LIBS=$save_LIBS
477 if test "$ac_cv_func_crypt" = no; then
478 AC_CHECK_LIB(crypt, crypt, [
479 chkpwd_LIBS="-lcrypt $chkpwd_LIBS"
480 test "$enable_chkpwd" = no && \
481 LIBS="-lcrypt $LIBS"])
485 AC_CHECK_FUNCS(vw_printw wcolor_set resizeterm wresize)
487 dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On
488 dnl which the -pthread flag takes care of this.)
489 if test "$check_pthread" != no; then
490 AC_CHECK_LIB(pthread, pthread_create)
491 AC_CHECK_LIB(pthreads, pthread_create)
494 test -d /usr/kerberos/include && CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
496 dnl Checks for the libical iCalendar library.
497 AC_CHECK_HEADER(libical/ical.h,
498 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
500 SERVER_LIBS="-lical $SERVER_LIBS"
503 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
508 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
513 dnl Checks for the libsieve mailbox sorting library.
514 AC_CHECK_HEADER(sieve2.h,
515 [AC_CHECK_LIB(sieve, sieve2_license,
517 SERVER_LIBS="-lsieve $SERVER_LIBS"
520 AC_MSG_ERROR(libsieve was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
525 AC_MSG_ERROR(sieve2.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
529 saved_CFLAGS="$CFLAGS"
530 CFLAGS="$CFLAGS $SERVER_LIBS"
531 dnl Check for libcitadel
532 AC_CHECK_HEADER(libcitadel.h,
533 [AC_CHECK_LIB(citadel, libcitadel_version_string,
535 LIBS="-lcitadel $LIBS $SERVER_LIBS"
536 chkpwd_LIBS="-lcitadel $chkpwd_LIBS"
539 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
544 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
547 CFLAGS="$saved_CFLAGS"
550 # The big search for OpenSSL
551 if test "$with_ssl" != "no"; then
553 saved_LDFLAGS="$LDFLAGS"
554 saved_CFLAGS="$CFLAGS"
555 if test "x$prefix" != "xNONE"; then
556 tryssldir="$tryssldir $prefix"
558 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
559 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
560 CFLAGS="$saved_CFLAGS"
561 LDFLAGS="$saved_LDFLAGS"
562 LIBS="$saved_LIBS -lssl -lcrypto"
564 # Skip directories if they don't exist
565 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
568 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
569 # Try to use $ssldir/lib if it exists, otherwise
571 if test -d "$ssldir/lib" ; then
572 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
573 if test ! -z "$need_dash_r" ; then
574 LDFLAGS="-R$ssldir/lib $LDFLAGS"
577 LDFLAGS="-L$ssldir $saved_LDFLAGS"
578 if test ! -z "$need_dash_r" ; then
579 LDFLAGS="-R$ssldir $LDFLAGS"
582 # Try to use $ssldir/include if it exists, otherwise
584 if test -d "$ssldir/include" ; then
585 CFLAGS="-I$ssldir/include $saved_CFLAGS"
587 CFLAGS="-I$ssldir $saved_CFLAGS"
591 # Basic test to check for compatible version and correct linking
592 # *does not* test for RSA - that comes later.
596 #include <openssl/rand.h>
600 memset(a, 0, sizeof(a));
601 RAND_add(a, sizeof(a), sizeof(a));
602 return(RAND_status() <= 0);
611 if test ! -z "$found_crypto" ; then
616 if test -z "$ssldir" ; then
620 if test ! -z "$found_crypto" ; then
621 ac_cv_openssldir=$ssldir
623 ac_cv_openssldir="no"
627 LDFLAGS="$saved_LDFLAGS"
628 CFLAGS="$saved_CFLAGS"
630 if test "x$ac_cv_openssldir" != "xno" ; then
631 AC_DEFINE(HAVE_OPENSSL, [], [Define if you have OpenSSL.])
632 LIBS="-lssl -lcrypto $LIBS"
633 dnl Need to recover ssldir - test above runs in subshell
634 ssldir=$ac_cv_openssldir
635 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
636 # Try to use $ssldir/lib if it exists, otherwise
638 if test -d "$ssldir/lib" ; then
639 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
640 if test ! -z "$need_dash_r" ; then
641 LDFLAGS="-R$ssldir/lib $LDFLAGS"
644 LDFLAGS="-L$ssldir $saved_LDFLAGS"
645 if test ! -z "$need_dash_r" ; then
646 LDFLAGS="-R$ssldir $LDFLAGS"
649 # Try to use $ssldir/include if it exists, otherwise
651 if test -d "$ssldir/include" ; then
652 CFLAGS="-I$ssldir/include $saved_CFLAGS"
654 CFLAGS="-I$ssldir $saved_CFLAGS"
660 if test "x$with_db" != xno; then
661 test "$db_dir" && LDFLAGS="$LDFLAGS -L$db_dir/lib"
665 if test "$db_dir"; then
666 CPPFLAGS="$CPPFLAGS -I$db_dir/include"
674 AC_MSG_ERROR([[Can not locate a suitable Berkeley DB
675 library. Use --with-db=PATH to specify
681 dnl Checks for the OpenLDAP client library.
682 AC_CHECK_HEADER(ldap.h,
683 [AC_CHECK_LIB(ldap, ldap_initialize,
685 SERVER_LIBS="-lldap $SERVER_LIBS"
688 AC_MSG_ERROR(OpenLDAP development library was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
693 AC_MSG_ERROR(OpenLDAP development headers were not found and are required. More info: http://www.citadel.org/doku.php/installation:start)
698 dnl Checks for the Expat XML parser.
699 AC_CHECK_HEADER(expat.h,
700 [AC_CHECK_LIB(expat, XML_ParserCreateNS,
702 SERVER_LIBS="-lexpat $SERVER_LIBS"
705 AC_MSG_ERROR(The Expat XML parser was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
710 AC_MSG_ERROR(expat.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
715 dnl Checks for libcurl.
716 AC_CHECK_HEADER(curl/curl.h,
717 [AC_CHECK_LIB(curl, curl_version,
719 SERVER_LIBS="-lcurl $SERVER_LIBS"
722 AC_MSG_ERROR(libcurl was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
727 AC_MSG_ERROR(curl/curl.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
732 dnl Checks for header files.
738 dnl TODO: for the DB header checks, we should check whether the headers
739 dnl define db_env_create, somehow
741 AC_CHECK_HEADERS(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 pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h syscall.h sys/syscall.h)
743 AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H, [], [define this if you have the resolv.h header file.]),,
744 [#ifdef HAVE_SYS_TYPES_H
745 #include <sys/types.h>
747 #ifdef HAVE_NETINET_IN_H
748 #include <netinet/in.h>
750 #ifdef HAVE_ARPA_NAMESER_H
751 #include <arpa/nameser.h>
755 dnl Checks for typedefs, structures, and compiler characteristics.
761 dnl defined in acinclude.m4:
764 AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type,
765 [AC_TRY_COMPILE([#include <sys/types.h>
766 #include <utmp.h>], [struct utmp ut; ut.ut_type;],
767 ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)])
768 if test $ac_cv_struct_ut_type = yes; then
769 AC_DEFINE(HAVE_UT_TYPE, [], [define this if struct utmp has an ut_type member])
773 [for call semantics from getpwuid_r],
774 ac_cv_call_getpwuid_r,
775 [AC_TRY_COMPILE([#include <sys/types.h>
778 struct passwd pw, *pwp;
782 getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp);
784 ac_cv_call_getpwuid_r=yes,
785 ac_cv_call_getpwuid_r=no)
788 if test $ac_cv_call_getpwuid_r = no; then
789 AC_DEFINE(SOLARIS_GETPWUID,[],[do we need to use solaris call syntax?])
790 AC_DEFINE(F_UID_T, "%ld", [whats the matching format string for uid_t?])
791 AC_DEFINE(F_PID_T, "%ld", [whats the matching format string for pid_t?])
792 AC_DEFINE(F_XPID_T, "%lx", [whats the matching format string for xpid_t?])
794 AC_DEFINE(F_UID_T, "%d", [whats the matching format string for uid_t?])
795 AC_DEFINE(F_PID_T, "%d", [whats the matching format string for pid_t?])
796 AC_DEFINE(F_XPID_T, "%x", [whats the matching format string for xpid_t?])
800 dnl Our own happy little check for the resolver library.
804 echo "we don't need to check for resolv on openbsd"
807 echo "we don't need to check for resolv on freeBSD"
810 test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
811 AC_CHECK_LIB(resolv, res_query,
812 RESOLV="$RESOLV -lresolv",
813 [dnl Have to include resolv.h as res_query is sometimes defined as a macro
814 AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
816 LIBS="-lresolv $LIBS"
821 [res_query(0,0,0,0,0)],
825 AC_MSG_ERROR(libresolv was not found. Citadel requires the resolver library.)
834 AC_CACHE_CHECK([for ut_host in struct utmp], ac_cv_struct_ut_host,
835 [AC_TRY_COMPILE([#include <sys/types.h>
836 #include <utmp.h>], [struct utmp ut; ut.ut_host;],
837 ac_cv_struct_ut_host=yes, ac_cv_struct_ut_host=no)])
838 if test $ac_cv_struct_ut_host = yes; then
839 AC_DEFINE(HAVE_UT_HOST, [], [define this if struct utmp has an ut_host member])
842 dnl Checks for library functions.
844 AC_PROG_GCC_TRADITIONAL
847 AC_CHECK_FUNCS(getspnam getutxline mkdir mkfifo mktime rmdir select socket strerror strcasecmp strncasecmp)
849 dnl Now check for pthreads
851 dnl On some platforms, AC_CHECK_FUNC[S] doesn't work for pthreads programs;
852 dnl we need to include pthread.h
854 AC_CACHE_CHECK([for pthread_cancel], ac_cv_func_pthread_cancel,
855 [AC_TRY_LINK([#include <pthread.h>],
858 /* The GNU C library defines this for functions which it implements
859 to always fail with ENOSYS. Some functions are actually named
860 something starting with __ and the normal name is an alias. */
861 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
864 pthread_cancel(thread);
866 ac_cv_func_pthread_cancel=yes, ac_cv_func_pthread_cancel=no)])
867 if test "$ac_cv_func_pthread_cancel" = yes; then
868 AC_DEFINE(HAVE_PTHREAD_CANCEL, [], [define this if you have the pthread_cancel() function])
871 AC_CACHE_CHECK([for pthread_create], ac_cv_func_pthread_create,
872 [AC_TRY_LINK([#include <pthread.h>],
873 [ /* The GNU C library defines this for functions which it implements
874 to always fail with ENOSYS. Some functions are actually named
875 something starting with __ and the normal name is an alias. */
876 #if defined (__stub_pthread_cancel) || defined (__stub___pthread_cancel)
879 pthread_create(NULL, NULL, NULL, NULL);
881 ac_cv_func_pthread_create=yes, ac_cv_func_pthread_create=no)])
882 if test "$ac_cv_func_pthread_create" = yes; then
883 test "$DATABASE" && TARGETS="server utils"
886 AC_CACHE_CHECK([the weather], ac_cv_weather, [
888 echo $ECHO_N "opening your window... $ECHO_C" >&6
890 month=`date | cut -f 2 -d ' '`
893 ac_cv_weather="it's cold!"
896 ac_cv_weather="it's wet!"
899 ac_cv_weather="it's hot!"
902 ac_cv_weather="it's cool"
905 ac_cv_weather="it's fine"
911 AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [
912 number=`date | cut -c 19`
915 ac_cv_under_the_bed="lunatics and monsters found"
918 ac_cv_under_the_bed="dust bunnies found"
926 dnl Done! Now write the Makefile and sysdep.h
928 AC_SUBST(chkpwd_LIBS)
931 AC_SUBST(SERVER_LDFLAGS)
932 AC_SUBST(SERVER_LIBS)
936 AC_CONFIG_FILES([Makefile])
937 AC_OUTPUT(database_cleanup.sh po/citadel-setup/Makefile)
939 if test -z "$DATABASE"; then
940 AC_MSG_WARN([No database driver was found. Please install Berkeley DB.])
943 abs_srcdir="`cd $srcdir && pwd`"
945 if test "$abs_srcdir" != "$abs_builddir"; then
946 ln -sf $abs_srcdir/include $abs_builddir
947 ln -sf $abs_srcdir/Make_sources $abs_builddir
948 ln -sf $abs_srcdir/Make_modules $abs_builddir
949 for i in $abs_srcdir/*.h ; do
950 if test "$abs_srcdir/sysdep.h" != "$i"; then
951 ln -sf $i $abs_builddir
954 for d in `/bin/ls $abs_srcdir/modules/`; do
955 (mkdir -p $abs_builddir/modules/$d)
957 if test -d "$abs_srcdir/user_modules/"; then
958 for d in `/bin/ls $abs_srcdir/user_modules/`; do
959 (mkdir -p $abs_builddir/user_modules/$d)
962 mkdir -p $abs_builddir/utils
963 mkdir -p $abs_builddir/utillib
966 if test -n "$srcdir"; then
971 echo ------------------------------------------------------------------------
972 echo 'Character set conversion support:' $ok_iconv
974 echo 'Note: if you are not using Linux, make sure you are using GNU make'
975 echo '(gmake) to compile Citadel.'