1 dnl Process this file with autoconf to produce a configure script.
8 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [our package name])
9 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [our package version])
13 AC_SUBST(PROG_SUBDIRS)
14 AC_DEFINE(PROG_SUBDIRS, [], [Program dirs])
17 missing_dir=`cd $ac_aux_dir && pwd`
18 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
19 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
21 dnl Make sure we see all GNU and Solaris extensions.
24 AC_CHECK_PROG(SED, sed, sed, no)
25 AC_PREFIX_DEFAULT(/usr/local/webcit)
26 if test "$prefix" = NONE; then
27 AC_DEFINE_UNQUOTED(WEBCITDIR, "$ac_default_prefix", [define this to the Citadel home directory])
28 ssl_dir="$ac_default_prefix/keys"
30 AC_DEFINE_UNQUOTED(WEBCITDIR, "$prefix", [define this to the Citadel home directory])
31 ssl_dir="$prefix/keys"
34 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
35 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
37 [ --with-ssl=PATH Specify path to OpenSSL installation ],
39 if test "x$withval" != "xno" ; then
44 dnl Set some system-specific variables which are OK to set before compiler
46 PTHREAD_DEFS=-D_REENTRANT
48 dnl Tru64 Unix requires we use -pthread instead of linking the threads
49 dnl libraries directly, and we can't build threaded programs with gcc
50 dnl due to header file problems.
52 test -z "$CC" && CC=cc
55 dnl FreeBSD is similar:
58 PTHREAD_DEFS=-D_THREAD_SAFE
61 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
64 AC_SUBST(PTHREAD_DEFS)
66 dnl Checks for programs.
69 dnl Configure compiler flags for GCC
70 if test "$GCC" = yes; then
73 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
76 CFLAGS="$CFLAGS -Wall"
81 # missing_dir=`cd $ac_aux_dir && pwd`
82 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
84 dnl Checks for libraries.
85 if test "$LIBS" != -pthread; then
86 AC_CHECK_LIB(pthread, pthread_create)
87 AC_CHECK_LIB(pthreads, pthread_create)
89 AC_SEARCH_LIBS(gethostbyname, nsl)
90 AC_SEARCH_LIBS(connect, socket)
92 dnl Checks for header files.
94 dnl AC_HEADER_SYS_WAIT
95 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
100 dnl Checks for typedefs, structures, and compiler characteristics.
106 dnl Checks for library functions.
109 AC_REPLACE_FUNCS(snprintf)
111 webcit_with_calendar_service=no
112 dnl Checks for the libical calendaring library.
113 if test "x$with_libical" != xno ; then
114 AC_CHECK_HEADERS(ical.h,
115 [AC_CHECK_LIB(ical, icalcomponent_new,
120 if test "x$ok_libical" = xyes ; then
127 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
128 v = 100*major + minor;
129 printf("libical version: %i\n", v);
131 printf("This version is ok.\n");
134 printf("libical 0.24 or newer required.\n");
135 printf("Citadel will be built without calendar support.\n");
141 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
142 webcit_with_calendar_service=yes
147 if test "$webcit_with_calendar_service" == "yes"; then
148 AC_DEFINE(WEBCIT_WITH_CALENDAR_SERVICE,[],[whether we can do with calendar.])
151 dnl Checks for the zlib compression library.
152 if test "x$with_zlib" != xno ; then
153 AC_CHECK_HEADERS(zlib.h,
154 [AC_CHECK_LIB(z, zlibVersion,
159 if test "x$ok_zlib" = xyes ; then
161 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
165 # The big search for OpenSSL
166 if test "$with_ssl" != "no"; then
168 saved_LDFLAGS="$LDFLAGS"
169 saved_CFLAGS="$CFLAGS"
170 if test "x$prefix" != "xNONE"; then
171 tryssldir="$tryssldir $prefix"
173 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
174 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
175 CFLAGS="$saved_CFLAGS"
176 LDFLAGS="$saved_LDFLAGS"
177 LIBS="$saved_LIBS -lssl -lcrypto"
179 # Skip directories if they don't exist
180 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
183 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
184 # Try to use $ssldir/lib if it exists, otherwise
186 if test -d "$ssldir/lib" ; then
187 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
188 if test ! -z "$need_dash_r" ; then
189 LDFLAGS="-R$ssldir/lib $LDFLAGS"
192 LDFLAGS="-L$ssldir $saved_LDFLAGS"
193 if test ! -z "$need_dash_r" ; then
194 LDFLAGS="-R$ssldir $LDFLAGS"
197 # Try to use $ssldir/include if it exists, otherwise
199 if test -d "$ssldir/include" ; then
200 CFLAGS="-I$ssldir/include $saved_CFLAGS"
202 CFLAGS="-I$ssldir $saved_CFLAGS"
206 # Basic test to check for compatible version and correct linking
207 # *does not* test for RSA - that comes later.
211 #include <openssl/rand.h>
215 memset(a, 0, sizeof(a));
216 RAND_add(a, sizeof(a), sizeof(a));
217 return(RAND_status() <= 0);
226 if test ! -z "$found_crypto" ; then
231 if test -z "$ssldir" ; then
235 if test ! -z "$found_crypto" ; then
236 ac_cv_openssldir=$ssldir
238 ac_cv_openssldir="no"
242 LDFLAGS="$saved_LDFLAGS"
243 CFLAGS="$saved_CFLAGS"
245 if test "x$ac_cv_openssldir" != "xno" ; then
246 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
247 LIBS="-lssl -lcrypto $LIBS"
248 dnl Need to recover ssldir - test above runs in subshell
249 ssldir=$ac_cv_openssldir
250 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
251 # Try to use $ssldir/lib if it exists, otherwise
253 if test -d "$ssldir/lib" ; then
254 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
255 if test ! -z "$need_dash_r" ; then
256 LDFLAGS="-R$ssldir/lib $LDFLAGS"
259 LDFLAGS="-L$ssldir $saved_LDFLAGS"
260 if test ! -z "$need_dash_r" ; then
261 LDFLAGS="-R$ssldir $LDFLAGS"
264 # Try to use $ssldir/include if it exists, otherwise
266 if test -d "$ssldir/include" ; then
267 CFLAGS="-I$ssldir/include $saved_CFLAGS"
269 CFLAGS="-I$ssldir $saved_CFLAGS"
274 dnl Checks for the SSLdir
275 dnl this is a bit different than the rest,
276 dnl because of the citadel used to have a keys/ subdir.
278 [ --with-ssldir directory to store the ssl certificates under],
279 [ if test "x$withval" != "xno" ; then
283 AC_SUBST(MAKE_SSL_DIR)
286 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
288 dnl Here is the check for a usable iconv
291 [ --disable-iconv do not use iconv charset conversion],
292 ok_iconv=no, ok_iconv=yes)
294 if test "$ok_nls" != "no"; then
295 AC_MSG_RESULT(Checking to see if your system supports iconv...)
299 iconv_t ic = (iconv_t)(-1) ;
300 ic = iconv_open("UTF-8", "us-ascii");
310 if test "$ok_iconv" != "no"; then
311 AC_MSG_RESULT(WebCit will be built with character set conversion.)
312 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
314 AC_MSG_RESULT(WebCit will be built without character set conversion.)
319 dnl Here is the check for libintl etc.
322 [ --disable-nls do not use Native Language Support],
323 ok_nls=no, ok_nls=yes)
325 if test "$ok_nls" != "no"; then
326 AC_MSG_RESULT(Checking for per-thread NLS support...)
336 uselocale(LC_GLOBAL_LOCALE);
337 foo = gettext("bar");
339 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
350 if test "$ok_nls" != "no"; then
351 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
355 if test "$ok_nls" != "no"; then
356 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
360 if test "$ok_nls" != "no"; then
361 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
365 if test "$ok_nls" != "no"; then
366 AC_MSG_RESULT(WebCit will be built with national language support.)
367 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
368 PROG_SUBDIRS="$PROG_SUBDIRS po"
370 AC_MSG_RESULT(WebCit will be built without national language support.)
375 dnl disable backtrace if we don't want it.
377 [ --with-gprof enable profiling],
378 [ if test "x$withval" != "xno" ; then
379 CFLAGS="$CFLAGS -pg "
380 LDFLAGS="$LDFLAGS -pg "
385 dnl disable backtrace if we don't want it.
386 AC_ARG_WITH(backtrace,
387 [ --with-backtrace enable backtrace dumps in the syslog],
388 [ if test "x$withval" != "xno" ; then
389 CFLAGS="$CFLAGS -rdynamic "
390 LDFLAGS="$LDFLAGS -rdynamic "
391 AC_CHECK_FUNCS(backtrace)
396 if test "$prefix" = NONE; then
397 datadir=$ac_default_prefix
398 localedir=$ac_default_prefix
399 wwwdir=$ac_default_prefix
400 rundir=$ac_default_prefix
401 editordir=$ac_default_prefix/tiny_mce
407 editordir=$prefix/tiny_mce
410 dnl where to put the locale files
411 AC_ARG_WITH(localedir,
412 [ --with-localedir directory to put the locale files to],
413 [ if test "x$withval" != "xno" ; then
418 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
422 dnl Checks where to put our templates
424 [ --with-wwwdir directory to put our templates],
425 [ if test "x$withval" != "xno" ; then
430 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
435 dnl Checks for the run-dir for the sockets
437 [ --with-rundir directory to place runtime files (UDS) to?],
438 [ if test "x$withval" != "xno" ; then
439 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
442 AC_SUBST(MAKE_RUN_DIR)
446 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
448 dnl Checks for the Datadir
450 [ --with-datadir directory to store the databases under],
451 [ if test "x$withval" != "xno" ; then
456 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
458 dnl Checks where to put our editor
459 AC_ARG_WITH(editordir,
460 [ --with-editordir directory to put our editor],
461 [ if test "x$withval" != "xno" ; then
466 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
468 AC_CONFIG_HEADER(sysdep.h)
469 AC_OUTPUT(Makefile po/Makefile )
471 echo ------------------------------------------------------------------------
472 echo 'zlib compression: ' $ok_zlib
473 echo 'Calendar support: ' $ok_libical
474 echo 'Character set conversion support:' $ok_iconv
475 echo 'National language support: ' $ok_nls