1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.23], [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_libical, [ --with-libical use libical calendaring library])
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
87 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
92 dnl Checks for typedefs, structures, and compiler characteristics.
98 dnl Checks for library functions.
101 AC_REPLACE_FUNCS(snprintf)
103 webcit_with_calendar_service=no
104 dnl Checks for the libical calendaring library.
105 if test "x$with_libical" != xno ; then
106 AC_CHECK_HEADERS(ical.h,
107 [AC_CHECK_LIB(ical, icalcomponent_new,
112 if test "x$ok_libical" = xyes ; then
119 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
120 v = 100*major + minor;
121 printf("libical version: %i\n", v);
123 printf("This version is ok.\n");
126 printf("libical 0.24 or newer required.\n");
127 printf("Citadel will be built without calendar support.\n");
133 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
134 webcit_with_calendar_service=yes
139 if test "$webcit_with_calendar_service" == "yes"; then
140 AC_DEFINE(WEBCIT_WITH_CALENDAR_SERVICE,[],[whether we can do with calendar.])
143 dnl Checks for the zlib compression library.
144 if test "x$with_zlib" != xno ; then
145 AC_CHECK_HEADERS(zlib.h,
146 [AC_CHECK_LIB(z, zlibVersion,
151 if test "x$ok_zlib" = xyes ; then
153 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
157 # The big search for OpenSSL
158 if test "$with_ssl" != "no"; then
160 saved_LDFLAGS="$LDFLAGS"
161 saved_CFLAGS="$CFLAGS"
162 if test "x$prefix" != "xNONE"; then
163 tryssldir="$tryssldir $prefix"
165 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
166 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
167 CFLAGS="$saved_CFLAGS"
168 LDFLAGS="$saved_LDFLAGS"
169 LIBS="$saved_LIBS -lssl -lcrypto"
171 # Skip directories if they don't exist
172 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
175 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
176 # Try to use $ssldir/lib if it exists, otherwise
178 if test -d "$ssldir/lib" ; then
179 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
180 if test ! -z "$need_dash_r" ; then
181 LDFLAGS="-R$ssldir/lib $LDFLAGS"
184 LDFLAGS="-L$ssldir $saved_LDFLAGS"
185 if test ! -z "$need_dash_r" ; then
186 LDFLAGS="-R$ssldir $LDFLAGS"
189 # Try to use $ssldir/include if it exists, otherwise
191 if test -d "$ssldir/include" ; then
192 CFLAGS="-I$ssldir/include $saved_CFLAGS"
194 CFLAGS="-I$ssldir $saved_CFLAGS"
198 # Basic test to check for compatible version and correct linking
199 # *does not* test for RSA - that comes later.
203 #include <openssl/rand.h>
207 memset(a, 0, sizeof(a));
208 RAND_add(a, sizeof(a), sizeof(a));
209 return(RAND_status() <= 0);
218 if test ! -z "$found_crypto" ; then
223 if test -z "$ssldir" ; then
227 if test ! -z "$found_crypto" ; then
228 ac_cv_openssldir=$ssldir
230 ac_cv_openssldir="no"
234 LDFLAGS="$saved_LDFLAGS"
235 CFLAGS="$saved_CFLAGS"
237 if test "x$ac_cv_openssldir" != "xno" ; then
238 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
239 LIBS="-lssl -lcrypto $LIBS"
240 dnl Need to recover ssldir - test above runs in subshell
241 ssldir=$ac_cv_openssldir
242 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
243 # Try to use $ssldir/lib if it exists, otherwise
245 if test -d "$ssldir/lib" ; then
246 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
247 if test ! -z "$need_dash_r" ; then
248 LDFLAGS="-R$ssldir/lib $LDFLAGS"
251 LDFLAGS="-L$ssldir $saved_LDFLAGS"
252 if test ! -z "$need_dash_r" ; then
253 LDFLAGS="-R$ssldir $LDFLAGS"
256 # Try to use $ssldir/include if it exists, otherwise
258 if test -d "$ssldir/include" ; then
259 CFLAGS="-I$ssldir/include $saved_CFLAGS"
261 CFLAGS="-I$ssldir $saved_CFLAGS"
266 dnl Checks for the SSLdir
267 dnl this is a bit different than the rest,
268 dnl because of the citadel used to have a keys/ subdir.
270 [ --with-ssldir directory to store the ssl certificates under],
271 [ if test "x$withval" != "xno" ; then
275 AC_SUBST(MAKE_SSL_DIR)
278 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
280 dnl Here is the check for a usable iconv
283 [ --disable-iconv do not use iconv charset conversion],
284 ok_iconv=no, ok_iconv=yes)
286 if test "$ok_nls" != "no"; then
287 AC_MSG_RESULT(Checking to see if your system supports iconv...)
291 iconv_t ic = (iconv_t)(-1) ;
292 ic = iconv_open("UTF-8", "us-ascii");
302 if test "$ok_iconv" != "no"; then
303 AC_MSG_RESULT(WebCit will be built with character set conversion.)
304 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
306 AC_MSG_RESULT(WebCit will be built without character set conversion.)
311 dnl Here is the check for libintl etc.
314 [ --disable-nls do not use Native Language Support],
315 ok_nls=no, ok_nls=yes)
317 if test "$ok_nls" != "no"; then
318 AC_MSG_RESULT(Checking for per-thread NLS support...)
328 uselocale(LC_GLOBAL_LOCALE);
329 foo = gettext("bar");
331 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
342 if test "$ok_nls" != "no"; then
343 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
347 if test "$ok_nls" != "no"; then
348 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
352 if test "$ok_nls" != "no"; then
353 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
357 if test "$ok_nls" != "no"; then
358 AC_MSG_RESULT(WebCit will be built with national language support.)
359 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
360 PROG_SUBDIRS="$PROG_SUBDIRS po"
362 AC_MSG_RESULT(WebCit will be built without national language support.)
367 dnl disable backtrace if we don't want it.
369 [ --with-gprof enable profiling],
370 [ if test "x$withval" != "xno" ; then
371 CFLAGS="$CFLAGS -pg "
372 LDFLAGS="$LDFLAGS -pg "
377 dnl disable backtrace if we don't want it.
378 AC_ARG_WITH(backtrace,
379 [ --with-backtrace enable backtrace dumps in the syslog],
380 [ if test "x$withval" != "xno" ; then
381 CFLAGS="$CFLAGS -rdynamic "
382 LDFLAGS="$LDFLAGS -rdynamic "
383 AC_CHECK_FUNCS(backtrace)
388 if test "$prefix" = NONE; then
389 datadir=$ac_default_prefix
390 localedir=$ac_default_prefix
391 wwwdir=$ac_default_prefix
392 rundir=$ac_default_prefix
393 editordir=$ac_default_prefix/tiny_mce
399 editordir=$prefix/tiny_mce
402 dnl where to put the locale files
403 AC_ARG_WITH(localedir,
404 [ --with-localedir directory to put the locale files to],
405 [ if test "x$withval" != "xno" ; then
410 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
414 dnl Checks where to put our templates
416 [ --with-wwwdir directory to put our templates],
417 [ if test "x$withval" != "xno" ; then
422 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
427 dnl Checks for the run-dir for the sockets
429 [ --with-rundir directory to place runtime files (UDS) to?],
430 [ if test "x$withval" != "xno" ; then
431 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
434 AC_SUBST(MAKE_RUN_DIR)
438 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
440 dnl Checks for the Datadir
442 [ --with-datadir directory to store the databases under],
443 [ if test "x$withval" != "xno" ; then
448 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
450 dnl Checks where to put our editor
451 AC_ARG_WITH(editordir,
452 [ --with-editordir directory to put our editor],
453 [ if test "x$withval" != "xno" ; then
458 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
460 AC_CONFIG_HEADER(sysdep.h)
461 AC_OUTPUT(Makefile po/Makefile )
463 echo ------------------------------------------------------------------------
464 echo 'zlib compression: ' $ok_zlib
465 echo 'Calendar support: ' $ok_libical
466 echo 'Character set conversion support:' $ok_iconv
467 echo 'National language support: ' $ok_nls