1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [8.16], [http://www.citadel.org/])
7 AC_DEFINE(PROG_SUBDIRS, [], [Program dirs])
10 missing_dir=`cd $ac_aux_dir && pwd`
11 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
12 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
14 dnl Make sure we see all GNU and Solaris extensions.
17 AC_CHECK_PROG(SED, sed, sed, no)
18 AC_PREFIX_DEFAULT(/usr/local/webcit)
19 if test "$prefix" = NONE; then
20 AC_DEFINE_UNQUOTED(WEBCITDIR, "$ac_default_prefix", [define this to the Citadel home directory])
21 ssl_dir="$ac_default_prefix/keys"
23 AC_DEFINE_UNQUOTED(WEBCITDIR, "$prefix", [define this to the Citadel home directory])
24 ssl_dir="$prefix/keys"
28 [ --with-ssl=PATH Specify path to OpenSSL installation ],
30 if test "x$withval" != "xno" ; then
35 dnl Set some system-specific variables which are OK to set before compiler
37 PTHREAD_DEFS=-D_REENTRANT
39 dnl Tru64 Unix requires we use -pthread instead of linking the threads
40 dnl libraries directly, and we can't build threaded programs with gcc
41 dnl due to header file problems.
43 test -z "$CC" && CC=cc
46 dnl FreeBSD is similar:
49 PTHREAD_DEFS=-D_THREAD_SAFE
52 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
57 AC_SUBST(PTHREAD_DEFS)
59 dnl Checks for programs.
62 dnl Configure compiler flags for GCC
63 if test "$GCC" = yes; then
66 dnl CFLAGS="$CFLAGS -Wall -Wno-char-subscripts --pedantic"
67 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
70 dnl CFLAGS="$CFLAGS -Wall --pedantic"
71 CFLAGS="$CFLAGS -Wall"
76 # missing_dir=`cd $ac_aux_dir && pwd`
77 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
79 dnl Checks for libraries.
80 if test "$LIBS" != -pthread; then
81 AC_CHECK_LIB(pthread, pthread_create)
82 AC_CHECK_LIB(pthreads, pthread_create)
84 AC_SEARCH_LIBS(gethostbyname, nsl)
85 AC_SEARCH_LIBS(connect, socket)
87 dnl Checks for header files.
89 dnl AC_HEADER_SYS_WAIT
92 [for call semantics from getpwuid_r],
93 ac_cv_call_getpwuid_r,
94 [AC_TRY_COMPILE([#include <sys/types.h>
97 struct passwd pw, *pwp;
101 getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp);
103 ac_cv_call_getpwuid_r=yes,
104 ac_cv_call_getpwuid_r=no)
107 if test $ac_cv_call_getpwuid_r = no; then
108 AC_DEFINE(SOLARIS_GETPWUID,[],[do we need to use solaris call syntax?])
109 AC_DEFINE(SOLARIS_LOCALTIME_R,[], [do we need to use soralis call syntax?])
110 AC_DEFINE(F_UID_T, "%ld", [whats the matching format string for uid_t?])
111 AC_DEFINE(F_PID_T, "%ld", [whats the matching format string for pid_t?])
112 AC_DEFINE(F_XPID_T, "%lx", [whats the matching format string for xpid_t?])
114 AC_DEFINE(F_UID_T, "%d", [whats the matching format string for uid_t?])
115 AC_DEFINE(F_PID_T, "%d", [whats the matching format string for pid_t?])
116 AC_DEFINE(F_XPID_T, "%x", [whats the matching format string for xpid_t?])
121 dnl Checks for typedefs, structures, and compiler characteristics.
125 dnl Check the size of various builtin types; see typesize.h (error)
126 AC_CHECK_SIZEOF(char, 0)
127 AC_CHECK_SIZEOF(short, 0)
128 AC_CHECK_SIZEOF(int, 0)
129 AC_CHECK_SIZEOF(long, 0)
130 AC_CHECK_SIZEOF(long unsigned int, 0)
131 AC_CHECK_SIZEOF(size_t, 0)
134 dnl Checks for library functions.
137 AC_REPLACE_FUNCS(snprintf)
138 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
140 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h xlocale.h)
142 dnl Checks for the zlib compression library.
143 saved_CFLAGS="$CFLAGS"
144 CFLAGS="$CFLAGS $SERVER_LIBS"
145 AC_CHECK_HEADER(zlib.h,
146 [AC_CHECK_LIB(z, zlibVersion,
148 LIBS="-lz $LIBS $SERVER_LIBS"
151 AC_MSG_ERROR(zlib was not found or is not usable. Please install zlib.)
156 AC_MSG_ERROR(zlib.h was not found or is not usable. Please install zlib.)
159 CFLAGS="$saved_CFLAGS"
161 dnl Here is the check for a libc integrated iconv
163 [ --disable-iconv do not use iconv charset conversion],
164 ok_iconv=no, ok_iconv=yes)
166 AC_MSG_CHECKING(Checking to see if your system supports iconv)
170 iconv_t ic = (iconv_t)(-1) ;
171 ic = iconv_open("UTF-8", "us-ascii");
186 dnl Check for iconv in external libiconv
187 if test "$ok_iconv" = no; then
188 AC_MSG_CHECKING(Checking for an external libiconv)
189 OLD_LDFLAGS="$LDFLAGS"
190 LDFLAGS="$LDFLAGS -liconv"
194 iconv_t ic = (iconv_t)(-1) ;
195 ic = iconv_open("UTF-8", "us-ascii");
205 LDFLAGS="$OLD_LDFLAGS"
210 if test "$ok_iconv" != "no"; then
211 AC_MSG_RESULT(webcit will be built with character set conversion.)
212 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
214 AC_MSG_RESULT(webcit will be built without character set conversion.)
218 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
221 dnl Checks for the libical iCalendar library.
222 AC_CHECK_HEADER(libical/ical.h,
223 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
228 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
233 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
238 dnl Check for libcitadel
239 AC_CHECK_HEADER(libcitadel.h,
240 [AC_CHECK_LIB(citadel, libcitadel_version_string,
242 LIBS="-lcitadel $LIBS"
243 SETUP_LIBS="-lcitadel $SETUP_LIBS"
246 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
251 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
256 dnl Checks for the Expat XML parser.
257 AC_CHECK_HEADER(expat.h,
258 [AC_CHECK_LIB(expat, XML_ParserCreateNS,
263 AC_MSG_ERROR(The Expat XML parser was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
268 AC_MSG_ERROR(expat.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
275 # The big search for OpenSSL
276 if test "$with_ssl" != "no"; then
278 saved_LDFLAGS="$LDFLAGS"
279 saved_CFLAGS="$CFLAGS"
280 if test "x$prefix" != "xNONE"; then
281 tryssldir="$tryssldir $prefix"
283 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
284 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
285 CFLAGS="$saved_CFLAGS"
286 LDFLAGS="$saved_LDFLAGS"
287 LIBS="$saved_LIBS -lssl -lcrypto"
289 # Skip directories if they don't exist
290 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
293 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
294 # Try to use $ssldir/lib if it exists, otherwise
296 if test -d "$ssldir/lib" ; then
297 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
298 if test ! -z "$need_dash_r" ; then
299 LDFLAGS="-R$ssldir/lib $LDFLAGS"
302 LDFLAGS="-L$ssldir $saved_LDFLAGS"
303 if test ! -z "$need_dash_r" ; then
304 LDFLAGS="-R$ssldir $LDFLAGS"
307 # Try to use $ssldir/include if it exists, otherwise
309 if test -d "$ssldir/include" ; then
310 CFLAGS="-I$ssldir/include $saved_CFLAGS"
312 CFLAGS="-I$ssldir $saved_CFLAGS"
316 # Basic test to check for compatible version and correct linking
317 # *does not* test for RSA - that comes later.
321 #include <openssl/rand.h>
325 memset(a, 0, sizeof(a));
326 RAND_add(a, sizeof(a), sizeof(a));
327 return(RAND_status() <= 0);
336 if test ! -z "$found_crypto" ; then
341 if test -z "$ssldir" ; then
345 if test ! -z "$found_crypto" ; then
346 ac_cv_openssldir=$ssldir
348 ac_cv_openssldir="no"
352 LDFLAGS="$saved_LDFLAGS"
353 CFLAGS="$saved_CFLAGS"
355 if test "x$ac_cv_openssldir" != "xno" ; then
356 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
358 LIBS="-lssl -lcrypto $LIBS"
359 dnl Need to recover ssldir - test above runs in subshell
360 ssldir=$ac_cv_openssldir
361 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
362 # Try to use $ssldir/lib if it exists, otherwise
364 if test -d "$ssldir/lib" ; then
365 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
366 if test ! -z "$need_dash_r" ; then
367 LDFLAGS="-R$ssldir/lib $LDFLAGS"
370 LDFLAGS="-L$ssldir $saved_LDFLAGS"
371 if test ! -z "$need_dash_r" ; then
372 LDFLAGS="-R$ssldir $LDFLAGS"
375 # Try to use $ssldir/include if it exists, otherwise
377 if test -d "$ssldir/include" ; then
378 CFLAGS="-I$ssldir/include $saved_CFLAGS"
380 CFLAGS="-I$ssldir $saved_CFLAGS"
385 dnl Checks for the SSLdir
386 dnl this is a bit different than the rest,
387 dnl because of the citadel used to have a keys/ subdir.
389 [ --with-ssldir directory to store the ssl certificates under],
390 [ if test "x$withval" != "xno" ; then
393 if test "$found_ssl" = "no"; then
394 echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
398 AC_SUBST(MAKE_SSL_DIR)
401 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
406 AC_CHECK_FUNCS(strftime_l uselocale gettext)
408 if test "$ok_nls" != "no"; then
409 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
413 if test "$ok_nls" != "no"; then
414 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
418 if test "$ok_nls" != "no"; then
419 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
423 if test "$ok_nls" != "no"; then
424 AC_MSG_RESULT(WebCit will be built with national language support.)
425 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
426 PROG_SUBDIRS="$PROG_SUBDIRS po/webcit/"
428 AC_MSG_RESULT(WebCit will be built without national language support.)
433 dnl disable backtrace if we don't want it.
435 [ --with-gprof enable profiling],
436 [ if test "x$withval" != "xno" ; then
437 CFLAGS="$CFLAGS -pg "
438 LDFLAGS="$LDFLAGS -pg "
443 dnl disable backtrace if we don't want it.
444 AC_ARG_WITH(backtrace,
445 [ --with-backtrace enable backtrace dumps in the syslog],
446 [ if test "x$withval" != "xno" ; then
447 CFLAGS="$CFLAGS -rdynamic "
448 LDFLAGS="$LDFLAGS -rdynamic "
449 AC_CHECK_FUNCS(backtrace)
454 if test "$prefix" = NONE; then
455 datadir=$ac_default_prefix
456 localedir=$ac_default_prefix
457 wwwdir=$ac_default_prefix
458 rundir=$ac_default_prefix
459 editordir=$ac_default_prefix/tiny_mce
465 editordir=$prefix/tiny_mce
468 dnl where to put the locale files
469 AC_ARG_WITH(localedir,
470 [ --with-localedir directory to put the locale files to],
471 [ if test "x$withval" != "xno" ; then
476 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
480 dnl Checks where to put our templates
482 [ --with-wwwdir directory to put our templates],
483 [ if test "x$withval" != "xno" ; then
488 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
493 dnl Checks for the run-dir for the sockets
495 [ --with-rundir directory to place runtime files (UDS) to?],
496 [ if test "x$withval" != "xno" ; then
497 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
500 AC_SUBST(MAKE_RUN_DIR)
504 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
506 dnl Checks for the Datadir
508 [ --with-datadir directory to store the databases under],
509 [ if test "x$withval" != "xno" ; then
514 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
516 dnl Checks where to put our editor
517 AC_ARG_WITH(editordir,
518 [ --with-editordir directory to put our editor],
519 [ if test "x$withval" != "xno" ; then
524 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
526 abs_srcdir="`cd $srcdir && pwd`"
528 if test "$abs_srcdir" != "$abs_builddir"; then
529 CFLAGS="$CFLAGS -I $abs_builddir"
531 AC_CONFIG_HEADER(sysdep.h)
532 AC_OUTPUT(Makefile po/webcit/Makefile tests/Makefile)
534 if test "$abs_srcdir" != "$abs_builddir"; then
535 ln -s $abs_srcdir/static $abs_builddir
536 ln -s $abs_srcdir/tiny_mce $abs_builddir
537 ln -s $abs_srcdir/*.h $abs_builddir
541 dnl just run it on devel systems and if non vdir build.
542 if test -d .svn; then
547 if test -n "$srcdir"; then
552 echo ------------------------------------------------------------------------
553 echo 'Character set conversion support:' $ok_iconv
554 echo 'National language support: ' $ok_nls