1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.34], [http://www.citadel.org/])
6 AC_DEFINE(PROG_SUBDIRS, [], [Program dirs])
9 missing_dir=`cd $ac_aux_dir && pwd`
10 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
11 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
13 dnl Make sure we see all GNU and Solaris extensions.
16 AC_CHECK_PROG(SED, sed, sed, no)
17 AC_PREFIX_DEFAULT(/usr/local/webcit)
18 if test "$prefix" = NONE; then
19 AC_DEFINE_UNQUOTED(WEBCITDIR, "$ac_default_prefix", [define this to the Citadel home directory])
20 ssl_dir="$ac_default_prefix/keys"
22 AC_DEFINE_UNQUOTED(WEBCITDIR, "$prefix", [define this to the Citadel home directory])
23 ssl_dir="$prefix/keys"
26 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
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'
55 AC_SUBST(PTHREAD_DEFS)
57 dnl Checks for programs.
60 dnl Configure compiler flags for GCC
61 if test "$GCC" = yes; then
64 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
67 CFLAGS="$CFLAGS -Wall"
72 # missing_dir=`cd $ac_aux_dir && pwd`
73 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
75 dnl Checks for libraries.
76 if test "$LIBS" != -pthread; then
77 AC_CHECK_LIB(pthread, pthread_create)
78 AC_CHECK_LIB(pthreads, pthread_create)
80 AC_SEARCH_LIBS(gethostbyname, nsl)
81 AC_SEARCH_LIBS(connect, socket)
83 dnl Checks for header files.
85 dnl AC_HEADER_SYS_WAIT
90 dnl Checks for typedefs, structures, and compiler characteristics.
96 dnl Checks for library functions.
99 AC_REPLACE_FUNCS(snprintf)
100 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h)
103 dnl Here is the check for a libc integrated iconv
105 [ --disable-iconv do not use iconv charset conversion],
106 ok_iconv=no, ok_iconv=yes)
108 AC_MSG_CHECKING(Checking to see if your system supports iconv)
112 iconv_t ic = (iconv_t)(-1) ;
113 ic = iconv_open("UTF-8", "us-ascii");
128 dnl Check for iconv in external libiconv
129 if test "$ok_iconv" = no; then
130 AC_MSG_CHECKING(Checking for an external libiconv)
131 OLD_LDFLAGS="$LDFLAGS"
132 LDFLAGS="$LDFLAGS -liconv"
136 iconv_t ic = (iconv_t)(-1) ;
137 ic = iconv_open("UTF-8", "us-ascii");
147 LDFLAGS="$OLD_LDFLAGS"
152 if test "$ok_iconv" != "no"; then
153 AC_MSG_RESULT(WebCit will be built with character set conversion.)
154 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
156 AC_MSG_RESULT(WebCit will be built without character set conversion.)
159 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
161 dnl Check for libcitadel
162 AC_CHECK_HEADER(libcitadel.h,
163 [AC_CHECK_LIB(citadel, libcitadel_version_string,
165 LIBS="-lcitadel $LIBS"
168 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
173 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
178 dnl Checks for the libical iCalendar library.
179 AC_CHECK_HEADER(ical.h,
180 [AC_CHECK_LIB(ical, icalcomponent_new,
185 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
190 AC_MSG_ERROR(ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
195 dnl Checks for the zlib compression library.
196 if test "x$with_zlib" != xno ; then
197 AC_CHECK_HEADERS(zlib.h,
198 [AC_CHECK_LIB(z, zlibVersion,
203 if test "x$ok_zlib" = xyes ; then
205 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
209 # The big search for OpenSSL
210 if test "$with_ssl" != "no"; then
212 saved_LDFLAGS="$LDFLAGS"
213 saved_CFLAGS="$CFLAGS"
214 if test "x$prefix" != "xNONE"; then
215 tryssldir="$tryssldir $prefix"
217 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
218 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
219 CFLAGS="$saved_CFLAGS"
220 LDFLAGS="$saved_LDFLAGS"
221 LIBS="$saved_LIBS -lssl -lcrypto"
223 # Skip directories if they don't exist
224 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
227 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
228 # Try to use $ssldir/lib if it exists, otherwise
230 if test -d "$ssldir/lib" ; then
231 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
232 if test ! -z "$need_dash_r" ; then
233 LDFLAGS="-R$ssldir/lib $LDFLAGS"
236 LDFLAGS="-L$ssldir $saved_LDFLAGS"
237 if test ! -z "$need_dash_r" ; then
238 LDFLAGS="-R$ssldir $LDFLAGS"
241 # Try to use $ssldir/include if it exists, otherwise
243 if test -d "$ssldir/include" ; then
244 CFLAGS="-I$ssldir/include $saved_CFLAGS"
246 CFLAGS="-I$ssldir $saved_CFLAGS"
250 # Basic test to check for compatible version and correct linking
251 # *does not* test for RSA - that comes later.
255 #include <openssl/rand.h>
259 memset(a, 0, sizeof(a));
260 RAND_add(a, sizeof(a), sizeof(a));
261 return(RAND_status() <= 0);
270 if test ! -z "$found_crypto" ; then
275 if test -z "$ssldir" ; then
279 if test ! -z "$found_crypto" ; then
280 ac_cv_openssldir=$ssldir
282 ac_cv_openssldir="no"
286 LDFLAGS="$saved_LDFLAGS"
287 CFLAGS="$saved_CFLAGS"
289 if test "x$ac_cv_openssldir" != "xno" ; then
290 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
291 LIBS="-lssl -lcrypto $LIBS"
292 dnl Need to recover ssldir - test above runs in subshell
293 ssldir=$ac_cv_openssldir
294 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
295 # Try to use $ssldir/lib if it exists, otherwise
297 if test -d "$ssldir/lib" ; then
298 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
299 if test ! -z "$need_dash_r" ; then
300 LDFLAGS="-R$ssldir/lib $LDFLAGS"
303 LDFLAGS="-L$ssldir $saved_LDFLAGS"
304 if test ! -z "$need_dash_r" ; then
305 LDFLAGS="-R$ssldir $LDFLAGS"
308 # Try to use $ssldir/include if it exists, otherwise
310 if test -d "$ssldir/include" ; then
311 CFLAGS="-I$ssldir/include $saved_CFLAGS"
313 CFLAGS="-I$ssldir $saved_CFLAGS"
318 dnl Checks for the SSLdir
319 dnl this is a bit different than the rest,
320 dnl because of the citadel used to have a keys/ subdir.
322 [ --with-ssldir directory to store the ssl certificates under],
323 [ if test "x$withval" != "xno" ; then
327 AC_SUBST(MAKE_SSL_DIR)
330 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
335 AC_CHECK_FUNCS(strftime_l uselocale gettext)
337 if test "$ok_nls" != "no"; then
338 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
342 if test "$ok_nls" != "no"; then
343 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
347 if test "$ok_nls" != "no"; then
348 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
352 if test "$ok_nls" != "no"; then
353 AC_MSG_RESULT(WebCit will be built with national language support.)
354 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
355 PROG_SUBDIRS="$PROG_SUBDIRS po"
357 AC_MSG_RESULT(WebCit will be built without national language support.)
362 dnl disable backtrace if we don't want it.
364 [ --with-gprof enable profiling],
365 [ if test "x$withval" != "xno" ; then
366 CFLAGS="$CFLAGS -pg "
367 LDFLAGS="$LDFLAGS -pg "
372 dnl disable backtrace if we don't want it.
373 AC_ARG_WITH(backtrace,
374 [ --with-backtrace enable backtrace dumps in the syslog],
375 [ if test "x$withval" != "xno" ; then
376 CFLAGS="$CFLAGS -rdynamic "
377 LDFLAGS="$LDFLAGS -rdynamic "
378 AC_CHECK_FUNCS(backtrace)
383 if test "$prefix" = NONE; then
384 datadir=$ac_default_prefix
385 localedir=$ac_default_prefix
386 wwwdir=$ac_default_prefix
387 rundir=$ac_default_prefix
388 editordir=$ac_default_prefix/tiny_mce
394 editordir=$prefix/tiny_mce
397 dnl where to put the locale files
398 AC_ARG_WITH(localedir,
399 [ --with-localedir directory to put the locale files to],
400 [ if test "x$withval" != "xno" ; then
405 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
409 dnl Checks where to put our templates
411 [ --with-wwwdir directory to put our templates],
412 [ if test "x$withval" != "xno" ; then
417 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
422 dnl Checks for the run-dir for the sockets
424 [ --with-rundir directory to place runtime files (UDS) to?],
425 [ if test "x$withval" != "xno" ; then
426 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
429 AC_SUBST(MAKE_RUN_DIR)
433 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
435 dnl Checks for the Datadir
437 [ --with-datadir directory to store the databases under],
438 [ if test "x$withval" != "xno" ; then
443 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
445 dnl Checks where to put our editor
446 AC_ARG_WITH(editordir,
447 [ --with-editordir directory to put our editor],
448 [ if test "x$withval" != "xno" ; then
453 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
455 AC_CONFIG_HEADER(sysdep.h)
456 AC_OUTPUT(Makefile po/Makefile )
458 echo ------------------------------------------------------------------------
459 echo 'zlib compression: ' $ok_zlib
460 echo 'Character set conversion support:' $ok_iconv
461 echo 'National language support: ' $ok_nls