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 dnl Checks for the libical calendaring library.
112 if test "x$with_libical" != xno ; then
113 AC_CHECK_HEADERS(ical.h,
114 [AC_CHECK_LIB(ical, icalcomponent_new,
119 if test "x$ok_libical" = xyes ; then
126 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
127 v = 100*major + minor;
128 printf("libical version: %i\n", v);
130 printf("This version is ok.\n");
133 printf("libical 0.24 or newer required.\n");
134 printf("Citadel will be built without calendar support.\n");
140 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
147 dnl Checks for the zlib compression library.
148 if test "x$with_zlib" != xno ; then
149 AC_CHECK_HEADERS(zlib.h,
150 [AC_CHECK_LIB(z, zlibVersion,
155 if test "x$ok_zlib" = xyes ; then
157 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
161 # The big search for OpenSSL
162 if test "$with_ssl" != "no"; then
164 saved_LDFLAGS="$LDFLAGS"
165 saved_CFLAGS="$CFLAGS"
166 if test "x$prefix" != "xNONE"; then
167 tryssldir="$tryssldir $prefix"
169 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
170 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
171 CFLAGS="$saved_CFLAGS"
172 LDFLAGS="$saved_LDFLAGS"
173 LIBS="$saved_LIBS -lssl -lcrypto"
175 # Skip directories if they don't exist
176 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
179 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
180 # Try to use $ssldir/lib if it exists, otherwise
182 if test -d "$ssldir/lib" ; then
183 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
184 if test ! -z "$need_dash_r" ; then
185 LDFLAGS="-R$ssldir/lib $LDFLAGS"
188 LDFLAGS="-L$ssldir $saved_LDFLAGS"
189 if test ! -z "$need_dash_r" ; then
190 LDFLAGS="-R$ssldir $LDFLAGS"
193 # Try to use $ssldir/include if it exists, otherwise
195 if test -d "$ssldir/include" ; then
196 CFLAGS="-I$ssldir/include $saved_CFLAGS"
198 CFLAGS="-I$ssldir $saved_CFLAGS"
202 # Basic test to check for compatible version and correct linking
203 # *does not* test for RSA - that comes later.
207 #include <openssl/rand.h>
211 memset(a, 0, sizeof(a));
212 RAND_add(a, sizeof(a), sizeof(a));
213 return(RAND_status() <= 0);
222 if test ! -z "$found_crypto" ; then
227 if test -z "$ssldir" ; then
231 if test ! -z "$found_crypto" ; then
232 ac_cv_openssldir=$ssldir
234 ac_cv_openssldir="no"
238 LDFLAGS="$saved_LDFLAGS"
239 CFLAGS="$saved_CFLAGS"
241 if test "x$ac_cv_openssldir" != "xno" ; then
242 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
243 LIBS="-lssl -lcrypto $LIBS"
244 dnl Need to recover ssldir - test above runs in subshell
245 ssldir=$ac_cv_openssldir
246 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
247 # Try to use $ssldir/lib if it exists, otherwise
249 if test -d "$ssldir/lib" ; then
250 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
251 if test ! -z "$need_dash_r" ; then
252 LDFLAGS="-R$ssldir/lib $LDFLAGS"
255 LDFLAGS="-L$ssldir $saved_LDFLAGS"
256 if test ! -z "$need_dash_r" ; then
257 LDFLAGS="-R$ssldir $LDFLAGS"
260 # Try to use $ssldir/include if it exists, otherwise
262 if test -d "$ssldir/include" ; then
263 CFLAGS="-I$ssldir/include $saved_CFLAGS"
265 CFLAGS="-I$ssldir $saved_CFLAGS"
270 dnl Checks for the SSLdir
271 dnl this is a bit different than the rest,
272 dnl because of the citadel used to have a keys/ subdir.
274 [ --with-ssldir directory to store the ssl certificates under],
275 [ if test "x$withval" != "xno" ; then
279 AC_SUBST(MAKE_SSL_DIR)
282 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
284 dnl Here is the check for a usable iconv
287 [ --disable-iconv do not use iconv charset conversion],
288 ok_iconv=no, ok_iconv=yes)
290 if test "$ok_nls" != "no"; then
291 AC_MSG_RESULT(Checking to see if your system supports iconv...)
295 iconv_t ic = (iconv_t)(-1) ;
296 ic = iconv_open("UTF-8", "us-ascii");
306 if test "$ok_iconv" != "no"; then
307 AC_MSG_RESULT(WebCit will be built with character set conversion.)
308 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
310 AC_MSG_RESULT(WebCit will be built without character set conversion.)
315 dnl Here is the check for libintl etc.
318 [ --disable-nls do not use Native Language Support],
319 ok_nls=no, ok_nls=yes)
321 if test "$ok_nls" != "no"; then
322 AC_MSG_RESULT(Checking for per-thread NLS support...)
332 uselocale(LC_GLOBAL_LOCALE);
333 foo = gettext("bar");
335 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
346 if test "$ok_nls" != "no"; then
347 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
351 if test "$ok_nls" != "no"; then
352 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
356 if test "$ok_nls" != "no"; then
357 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
361 if test "$ok_nls" != "no"; then
362 AC_MSG_RESULT(WebCit will be built with national language support.)
363 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
364 PROG_SUBDIRS="$PROG_SUBDIRS po"
366 AC_MSG_RESULT(WebCit will be built without national language support.)
371 dnl disable backtrace if we don't want it.
373 [ --with-gprof enable profiling],
374 [ if test "x$withval" != "xno" ; then
375 CFLAGS="$CFLAGS -pg "
376 LDFLAGS="$LDFLAGS -pg "
381 dnl disable backtrace if we don't want it.
382 AC_ARG_WITH(backtrace,
383 [ --with-backtrace enable backtrace dumps in the syslog],
384 [ if test "x$withval" != "xno" ; then
385 CFLAGS="$CFLAGS -rdynamic "
386 LDFLAGS="$LDFLAGS -rdynamic "
387 AC_CHECK_FUNCS(backtrace)
392 if test "$prefix" = NONE; then
393 datadir=$ac_default_prefix
394 localedir=$ac_default_prefix
395 wwwdir=$ac_default_prefix
396 rundir=$ac_default_prefix
397 editordir=$ac_default_prefix/tiny_mce
403 editordir=$prefix/tiny_mce
406 dnl where to put the locale files
407 AC_ARG_WITH(localedir,
408 [ --with-localedir directory to put the locale files to],
409 [ if test "x$withval" != "xno" ; then
414 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
416 dnl Checks where to put our templates
418 [ --with-wwwdir directory to put our templates],
419 [ if test "x$withval" != "xno" ; then
424 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
428 dnl Checks for the run-dir for the sockets
430 [ --with-rundir directory to place runtime files (UDS) to?],
431 [ if test "x$withval" != "xno" ; then
432 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
435 AC_SUBST(MAKE_RUN_DIR)
439 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
441 dnl Checks for the Datadir
443 [ --with-datadir directory to store the databases under],
444 [ if test "x$withval" != "xno" ; then
449 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
451 dnl Checks where to put our editor
452 AC_ARG_WITH(editordir,
453 [ --with-editordir directory to put our editor],
454 [ if test "x$withval" != "xno" ; then
459 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
461 AC_CONFIG_HEADER(sysdep.h)
462 AC_OUTPUT(Makefile po/Makefile )
464 echo ------------------------------------------------------------------------
465 echo 'zlib compression: ' $ok_zlib
466 echo 'Calendar support: ' $ok_libical
467 echo 'Character set conversion support:' $ok_iconv
468 echo 'National language support: ' $ok_nls