1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [8.20], [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.)
255 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
264 #include <sys/select.h>
266 #include <sys/types.h>
268 #include "lib/libcitadel.h"
272 memcpy(foo, HKEY("foo"));
280 AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
285 dnl Checks for the Expat XML parser.
286 AC_CHECK_HEADER(expat.h,
287 [AC_CHECK_LIB(expat, XML_ParserCreateNS,
292 AC_MSG_ERROR(The Expat XML parser was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
297 AC_MSG_ERROR(expat.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
304 # The big search for OpenSSL
305 if test "$with_ssl" != "no"; then
307 saved_LDFLAGS="$LDFLAGS"
308 saved_CFLAGS="$CFLAGS"
309 if test "x$prefix" != "xNONE"; then
310 tryssldir="$tryssldir $prefix"
312 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
313 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
314 CFLAGS="$saved_CFLAGS"
315 LDFLAGS="$saved_LDFLAGS"
316 LIBS="$saved_LIBS -lssl -lcrypto"
318 # Skip directories if they don't exist
319 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
322 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
323 # Try to use $ssldir/lib if it exists, otherwise
325 if test -d "$ssldir/lib" ; then
326 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
327 if test ! -z "$need_dash_r" ; then
328 LDFLAGS="-R$ssldir/lib $LDFLAGS"
331 LDFLAGS="-L$ssldir $saved_LDFLAGS"
332 if test ! -z "$need_dash_r" ; then
333 LDFLAGS="-R$ssldir $LDFLAGS"
336 # Try to use $ssldir/include if it exists, otherwise
338 if test -d "$ssldir/include" ; then
339 CFLAGS="-I$ssldir/include $saved_CFLAGS"
341 CFLAGS="-I$ssldir $saved_CFLAGS"
345 # Basic test to check for compatible version and correct linking
346 # *does not* test for RSA - that comes later.
350 #include <openssl/rand.h>
354 memset(a, 0, sizeof(a));
355 RAND_add(a, sizeof(a), sizeof(a));
356 return(RAND_status() <= 0);
365 if test ! -z "$found_crypto" ; then
370 if test -z "$ssldir" ; then
374 if test ! -z "$found_crypto" ; then
375 ac_cv_openssldir=$ssldir
377 ac_cv_openssldir="no"
381 LDFLAGS="$saved_LDFLAGS"
382 CFLAGS="$saved_CFLAGS"
384 if test "x$ac_cv_openssldir" != "xno" ; then
385 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
387 LIBS="-lssl -lcrypto $LIBS"
388 dnl Need to recover ssldir - test above runs in subshell
389 ssldir=$ac_cv_openssldir
390 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
391 # Try to use $ssldir/lib if it exists, otherwise
393 if test -d "$ssldir/lib" ; then
394 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
395 if test ! -z "$need_dash_r" ; then
396 LDFLAGS="-R$ssldir/lib $LDFLAGS"
399 LDFLAGS="-L$ssldir $saved_LDFLAGS"
400 if test ! -z "$need_dash_r" ; then
401 LDFLAGS="-R$ssldir $LDFLAGS"
404 # Try to use $ssldir/include if it exists, otherwise
406 if test -d "$ssldir/include" ; then
407 CFLAGS="-I$ssldir/include $saved_CFLAGS"
409 CFLAGS="-I$ssldir $saved_CFLAGS"
414 dnl Checks for the SSLdir
415 dnl this is a bit different than the rest,
416 dnl because of the citadel used to have a keys/ subdir.
418 [ --with-ssldir directory to store the ssl certificates under],
419 [ if test "x$withval" != "xno" ; then
422 if test "$found_ssl" = "no"; then
423 echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
427 AC_SUBST(MAKE_SSL_DIR)
430 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
435 AC_CHECK_FUNCS(strftime_l uselocale gettext)
437 if test "$ok_nls" != "no"; then
438 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
442 if test "$ok_nls" != "no"; then
443 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
447 if test "$ok_nls" != "no"; then
448 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
452 if test "$ok_nls" != "no"; then
453 AC_MSG_RESULT(WebCit will be built with national language support.)
454 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
455 PROG_SUBDIRS="$PROG_SUBDIRS po/webcit/"
457 AC_MSG_RESULT(WebCit will be built without national language support.)
462 dnl disable backtrace if we don't want it.
464 [ --with-gprof enable profiling],
465 [ if test "x$withval" != "xno" ; then
466 CFLAGS="$CFLAGS -pg "
467 LDFLAGS="$LDFLAGS -pg "
472 dnl disable backtrace if we don't want it.
473 AC_ARG_WITH(backtrace,
474 [ --with-backtrace enable backtrace dumps in the syslog],
475 [ if test "x$withval" != "xno" ; then
476 CFLAGS="$CFLAGS -rdynamic "
477 LDFLAGS="$LDFLAGS -rdynamic "
478 AC_CHECK_FUNCS(backtrace)
483 if test "$prefix" = NONE; then
484 datadir=$ac_default_prefix
485 localedir=$ac_default_prefix
486 wwwdir=$ac_default_prefix
487 rundir=$ac_default_prefix
488 editordir=$ac_default_prefix/tiny_mce
489 etcdir=$ac_default_prefix
495 editordir=$prefix/tiny_mce
499 dnl where to put the locale files
500 AC_ARG_WITH(localedir,
501 [ --with-localedir directory to put the locale files to],
502 [ if test "x$withval" != "xno" ; then
507 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
511 dnl Checks where to put our templates
513 [ --with-wwwdir directory to put our templates],
514 [ if test "x$withval" != "xno" ; then
519 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
524 dnl Checks for the run-dir for the sockets
526 [ --with-rundir directory to place runtime files (UDS) to?],
527 [ if test "x$withval" != "xno" ; then
528 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
531 AC_SUBST(MAKE_RUN_DIR)
535 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
537 dnl Checks for the Datadir
539 [ --with-datadir directory to store the databases under],
540 [ if test "x$withval" != "xno" ; then
545 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
547 dnl Checks where to put our editor
548 AC_ARG_WITH(editordir,
549 [ --with-editordir directory to put our editor],
550 [ if test "x$withval" != "xno" ; then
555 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
557 dnl Checks where to find our configs
559 [ --with-etcdir directory to read our configs],
560 [ if test "x$withval" != "xno" ; then
565 AC_DEFINE_UNQUOTED(ETCDIR, "$etcdir", [where to find our configs])
569 abs_srcdir="`cd $srcdir && pwd`"
571 if test "$abs_srcdir" != "$abs_builddir"; then
572 CFLAGS="$CFLAGS -I $abs_builddir"
574 AC_CONFIG_HEADER(sysdep.h)
575 AC_OUTPUT(Makefile po/webcit/Makefile tests/Makefile)
577 if test "$abs_srcdir" != "$abs_builddir"; then
578 ln -s $abs_srcdir/static $abs_builddir
579 ln -s $abs_srcdir/tiny_mce $abs_builddir
580 ln -s $abs_srcdir/*.h $abs_builddir
584 dnl just run it on devel systems and if non vdir build.
585 if test -d .svn; then
590 if test -n "$srcdir"; then
595 echo ------------------------------------------------------------------------
596 echo 'Character set conversion support:' $ok_iconv
597 echo 'National language support: ' $ok_nls