1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.34], [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)
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 webcit_with_calendar_service=no
180 dnl Checks for the libical calendaring library.
181 if test "x$with_libical" != xno ; then
182 AC_CHECK_HEADERS(ical.h,
183 [AC_CHECK_LIB(ical, icalcomponent_new,
188 if test "x$ok_libical" = xyes ; then
195 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
196 v = 100*major + minor;
197 printf("libical version: %i\n", v);
199 printf("This version is ok.\n");
202 printf("libical 0.30 or newer required.\n");
203 printf("Citadel will be built without calendar support.\n");
209 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
210 webcit_with_calendar_service=yes
214 ok_libical=$webcit_with_calendar_service
217 if test "$webcit_with_calendar_service" == "yes"; then
218 AC_DEFINE(WEBCIT_WITH_CALENDAR_SERVICE,[],[whether we can do with calendar.])
221 dnl Checks for the zlib compression library.
222 if test "x$with_zlib" != xno ; then
223 AC_CHECK_HEADERS(zlib.h,
224 [AC_CHECK_LIB(z, zlibVersion,
229 if test "x$ok_zlib" = xyes ; then
231 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
235 # The big search for OpenSSL
236 if test "$with_ssl" != "no"; then
238 saved_LDFLAGS="$LDFLAGS"
239 saved_CFLAGS="$CFLAGS"
240 if test "x$prefix" != "xNONE"; then
241 tryssldir="$tryssldir $prefix"
243 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
244 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
245 CFLAGS="$saved_CFLAGS"
246 LDFLAGS="$saved_LDFLAGS"
247 LIBS="$saved_LIBS -lssl -lcrypto"
249 # Skip directories if they don't exist
250 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
253 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
254 # Try to use $ssldir/lib if it exists, otherwise
256 if test -d "$ssldir/lib" ; then
257 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
258 if test ! -z "$need_dash_r" ; then
259 LDFLAGS="-R$ssldir/lib $LDFLAGS"
262 LDFLAGS="-L$ssldir $saved_LDFLAGS"
263 if test ! -z "$need_dash_r" ; then
264 LDFLAGS="-R$ssldir $LDFLAGS"
267 # Try to use $ssldir/include if it exists, otherwise
269 if test -d "$ssldir/include" ; then
270 CFLAGS="-I$ssldir/include $saved_CFLAGS"
272 CFLAGS="-I$ssldir $saved_CFLAGS"
276 # Basic test to check for compatible version and correct linking
277 # *does not* test for RSA - that comes later.
281 #include <openssl/rand.h>
285 memset(a, 0, sizeof(a));
286 RAND_add(a, sizeof(a), sizeof(a));
287 return(RAND_status() <= 0);
296 if test ! -z "$found_crypto" ; then
301 if test -z "$ssldir" ; then
305 if test ! -z "$found_crypto" ; then
306 ac_cv_openssldir=$ssldir
308 ac_cv_openssldir="no"
312 LDFLAGS="$saved_LDFLAGS"
313 CFLAGS="$saved_CFLAGS"
315 if test "x$ac_cv_openssldir" != "xno" ; then
316 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
317 LIBS="-lssl -lcrypto $LIBS"
318 dnl Need to recover ssldir - test above runs in subshell
319 ssldir=$ac_cv_openssldir
320 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
321 # Try to use $ssldir/lib if it exists, otherwise
323 if test -d "$ssldir/lib" ; then
324 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
325 if test ! -z "$need_dash_r" ; then
326 LDFLAGS="-R$ssldir/lib $LDFLAGS"
329 LDFLAGS="-L$ssldir $saved_LDFLAGS"
330 if test ! -z "$need_dash_r" ; then
331 LDFLAGS="-R$ssldir $LDFLAGS"
334 # Try to use $ssldir/include if it exists, otherwise
336 if test -d "$ssldir/include" ; then
337 CFLAGS="-I$ssldir/include $saved_CFLAGS"
339 CFLAGS="-I$ssldir $saved_CFLAGS"
344 dnl Checks for the SSLdir
345 dnl this is a bit different than the rest,
346 dnl because of the citadel used to have a keys/ subdir.
348 [ --with-ssldir directory to store the ssl certificates under],
349 [ if test "x$withval" != "xno" ; then
353 AC_SUBST(MAKE_SSL_DIR)
356 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
361 AC_CHECK_FUNCS(strftime_l uselocale gettext)
363 if test "$ok_nls" != "no"; then
364 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
368 if test "$ok_nls" != "no"; then
369 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
373 if test "$ok_nls" != "no"; then
374 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
378 if test "$ok_nls" != "no"; then
379 AC_MSG_RESULT(WebCit will be built with national language support.)
380 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
381 PROG_SUBDIRS="$PROG_SUBDIRS po"
383 AC_MSG_RESULT(WebCit will be built without national language support.)
388 dnl disable backtrace if we don't want it.
390 [ --with-gprof enable profiling],
391 [ if test "x$withval" != "xno" ; then
392 CFLAGS="$CFLAGS -pg "
393 LDFLAGS="$LDFLAGS -pg "
398 dnl disable backtrace if we don't want it.
399 AC_ARG_WITH(backtrace,
400 [ --with-backtrace enable backtrace dumps in the syslog],
401 [ if test "x$withval" != "xno" ; then
402 CFLAGS="$CFLAGS -rdynamic "
403 LDFLAGS="$LDFLAGS -rdynamic "
404 AC_CHECK_FUNCS(backtrace)
409 if test "$prefix" = NONE; then
410 datadir=$ac_default_prefix
411 localedir=$ac_default_prefix
412 wwwdir=$ac_default_prefix
413 rundir=$ac_default_prefix
414 editordir=$ac_default_prefix/tiny_mce
420 editordir=$prefix/tiny_mce
423 dnl where to put the locale files
424 AC_ARG_WITH(localedir,
425 [ --with-localedir directory to put the locale files to],
426 [ if test "x$withval" != "xno" ; then
431 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
435 dnl Checks where to put our templates
437 [ --with-wwwdir directory to put our templates],
438 [ if test "x$withval" != "xno" ; then
443 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
448 dnl Checks for the run-dir for the sockets
450 [ --with-rundir directory to place runtime files (UDS) to?],
451 [ if test "x$withval" != "xno" ; then
452 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
455 AC_SUBST(MAKE_RUN_DIR)
459 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
461 dnl Checks for the Datadir
463 [ --with-datadir directory to store the databases under],
464 [ if test "x$withval" != "xno" ; then
469 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
471 dnl Checks where to put our editor
472 AC_ARG_WITH(editordir,
473 [ --with-editordir directory to put our editor],
474 [ if test "x$withval" != "xno" ; then
479 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
481 AC_CONFIG_HEADER(sysdep.h)
482 AC_OUTPUT(Makefile po/Makefile )
484 echo ------------------------------------------------------------------------
485 echo 'zlib compression: ' $ok_zlib
486 echo 'Calendar support: ' $ok_libical
487 echo 'Character set conversion support:' $ok_iconv
488 echo 'National language support: ' $ok_nls