1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.85], [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 if test "x$with_zlib" != xno ; then
144 AC_CHECK_HEADERS(zlib.h,
145 [AC_CHECK_LIB(z, zlibVersion,
150 if test "x$ok_zlib" = xyes ; then
151 dnl libcitadel will bring libz, so we don't need it here. LDFLAGS="-lz $LDFLAGS"
152 AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
156 dnl Here is the check for a libc integrated iconv
158 [ --disable-iconv do not use iconv charset conversion],
159 ok_iconv=no, ok_iconv=yes)
161 AC_MSG_CHECKING(Checking to see if your system supports iconv)
165 iconv_t ic = (iconv_t)(-1) ;
166 ic = iconv_open("UTF-8", "us-ascii");
181 dnl Check for iconv in external libiconv
182 if test "$ok_iconv" = no; then
183 AC_MSG_CHECKING(Checking for an external libiconv)
184 OLD_LDFLAGS="$LDFLAGS"
185 LDFLAGS="$LDFLAGS -liconv"
189 iconv_t ic = (iconv_t)(-1) ;
190 ic = iconv_open("UTF-8", "us-ascii");
200 LDFLAGS="$OLD_LDFLAGS"
205 if test "$ok_iconv" != "no"; then
206 AC_MSG_RESULT(webcit will be built with character set conversion.)
207 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
209 AC_MSG_RESULT(webcit will be built without character set conversion.)
213 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
216 dnl Checks for the libical iCalendar library.
217 AC_CHECK_HEADER(libical/ical.h,
218 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
223 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
228 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
233 dnl Check for libcitadel
234 AC_CHECK_HEADER(libcitadel.h,
235 [AC_CHECK_LIB(citadel, libcitadel_version_string,
237 LIBS="-lcitadel $LIBS"
238 SETUP_LIBS="-lcitadel $SETUP_LIBS"
241 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
246 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
253 # The big search for OpenSSL
254 if test "$with_ssl" != "no"; then
256 saved_LDFLAGS="$LDFLAGS"
257 saved_CFLAGS="$CFLAGS"
258 if test "x$prefix" != "xNONE"; then
259 tryssldir="$tryssldir $prefix"
261 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
262 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
263 CFLAGS="$saved_CFLAGS"
264 LDFLAGS="$saved_LDFLAGS"
265 LIBS="$saved_LIBS -lssl -lcrypto"
267 # Skip directories if they don't exist
268 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
271 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
272 # Try to use $ssldir/lib if it exists, otherwise
274 if test -d "$ssldir/lib" ; then
275 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
276 if test ! -z "$need_dash_r" ; then
277 LDFLAGS="-R$ssldir/lib $LDFLAGS"
280 LDFLAGS="-L$ssldir $saved_LDFLAGS"
281 if test ! -z "$need_dash_r" ; then
282 LDFLAGS="-R$ssldir $LDFLAGS"
285 # Try to use $ssldir/include if it exists, otherwise
287 if test -d "$ssldir/include" ; then
288 CFLAGS="-I$ssldir/include $saved_CFLAGS"
290 CFLAGS="-I$ssldir $saved_CFLAGS"
294 # Basic test to check for compatible version and correct linking
295 # *does not* test for RSA - that comes later.
299 #include <openssl/rand.h>
303 memset(a, 0, sizeof(a));
304 RAND_add(a, sizeof(a), sizeof(a));
305 return(RAND_status() <= 0);
314 if test ! -z "$found_crypto" ; then
319 if test -z "$ssldir" ; then
323 if test ! -z "$found_crypto" ; then
324 ac_cv_openssldir=$ssldir
326 ac_cv_openssldir="no"
330 LDFLAGS="$saved_LDFLAGS"
331 CFLAGS="$saved_CFLAGS"
333 if test "x$ac_cv_openssldir" != "xno" ; then
334 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
336 LIBS="-lssl -lcrypto $LIBS"
337 dnl Need to recover ssldir - test above runs in subshell
338 ssldir=$ac_cv_openssldir
339 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
340 # Try to use $ssldir/lib if it exists, otherwise
342 if test -d "$ssldir/lib" ; then
343 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
344 if test ! -z "$need_dash_r" ; then
345 LDFLAGS="-R$ssldir/lib $LDFLAGS"
348 LDFLAGS="-L$ssldir $saved_LDFLAGS"
349 if test ! -z "$need_dash_r" ; then
350 LDFLAGS="-R$ssldir $LDFLAGS"
353 # Try to use $ssldir/include if it exists, otherwise
355 if test -d "$ssldir/include" ; then
356 CFLAGS="-I$ssldir/include $saved_CFLAGS"
358 CFLAGS="-I$ssldir $saved_CFLAGS"
363 dnl Checks for the SSLdir
364 dnl this is a bit different than the rest,
365 dnl because of the citadel used to have a keys/ subdir.
367 [ --with-ssldir directory to store the ssl certificates under],
368 [ if test "x$withval" != "xno" ; then
371 if test "$found_ssl" = "no"; then
372 echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
376 AC_SUBST(MAKE_SSL_DIR)
379 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
384 AC_CHECK_FUNCS(strftime_l uselocale gettext)
386 if test "$ok_nls" != "no"; then
387 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
391 if test "$ok_nls" != "no"; then
392 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
396 if test "$ok_nls" != "no"; then
397 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
401 if test "$ok_nls" != "no"; then
402 AC_MSG_RESULT(WebCit will be built with national language support.)
403 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
404 PROG_SUBDIRS="$PROG_SUBDIRS po"
406 AC_MSG_RESULT(WebCit will be built without national language support.)
411 dnl disable backtrace if we don't want it.
413 [ --with-gprof enable profiling],
414 [ if test "x$withval" != "xno" ; then
415 CFLAGS="$CFLAGS -pg "
416 LDFLAGS="$LDFLAGS -pg "
421 dnl disable backtrace if we don't want it.
422 AC_ARG_WITH(backtrace,
423 [ --with-backtrace enable backtrace dumps in the syslog],
424 [ if test "x$withval" != "xno" ; then
425 CFLAGS="$CFLAGS -rdynamic "
426 LDFLAGS="$LDFLAGS -rdynamic "
427 AC_CHECK_FUNCS(backtrace)
432 if test "$prefix" = NONE; then
433 datadir=$ac_default_prefix
434 localedir=$ac_default_prefix
435 wwwdir=$ac_default_prefix
436 rundir=$ac_default_prefix
437 editordir=$ac_default_prefix/tiny_mce
443 editordir=$prefix/tiny_mce
446 dnl where to put the locale files
447 AC_ARG_WITH(localedir,
448 [ --with-localedir directory to put the locale files to],
449 [ if test "x$withval" != "xno" ; then
454 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
458 dnl Checks where to put our templates
460 [ --with-wwwdir directory to put our templates],
461 [ if test "x$withval" != "xno" ; then
466 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
471 dnl Checks for the run-dir for the sockets
473 [ --with-rundir directory to place runtime files (UDS) to?],
474 [ if test "x$withval" != "xno" ; then
475 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
478 AC_SUBST(MAKE_RUN_DIR)
482 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
484 dnl Checks for the Datadir
486 [ --with-datadir directory to store the databases under],
487 [ if test "x$withval" != "xno" ; then
492 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
494 dnl Checks where to put our editor
495 AC_ARG_WITH(editordir,
496 [ --with-editordir directory to put our editor],
497 [ if test "x$withval" != "xno" ; then
502 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
504 abs_srcdir="`cd $srcdir && pwd`"
506 if test "$abs_srcdir" != "$abs_builddir"; then
507 CFLAGS="$CFLAGS -I $abs_builddir"
509 AC_CONFIG_HEADER(sysdep.h)
510 AC_OUTPUT(Makefile po/Makefile tests/Makefile)
512 if test "$abs_srcdir" != "$abs_builddir"; then
513 ln -s $abs_srcdir/static $abs_builddir
514 ln -s $abs_srcdir/tiny_mce $abs_builddir
515 ln -s $abs_srcdir/*.h $abs_builddir
519 dnl just run it on devel systems and if non vdir build.
520 if test -d .svn; then
525 if test -n "$srcdir"; then
530 echo ------------------------------------------------------------------------
531 echo 'Character set conversion support:' $ok_iconv
532 echo 'National language support: ' $ok_nls
533 echo 'Compression support: ' $ok_zlib