1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.31], [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
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)
133 LDFLAGS="$LDFLAGS -liconv"
137 iconv_t ic = (iconv_t)(-1) ;
138 ic = iconv_open("UTF-8", "us-ascii");
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"])
164 dnl Check for libcitadel
165 AC_CHECK_HEADER(libcitadel.h,
166 [AC_CHECK_LIB(citadel, libcitadel_version_string,
168 LIBS="-lcitadel $LIBS"
171 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
176 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
181 webcit_with_calendar_service=no
182 dnl Checks for the libical calendaring library.
183 if test "x$with_libical" != xno ; then
184 AC_CHECK_HEADERS(ical.h,
185 [AC_CHECK_LIB(ical, icalcomponent_new,
190 if test "x$ok_libical" = xyes ; then
197 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
198 v = 100*major + minor;
199 printf("libical version: %i\n", v);
201 printf("This version is ok.\n");
204 printf("libical 0.30 or newer required.\n");
205 printf("Citadel will be built without calendar support.\n");
211 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
212 webcit_with_calendar_service=yes
216 ok_libical=$webcit_with_calendar_service
219 if test "$webcit_with_calendar_service" == "yes"; then
220 AC_DEFINE(WEBCIT_WITH_CALENDAR_SERVICE,[],[whether we can do with calendar.])
223 dnl Checks for the zlib compression library.
224 if test "x$with_zlib" != xno ; then
225 AC_CHECK_HEADERS(zlib.h,
226 [AC_CHECK_LIB(z, zlibVersion,
231 if test "x$ok_zlib" = xyes ; then
233 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
237 # The big search for OpenSSL
238 if test "$with_ssl" != "no"; then
240 saved_LDFLAGS="$LDFLAGS"
241 saved_CFLAGS="$CFLAGS"
242 if test "x$prefix" != "xNONE"; then
243 tryssldir="$tryssldir $prefix"
245 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
246 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
247 CFLAGS="$saved_CFLAGS"
248 LDFLAGS="$saved_LDFLAGS"
249 LIBS="$saved_LIBS -lssl -lcrypto"
251 # Skip directories if they don't exist
252 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
255 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
256 # Try to use $ssldir/lib if it exists, otherwise
258 if test -d "$ssldir/lib" ; then
259 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
260 if test ! -z "$need_dash_r" ; then
261 LDFLAGS="-R$ssldir/lib $LDFLAGS"
264 LDFLAGS="-L$ssldir $saved_LDFLAGS"
265 if test ! -z "$need_dash_r" ; then
266 LDFLAGS="-R$ssldir $LDFLAGS"
269 # Try to use $ssldir/include if it exists, otherwise
271 if test -d "$ssldir/include" ; then
272 CFLAGS="-I$ssldir/include $saved_CFLAGS"
274 CFLAGS="-I$ssldir $saved_CFLAGS"
278 # Basic test to check for compatible version and correct linking
279 # *does not* test for RSA - that comes later.
283 #include <openssl/rand.h>
287 memset(a, 0, sizeof(a));
288 RAND_add(a, sizeof(a), sizeof(a));
289 return(RAND_status() <= 0);
298 if test ! -z "$found_crypto" ; then
303 if test -z "$ssldir" ; then
307 if test ! -z "$found_crypto" ; then
308 ac_cv_openssldir=$ssldir
310 ac_cv_openssldir="no"
314 LDFLAGS="$saved_LDFLAGS"
315 CFLAGS="$saved_CFLAGS"
317 if test "x$ac_cv_openssldir" != "xno" ; then
318 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
319 LIBS="-lssl -lcrypto $LIBS"
320 dnl Need to recover ssldir - test above runs in subshell
321 ssldir=$ac_cv_openssldir
322 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
323 # Try to use $ssldir/lib if it exists, otherwise
325 if test -d "$ssldir/lib" ; then
326 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
327 if test ! -z "$need_dash_r" ; then
328 LDFLAGS="-R$ssldir/lib $LDFLAGS"
331 LDFLAGS="-L$ssldir $saved_LDFLAGS"
332 if test ! -z "$need_dash_r" ; then
333 LDFLAGS="-R$ssldir $LDFLAGS"
336 # Try to use $ssldir/include if it exists, otherwise
338 if test -d "$ssldir/include" ; then
339 CFLAGS="-I$ssldir/include $saved_CFLAGS"
341 CFLAGS="-I$ssldir $saved_CFLAGS"
346 dnl Checks for the SSLdir
347 dnl this is a bit different than the rest,
348 dnl because of the citadel used to have a keys/ subdir.
350 [ --with-ssldir directory to store the ssl certificates under],
351 [ if test "x$withval" != "xno" ; then
355 AC_SUBST(MAKE_SSL_DIR)
358 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
363 AC_CHECK_FUNCS(strftime_l uselocale gettext)
365 if test "$ok_nls" != "no"; then
366 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
370 if test "$ok_nls" != "no"; then
371 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
375 if test "$ok_nls" != "no"; then
376 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
380 if test "$ok_nls" != "no"; then
381 AC_MSG_RESULT(WebCit will be built with national language support.)
382 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
383 PROG_SUBDIRS="$PROG_SUBDIRS po"
385 AC_MSG_RESULT(WebCit will be built without national language support.)
390 dnl disable backtrace if we don't want it.
392 [ --with-gprof enable profiling],
393 [ if test "x$withval" != "xno" ; then
394 CFLAGS="$CFLAGS -pg "
395 LDFLAGS="$LDFLAGS -pg "
400 dnl disable backtrace if we don't want it.
401 AC_ARG_WITH(backtrace,
402 [ --with-backtrace enable backtrace dumps in the syslog],
403 [ if test "x$withval" != "xno" ; then
404 CFLAGS="$CFLAGS -rdynamic "
405 LDFLAGS="$LDFLAGS -rdynamic "
406 AC_CHECK_FUNCS(backtrace)
411 if test "$prefix" = NONE; then
412 datadir=$ac_default_prefix
413 localedir=$ac_default_prefix
414 wwwdir=$ac_default_prefix
415 rundir=$ac_default_prefix
416 editordir=$ac_default_prefix/tiny_mce
422 editordir=$prefix/tiny_mce
425 dnl where to put the locale files
426 AC_ARG_WITH(localedir,
427 [ --with-localedir directory to put the locale files to],
428 [ if test "x$withval" != "xno" ; then
433 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
437 dnl Checks where to put our templates
439 [ --with-wwwdir directory to put our templates],
440 [ if test "x$withval" != "xno" ; then
445 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
450 dnl Checks for the run-dir for the sockets
452 [ --with-rundir directory to place runtime files (UDS) to?],
453 [ if test "x$withval" != "xno" ; then
454 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
457 AC_SUBST(MAKE_RUN_DIR)
461 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
463 dnl Checks for the Datadir
465 [ --with-datadir directory to store the databases under],
466 [ if test "x$withval" != "xno" ; then
471 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
473 dnl Checks where to put our editor
474 AC_ARG_WITH(editordir,
475 [ --with-editordir directory to put our editor],
476 [ if test "x$withval" != "xno" ; then
481 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
483 AC_CONFIG_HEADER(sysdep.h)
484 AC_OUTPUT(Makefile po/Makefile )
486 echo ------------------------------------------------------------------------
487 echo 'zlib compression: ' $ok_zlib
488 echo 'Calendar support: ' $ok_libical
489 echo 'Character set conversion support:' $ok_iconv
490 echo 'National language support: ' $ok_nls