1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.35], [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"
27 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
29 [ --with-ssl=PATH Specify path to OpenSSL installation ],
31 if test "x$withval" != "xno" ; then
36 dnl Set some system-specific variables which are OK to set before compiler
38 PTHREAD_DEFS=-D_REENTRANT
40 dnl Tru64 Unix requires we use -pthread instead of linking the threads
41 dnl libraries directly, and we can't build threaded programs with gcc
42 dnl due to header file problems.
44 test -z "$CC" && CC=cc
47 dnl FreeBSD is similar:
50 PTHREAD_DEFS=-D_THREAD_SAFE
53 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
56 AC_SUBST(PTHREAD_DEFS)
58 dnl Checks for programs.
61 dnl Configure compiler flags for GCC
62 if test "$GCC" = yes; then
65 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
68 CFLAGS="$CFLAGS -Wall"
73 # missing_dir=`cd $ac_aux_dir && pwd`
74 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
76 dnl Checks for libraries.
77 if test "$LIBS" != -pthread; then
78 AC_CHECK_LIB(pthread, pthread_create)
79 AC_CHECK_LIB(pthreads, pthread_create)
81 AC_SEARCH_LIBS(gethostbyname, nsl)
82 AC_SEARCH_LIBS(connect, socket)
84 dnl Checks for header files.
86 dnl AC_HEADER_SYS_WAIT
91 dnl Checks for typedefs, structures, and compiler characteristics.
97 dnl Checks for library functions.
100 AC_REPLACE_FUNCS(snprintf)
101 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h)
104 dnl Here is the check for a libc integrated iconv
106 [ --disable-iconv do not use iconv charset conversion],
107 ok_iconv=no, ok_iconv=yes)
109 AC_MSG_CHECKING(Checking to see if your system supports iconv)
113 iconv_t ic = (iconv_t)(-1) ;
114 ic = iconv_open("UTF-8", "us-ascii");
129 dnl Check for iconv in external libiconv
130 if test "$ok_iconv" = no; then
131 AC_MSG_CHECKING(Checking for an external libiconv)
132 OLD_LDFLAGS="$LDFLAGS"
133 LDFLAGS="$LDFLAGS -liconv"
137 iconv_t ic = (iconv_t)(-1) ;
138 ic = iconv_open("UTF-8", "us-ascii");
148 LDFLAGS="$OLD_LDFLAGS"
153 if test "$ok_iconv" != "no"; then
154 AC_MSG_RESULT(WebCit will be built with character set conversion.)
155 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
157 AC_MSG_RESULT(WebCit will be built without character set conversion.)
160 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
162 dnl Check for libcitadel
163 AC_CHECK_HEADER(libcitadel.h,
164 [AC_CHECK_LIB(citadel, libcitadel_version_string,
166 LIBS="-lcitadel $LIBS"
169 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
174 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
179 dnl Checks for the libical iCalendar library.
180 AC_CHECK_HEADER(ical.h,
181 [AC_CHECK_LIB(ical, icalcomponent_new,
186 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
191 AC_MSG_ERROR(ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
196 dnl Checks for the zlib compression library.
197 if test "x$with_zlib" != xno ; then
198 AC_CHECK_HEADERS(zlib.h,
199 [AC_CHECK_LIB(z, zlibVersion,
204 if test "x$ok_zlib" = xyes ; then
206 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
210 # The big search for OpenSSL
211 if test "$with_ssl" != "no"; then
213 saved_LDFLAGS="$LDFLAGS"
214 saved_CFLAGS="$CFLAGS"
215 if test "x$prefix" != "xNONE"; then
216 tryssldir="$tryssldir $prefix"
218 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
219 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
220 CFLAGS="$saved_CFLAGS"
221 LDFLAGS="$saved_LDFLAGS"
222 LIBS="$saved_LIBS -lssl -lcrypto"
224 # Skip directories if they don't exist
225 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
228 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
229 # Try to use $ssldir/lib if it exists, otherwise
231 if test -d "$ssldir/lib" ; then
232 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
233 if test ! -z "$need_dash_r" ; then
234 LDFLAGS="-R$ssldir/lib $LDFLAGS"
237 LDFLAGS="-L$ssldir $saved_LDFLAGS"
238 if test ! -z "$need_dash_r" ; then
239 LDFLAGS="-R$ssldir $LDFLAGS"
242 # Try to use $ssldir/include if it exists, otherwise
244 if test -d "$ssldir/include" ; then
245 CFLAGS="-I$ssldir/include $saved_CFLAGS"
247 CFLAGS="-I$ssldir $saved_CFLAGS"
251 # Basic test to check for compatible version and correct linking
252 # *does not* test for RSA - that comes later.
256 #include <openssl/rand.h>
260 memset(a, 0, sizeof(a));
261 RAND_add(a, sizeof(a), sizeof(a));
262 return(RAND_status() <= 0);
271 if test ! -z "$found_crypto" ; then
276 if test -z "$ssldir" ; then
280 if test ! -z "$found_crypto" ; then
281 ac_cv_openssldir=$ssldir
283 ac_cv_openssldir="no"
287 LDFLAGS="$saved_LDFLAGS"
288 CFLAGS="$saved_CFLAGS"
290 if test "x$ac_cv_openssldir" != "xno" ; then
291 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
292 LIBS="-lssl -lcrypto $LIBS"
293 dnl Need to recover ssldir - test above runs in subshell
294 ssldir=$ac_cv_openssldir
295 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
296 # Try to use $ssldir/lib if it exists, otherwise
298 if test -d "$ssldir/lib" ; then
299 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
300 if test ! -z "$need_dash_r" ; then
301 LDFLAGS="-R$ssldir/lib $LDFLAGS"
304 LDFLAGS="-L$ssldir $saved_LDFLAGS"
305 if test ! -z "$need_dash_r" ; then
306 LDFLAGS="-R$ssldir $LDFLAGS"
309 # Try to use $ssldir/include if it exists, otherwise
311 if test -d "$ssldir/include" ; then
312 CFLAGS="-I$ssldir/include $saved_CFLAGS"
314 CFLAGS="-I$ssldir $saved_CFLAGS"
319 dnl Checks for the SSLdir
320 dnl this is a bit different than the rest,
321 dnl because of the citadel used to have a keys/ subdir.
323 [ --with-ssldir directory to store the ssl certificates under],
324 [ if test "x$withval" != "xno" ; then
328 AC_SUBST(MAKE_SSL_DIR)
331 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
336 AC_CHECK_FUNCS(strftime_l uselocale gettext)
338 if test "$ok_nls" != "no"; then
339 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
343 if test "$ok_nls" != "no"; then
344 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
348 if test "$ok_nls" != "no"; then
349 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
353 if test "$ok_nls" != "no"; then
354 AC_MSG_RESULT(WebCit will be built with national language support.)
355 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
356 PROG_SUBDIRS="$PROG_SUBDIRS po"
358 AC_MSG_RESULT(WebCit will be built without national language support.)
363 dnl disable backtrace if we don't want it.
365 [ --with-gprof enable profiling],
366 [ if test "x$withval" != "xno" ; then
367 CFLAGS="$CFLAGS -pg "
368 LDFLAGS="$LDFLAGS -pg "
373 dnl disable backtrace if we don't want it.
374 AC_ARG_WITH(backtrace,
375 [ --with-backtrace enable backtrace dumps in the syslog],
376 [ if test "x$withval" != "xno" ; then
377 CFLAGS="$CFLAGS -rdynamic "
378 LDFLAGS="$LDFLAGS -rdynamic "
379 AC_CHECK_FUNCS(backtrace)
384 if test "$prefix" = NONE; then
385 datadir=$ac_default_prefix
386 localedir=$ac_default_prefix
387 wwwdir=$ac_default_prefix
388 rundir=$ac_default_prefix
389 editordir=$ac_default_prefix/tiny_mce
395 editordir=$prefix/tiny_mce
398 dnl where to put the locale files
399 AC_ARG_WITH(localedir,
400 [ --with-localedir directory to put the locale files to],
401 [ if test "x$withval" != "xno" ; then
406 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
410 dnl Checks where to put our templates
412 [ --with-wwwdir directory to put our templates],
413 [ if test "x$withval" != "xno" ; then
418 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
423 dnl Checks for the run-dir for the sockets
425 [ --with-rundir directory to place runtime files (UDS) to?],
426 [ if test "x$withval" != "xno" ; then
427 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
430 AC_SUBST(MAKE_RUN_DIR)
434 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
436 dnl Checks for the Datadir
438 [ --with-datadir directory to store the databases under],
439 [ if test "x$withval" != "xno" ; then
444 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
446 dnl Checks where to put our editor
447 AC_ARG_WITH(editordir,
448 [ --with-editordir directory to put our editor],
449 [ if test "x$withval" != "xno" ; then
454 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
456 AC_CONFIG_HEADER(sysdep.h)
457 AC_OUTPUT(Makefile po/Makefile )
459 echo ------------------------------------------------------------------------
460 echo 'zlib compression: ' $ok_zlib
461 echo 'Character set conversion support:' $ok_iconv
462 echo 'National language support: ' $ok_nls