1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.37], [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'
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 Checks for the zlib compression library.
162 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
163 if test "x$with_zlib" != xno ; then
164 AC_CHECK_HEADERS(zlib.h,
165 [AC_CHECK_LIB(z, zlibVersion,
170 if test "x$ok_zlib" = xyes ; then
172 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
176 dnl Check for libcitadel
177 AC_CHECK_HEADER(libcitadel.h,
178 [AC_CHECK_LIB(citadel, libcitadel_version_string,
180 LIBS="-lcitadel $LIBS"
183 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
188 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
193 dnl Checks for the libical iCalendar library.
194 AC_CHECK_HEADER(libical/ical.h,
195 [AC_CHECK_LIB(ical, icalcomponent_as_ical_string_r,
200 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
205 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
211 # The big search for OpenSSL
212 if test "$with_ssl" != "no"; then
214 saved_LDFLAGS="$LDFLAGS"
215 saved_CFLAGS="$CFLAGS"
216 if test "x$prefix" != "xNONE"; then
217 tryssldir="$tryssldir $prefix"
219 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
220 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
221 CFLAGS="$saved_CFLAGS"
222 LDFLAGS="$saved_LDFLAGS"
223 LIBS="$saved_LIBS -lssl -lcrypto"
225 # Skip directories if they don't exist
226 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
229 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
230 # Try to use $ssldir/lib if it exists, otherwise
232 if test -d "$ssldir/lib" ; then
233 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
234 if test ! -z "$need_dash_r" ; then
235 LDFLAGS="-R$ssldir/lib $LDFLAGS"
238 LDFLAGS="-L$ssldir $saved_LDFLAGS"
239 if test ! -z "$need_dash_r" ; then
240 LDFLAGS="-R$ssldir $LDFLAGS"
243 # Try to use $ssldir/include if it exists, otherwise
245 if test -d "$ssldir/include" ; then
246 CFLAGS="-I$ssldir/include $saved_CFLAGS"
248 CFLAGS="-I$ssldir $saved_CFLAGS"
252 # Basic test to check for compatible version and correct linking
253 # *does not* test for RSA - that comes later.
257 #include <openssl/rand.h>
261 memset(a, 0, sizeof(a));
262 RAND_add(a, sizeof(a), sizeof(a));
263 return(RAND_status() <= 0);
272 if test ! -z "$found_crypto" ; then
277 if test -z "$ssldir" ; then
281 if test ! -z "$found_crypto" ; then
282 ac_cv_openssldir=$ssldir
284 ac_cv_openssldir="no"
288 LDFLAGS="$saved_LDFLAGS"
289 CFLAGS="$saved_CFLAGS"
291 if test "x$ac_cv_openssldir" != "xno" ; then
292 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
293 LIBS="-lssl -lcrypto $LIBS"
294 dnl Need to recover ssldir - test above runs in subshell
295 ssldir=$ac_cv_openssldir
296 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
297 # Try to use $ssldir/lib if it exists, otherwise
299 if test -d "$ssldir/lib" ; then
300 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
301 if test ! -z "$need_dash_r" ; then
302 LDFLAGS="-R$ssldir/lib $LDFLAGS"
305 LDFLAGS="-L$ssldir $saved_LDFLAGS"
306 if test ! -z "$need_dash_r" ; then
307 LDFLAGS="-R$ssldir $LDFLAGS"
310 # Try to use $ssldir/include if it exists, otherwise
312 if test -d "$ssldir/include" ; then
313 CFLAGS="-I$ssldir/include $saved_CFLAGS"
315 CFLAGS="-I$ssldir $saved_CFLAGS"
320 dnl Checks for the SSLdir
321 dnl this is a bit different than the rest,
322 dnl because of the citadel used to have a keys/ subdir.
324 [ --with-ssldir directory to store the ssl certificates under],
325 [ if test "x$withval" != "xno" ; then
329 AC_SUBST(MAKE_SSL_DIR)
332 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
337 AC_CHECK_FUNCS(strftime_l uselocale gettext)
339 if test "$ok_nls" != "no"; then
340 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
344 if test "$ok_nls" != "no"; then
345 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
349 if test "$ok_nls" != "no"; then
350 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
354 if test "$ok_nls" != "no"; then
355 AC_MSG_RESULT(WebCit will be built with national language support.)
356 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
357 PROG_SUBDIRS="$PROG_SUBDIRS po"
359 AC_MSG_RESULT(WebCit will be built without national language support.)
364 dnl disable backtrace if we don't want it.
366 [ --with-gprof enable profiling],
367 [ if test "x$withval" != "xno" ; then
368 CFLAGS="$CFLAGS -pg "
369 LDFLAGS="$LDFLAGS -pg "
374 dnl disable backtrace if we don't want it.
375 AC_ARG_WITH(backtrace,
376 [ --with-backtrace enable backtrace dumps in the syslog],
377 [ if test "x$withval" != "xno" ; then
378 CFLAGS="$CFLAGS -rdynamic "
379 LDFLAGS="$LDFLAGS -rdynamic "
380 AC_CHECK_FUNCS(backtrace)
385 if test "$prefix" = NONE; then
386 datadir=$ac_default_prefix
387 localedir=$ac_default_prefix
388 wwwdir=$ac_default_prefix
389 rundir=$ac_default_prefix
390 editordir=$ac_default_prefix/tiny_mce
396 editordir=$prefix/tiny_mce
399 dnl where to put the locale files
400 AC_ARG_WITH(localedir,
401 [ --with-localedir directory to put the locale files to],
402 [ if test "x$withval" != "xno" ; then
407 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
411 dnl Checks where to put our templates
413 [ --with-wwwdir directory to put our templates],
414 [ if test "x$withval" != "xno" ; then
419 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
424 dnl Checks for the run-dir for the sockets
426 [ --with-rundir directory to place runtime files (UDS) to?],
427 [ if test "x$withval" != "xno" ; then
428 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
431 AC_SUBST(MAKE_RUN_DIR)
435 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
437 dnl Checks for the Datadir
439 [ --with-datadir directory to store the databases under],
440 [ if test "x$withval" != "xno" ; then
445 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
447 dnl Checks where to put our editor
448 AC_ARG_WITH(editordir,
449 [ --with-editordir directory to put our editor],
450 [ if test "x$withval" != "xno" ; then
455 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
458 AC_CONFIG_HEADER(sysdep.h)
459 AC_OUTPUT(Makefile po/Makefile )
461 echo ------------------------------------------------------------------------
462 echo 'zlib compression: ' $ok_zlib
463 echo 'Character set conversion support:' $ok_iconv
464 echo 'National language support: ' $ok_nls