1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.80], [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
94 dnl Checks for typedefs, structures, and compiler characteristics.
100 dnl Checks for library functions.
103 AC_REPLACE_FUNCS(snprintf)
104 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
106 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h xlocale.h)
108 dnl Checks for the zlib compression library.
109 if test "x$with_zlib" != xno ; then
110 AC_CHECK_HEADERS(zlib.h,
111 [AC_CHECK_LIB(z, zlibVersion,
116 if test "x$ok_zlib" = xyes ; then
117 dnl libcitadel will bring libz, so we don't need it here. LDFLAGS="-lz $LDFLAGS"
118 AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
122 dnl Here is the check for a libc integrated iconv
124 [ --disable-iconv do not use iconv charset conversion],
125 ok_iconv=no, ok_iconv=yes)
127 AC_MSG_CHECKING(Checking to see if your system supports iconv)
131 iconv_t ic = (iconv_t)(-1) ;
132 ic = iconv_open("UTF-8", "us-ascii");
147 dnl Check for iconv in external libiconv
148 if test "$ok_iconv" = no; then
149 AC_MSG_CHECKING(Checking for an external libiconv)
150 OLD_LDFLAGS="$LDFLAGS"
151 LDFLAGS="$LDFLAGS -liconv"
155 iconv_t ic = (iconv_t)(-1) ;
156 ic = iconv_open("UTF-8", "us-ascii");
166 LDFLAGS="$OLD_LDFLAGS"
171 if test "$ok_iconv" != "no"; then
172 AC_MSG_RESULT(webcit will be built with character set conversion.)
173 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
175 AC_MSG_RESULT(webcit will be built without character set conversion.)
179 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
182 dnl Checks for the libical iCalendar library.
183 AC_CHECK_HEADER(libical/ical.h,
184 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
189 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
194 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
199 dnl Check for libcitadel
200 AC_CHECK_HEADER(libcitadel.h,
201 [AC_CHECK_LIB(citadel, libcitadel_version_string,
203 LIBS="-lcitadel $LIBS"
204 SETUP_LIBS="-lcitadel $SETUP_LIBS"
207 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
212 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
219 # The big search for OpenSSL
220 if test "$with_ssl" != "no"; then
222 saved_LDFLAGS="$LDFLAGS"
223 saved_CFLAGS="$CFLAGS"
224 if test "x$prefix" != "xNONE"; then
225 tryssldir="$tryssldir $prefix"
227 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
228 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
229 CFLAGS="$saved_CFLAGS"
230 LDFLAGS="$saved_LDFLAGS"
231 LIBS="$saved_LIBS -lssl -lcrypto"
233 # Skip directories if they don't exist
234 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
237 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
238 # Try to use $ssldir/lib if it exists, otherwise
240 if test -d "$ssldir/lib" ; then
241 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
242 if test ! -z "$need_dash_r" ; then
243 LDFLAGS="-R$ssldir/lib $LDFLAGS"
246 LDFLAGS="-L$ssldir $saved_LDFLAGS"
247 if test ! -z "$need_dash_r" ; then
248 LDFLAGS="-R$ssldir $LDFLAGS"
251 # Try to use $ssldir/include if it exists, otherwise
253 if test -d "$ssldir/include" ; then
254 CFLAGS="-I$ssldir/include $saved_CFLAGS"
256 CFLAGS="-I$ssldir $saved_CFLAGS"
260 # Basic test to check for compatible version and correct linking
261 # *does not* test for RSA - that comes later.
265 #include <openssl/rand.h>
269 memset(a, 0, sizeof(a));
270 RAND_add(a, sizeof(a), sizeof(a));
271 return(RAND_status() <= 0);
280 if test ! -z "$found_crypto" ; then
285 if test -z "$ssldir" ; then
289 if test ! -z "$found_crypto" ; then
290 ac_cv_openssldir=$ssldir
292 ac_cv_openssldir="no"
296 LDFLAGS="$saved_LDFLAGS"
297 CFLAGS="$saved_CFLAGS"
299 if test "x$ac_cv_openssldir" != "xno" ; then
300 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
302 LIBS="-lssl -lcrypto $LIBS"
303 dnl Need to recover ssldir - test above runs in subshell
304 ssldir=$ac_cv_openssldir
305 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
306 # Try to use $ssldir/lib if it exists, otherwise
308 if test -d "$ssldir/lib" ; then
309 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
310 if test ! -z "$need_dash_r" ; then
311 LDFLAGS="-R$ssldir/lib $LDFLAGS"
314 LDFLAGS="-L$ssldir $saved_LDFLAGS"
315 if test ! -z "$need_dash_r" ; then
316 LDFLAGS="-R$ssldir $LDFLAGS"
319 # Try to use $ssldir/include if it exists, otherwise
321 if test -d "$ssldir/include" ; then
322 CFLAGS="-I$ssldir/include $saved_CFLAGS"
324 CFLAGS="-I$ssldir $saved_CFLAGS"
329 dnl Checks for the SSLdir
330 dnl this is a bit different than the rest,
331 dnl because of the citadel used to have a keys/ subdir.
333 [ --with-ssldir directory to store the ssl certificates under],
334 [ if test "x$withval" != "xno" ; then
337 if test "$found_ssl" = "no"; then
338 echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
342 AC_SUBST(MAKE_SSL_DIR)
345 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
350 AC_CHECK_FUNCS(strftime_l uselocale gettext)
352 if test "$ok_nls" != "no"; then
353 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
357 if test "$ok_nls" != "no"; then
358 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
362 if test "$ok_nls" != "no"; then
363 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
367 if test "$ok_nls" != "no"; then
368 AC_MSG_RESULT(WebCit will be built with national language support.)
369 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
370 PROG_SUBDIRS="$PROG_SUBDIRS po"
372 AC_MSG_RESULT(WebCit will be built without national language support.)
377 dnl disable backtrace if we don't want it.
379 [ --with-gprof enable profiling],
380 [ if test "x$withval" != "xno" ; then
381 CFLAGS="$CFLAGS -pg "
382 LDFLAGS="$LDFLAGS -pg "
387 dnl disable backtrace if we don't want it.
388 AC_ARG_WITH(backtrace,
389 [ --with-backtrace enable backtrace dumps in the syslog],
390 [ if test "x$withval" != "xno" ; then
391 CFLAGS="$CFLAGS -rdynamic "
392 LDFLAGS="$LDFLAGS -rdynamic "
393 AC_CHECK_FUNCS(backtrace)
398 if test "$prefix" = NONE; then
399 datadir=$ac_default_prefix
400 localedir=$ac_default_prefix
401 wwwdir=$ac_default_prefix
402 rundir=$ac_default_prefix
403 editordir=$ac_default_prefix/tiny_mce
409 editordir=$prefix/tiny_mce
412 dnl where to put the locale files
413 AC_ARG_WITH(localedir,
414 [ --with-localedir directory to put the locale files to],
415 [ if test "x$withval" != "xno" ; then
420 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
424 dnl Checks where to put our templates
426 [ --with-wwwdir directory to put our templates],
427 [ if test "x$withval" != "xno" ; then
432 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
437 dnl Checks for the run-dir for the sockets
439 [ --with-rundir directory to place runtime files (UDS) to?],
440 [ if test "x$withval" != "xno" ; then
441 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
444 AC_SUBST(MAKE_RUN_DIR)
448 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
450 dnl Checks for the Datadir
452 [ --with-datadir directory to store the databases under],
453 [ if test "x$withval" != "xno" ; then
458 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
460 dnl Checks where to put our editor
461 AC_ARG_WITH(editordir,
462 [ --with-editordir directory to put our editor],
463 [ if test "x$withval" != "xno" ; then
468 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
470 abs_srcdir="`cd $srcdir && pwd`"
472 if test "$abs_srcdir" != "$abs_builddir"; then
473 CFLAGS="$CFLAGS -I $abs_builddir"
475 AC_CONFIG_HEADER(sysdep.h)
476 AC_OUTPUT(Makefile po/Makefile tests/Makefile)
478 if test "$abs_srcdir" != "$abs_builddir"; then
479 ln -s $abs_srcdir/static $abs_builddir
480 ln -s $abs_srcdir/tiny_mce $abs_builddir
481 ln -s $abs_srcdir/*.h $abs_builddir
485 dnl just run it on devel systems and if non vdir build.
486 if test -d .svn; then
491 if test -n "$srcdir"; then
496 echo ------------------------------------------------------------------------
497 echo 'Character set conversion support:' $ok_iconv
498 echo 'National language support: ' $ok_nls
499 echo 'Compression support: ' $ok_zlib