1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.24], [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)
104 dnl Check for libcitadel
105 AC_CHECK_HEADER(libcitadel.h,
106 [AC_CHECK_LIB(citadel, libcitadel_version_string,
108 LIBS="-lcitadel $LIBS"
111 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
116 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
121 webcit_with_calendar_service=no
122 dnl Checks for the libical calendaring library.
123 if test "x$with_libical" != xno ; then
124 AC_CHECK_HEADERS(ical.h,
125 [AC_CHECK_LIB(ical, icalcomponent_new,
130 if test "x$ok_libical" = xyes ; then
137 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
138 v = 100*major + minor;
139 printf("libical version: %i\n", v);
141 printf("This version is ok.\n");
144 printf("libical 0.30 or newer required.\n");
145 printf("Citadel will be built without calendar support.\n");
151 AC_DEFINE(HAVE_LIBICAL,[],[whether we have libical available])
152 webcit_with_calendar_service=yes
156 ok_libical=$webcit_with_calendar_service
159 if test "$webcit_with_calendar_service" == "yes"; then
160 AC_DEFINE(WEBCIT_WITH_CALENDAR_SERVICE,[],[whether we can do with calendar.])
163 dnl Checks for the zlib compression library.
164 if test "x$with_zlib" != xno ; then
165 AC_CHECK_HEADERS(zlib.h,
166 [AC_CHECK_LIB(z, zlibVersion,
171 if test "x$ok_zlib" = xyes ; then
173 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
177 # The big search for OpenSSL
178 if test "$with_ssl" != "no"; then
180 saved_LDFLAGS="$LDFLAGS"
181 saved_CFLAGS="$CFLAGS"
182 if test "x$prefix" != "xNONE"; then
183 tryssldir="$tryssldir $prefix"
185 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
186 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
187 CFLAGS="$saved_CFLAGS"
188 LDFLAGS="$saved_LDFLAGS"
189 LIBS="$saved_LIBS -lssl -lcrypto"
191 # Skip directories if they don't exist
192 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
195 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
196 # Try to use $ssldir/lib if it exists, otherwise
198 if test -d "$ssldir/lib" ; then
199 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
200 if test ! -z "$need_dash_r" ; then
201 LDFLAGS="-R$ssldir/lib $LDFLAGS"
204 LDFLAGS="-L$ssldir $saved_LDFLAGS"
205 if test ! -z "$need_dash_r" ; then
206 LDFLAGS="-R$ssldir $LDFLAGS"
209 # Try to use $ssldir/include if it exists, otherwise
211 if test -d "$ssldir/include" ; then
212 CFLAGS="-I$ssldir/include $saved_CFLAGS"
214 CFLAGS="-I$ssldir $saved_CFLAGS"
218 # Basic test to check for compatible version and correct linking
219 # *does not* test for RSA - that comes later.
223 #include <openssl/rand.h>
227 memset(a, 0, sizeof(a));
228 RAND_add(a, sizeof(a), sizeof(a));
229 return(RAND_status() <= 0);
238 if test ! -z "$found_crypto" ; then
243 if test -z "$ssldir" ; then
247 if test ! -z "$found_crypto" ; then
248 ac_cv_openssldir=$ssldir
250 ac_cv_openssldir="no"
254 LDFLAGS="$saved_LDFLAGS"
255 CFLAGS="$saved_CFLAGS"
257 if test "x$ac_cv_openssldir" != "xno" ; then
258 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
259 LIBS="-lssl -lcrypto $LIBS"
260 dnl Need to recover ssldir - test above runs in subshell
261 ssldir=$ac_cv_openssldir
262 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
263 # Try to use $ssldir/lib if it exists, otherwise
265 if test -d "$ssldir/lib" ; then
266 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
267 if test ! -z "$need_dash_r" ; then
268 LDFLAGS="-R$ssldir/lib $LDFLAGS"
271 LDFLAGS="-L$ssldir $saved_LDFLAGS"
272 if test ! -z "$need_dash_r" ; then
273 LDFLAGS="-R$ssldir $LDFLAGS"
276 # Try to use $ssldir/include if it exists, otherwise
278 if test -d "$ssldir/include" ; then
279 CFLAGS="-I$ssldir/include $saved_CFLAGS"
281 CFLAGS="-I$ssldir $saved_CFLAGS"
286 dnl Checks for the SSLdir
287 dnl this is a bit different than the rest,
288 dnl because of the citadel used to have a keys/ subdir.
290 [ --with-ssldir directory to store the ssl certificates under],
291 [ if test "x$withval" != "xno" ; then
295 AC_SUBST(MAKE_SSL_DIR)
298 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
300 dnl Here is the check for a usable iconv
303 [ --disable-iconv do not use iconv charset conversion],
304 ok_iconv=no, ok_iconv=yes)
306 if test "$ok_nls" != "no"; then
307 AC_MSG_RESULT(Checking to see if your system supports iconv...)
311 iconv_t ic = (iconv_t)(-1) ;
312 ic = iconv_open("UTF-8", "us-ascii");
322 if test "$ok_iconv" = "no"; then
323 LD_FLAGS_BEFORE=$LDFLAGS
324 LDFLAGS="$LDFLAGS -liconv"
328 iconv_t ic = (iconv_t)(-1) ;
329 ic = iconv_open("UTF-8", "us-ascii");
337 if test "$ok_iconv" != "no"; then
338 LDFLAGS=$LD_FLAGS_BEFORE
343 if test "$ok_iconv" != "no"; then
344 AC_MSG_RESULT(WebCit will be built with character set conversion.)
345 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
347 AC_MSG_RESULT(WebCit will be built without character set conversion.)
352 dnl Here is the check for libintl etc.
355 [ --disable-nls do not use Native Language Support],
356 ok_nls=no, ok_nls=yes)
358 if test "$ok_nls" != "no"; then
359 AC_MSG_RESULT(Checking for per-thread NLS support...)
369 uselocale(LC_GLOBAL_LOCALE);
370 foo = gettext("bar");
372 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
383 if test "$ok_nls" != "no"; then
384 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
388 if test "$ok_nls" != "no"; then
389 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
393 if test "$ok_nls" != "no"; then
394 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
398 if test "$ok_nls" != "no"; then
399 AC_MSG_RESULT(WebCit will be built with national language support.)
400 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
401 PROG_SUBDIRS="$PROG_SUBDIRS po"
403 AC_MSG_RESULT(WebCit will be built without national language support.)
408 dnl disable backtrace if we don't want it.
410 [ --with-gprof enable profiling],
411 [ if test "x$withval" != "xno" ; then
412 CFLAGS="$CFLAGS -pg "
413 LDFLAGS="$LDFLAGS -pg "
418 dnl disable backtrace if we don't want it.
419 AC_ARG_WITH(backtrace,
420 [ --with-backtrace enable backtrace dumps in the syslog],
421 [ if test "x$withval" != "xno" ; then
422 CFLAGS="$CFLAGS -rdynamic "
423 LDFLAGS="$LDFLAGS -rdynamic "
424 AC_CHECK_FUNCS(backtrace)
429 if test "$prefix" = NONE; then
430 datadir=$ac_default_prefix
431 localedir=$ac_default_prefix
432 wwwdir=$ac_default_prefix
433 rundir=$ac_default_prefix
434 editordir=$ac_default_prefix/tiny_mce
440 editordir=$prefix/tiny_mce
443 dnl where to put the locale files
444 AC_ARG_WITH(localedir,
445 [ --with-localedir directory to put the locale files to],
446 [ if test "x$withval" != "xno" ; then
451 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
455 dnl Checks where to put our templates
457 [ --with-wwwdir directory to put our templates],
458 [ if test "x$withval" != "xno" ; then
463 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
468 dnl Checks for the run-dir for the sockets
470 [ --with-rundir directory to place runtime files (UDS) to?],
471 [ if test "x$withval" != "xno" ; then
472 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
475 AC_SUBST(MAKE_RUN_DIR)
479 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
481 dnl Checks for the Datadir
483 [ --with-datadir directory to store the databases under],
484 [ if test "x$withval" != "xno" ; then
489 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
491 dnl Checks where to put our editor
492 AC_ARG_WITH(editordir,
493 [ --with-editordir directory to put our editor],
494 [ if test "x$withval" != "xno" ; then
499 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
501 AC_CONFIG_HEADER(sysdep.h)
502 AC_OUTPUT(Makefile po/Makefile )
504 echo ------------------------------------------------------------------------
505 echo 'zlib compression: ' $ok_zlib
506 echo 'Calendar support: ' $ok_libical
507 echo 'Character set conversion support:' $ok_iconv
508 echo 'National language support: ' $ok_nls