1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([WebCit], [7.37], [http://www.citadel.org/])
7 AC_DEFINE(PROG_SUBDIRS, [], [Program dirs])
10 missing_dir=`cd $ac_aux_dir && pwd`
11 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
12 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
14 dnl Make sure we see all GNU and Solaris extensions.
17 AC_CHECK_PROG(SED, sed, sed, no)
18 AC_PREFIX_DEFAULT(/usr/local/webcit)
19 if test "$prefix" = NONE; then
20 AC_DEFINE_UNQUOTED(WEBCITDIR, "$ac_default_prefix", [define this to the Citadel home directory])
21 ssl_dir="$ac_default_prefix/keys"
23 AC_DEFINE_UNQUOTED(WEBCITDIR, "$prefix", [define this to the Citadel home directory])
24 ssl_dir="$prefix/keys"
28 [ --with-ssl=PATH Specify path to OpenSSL installation ],
30 if test "x$withval" != "xno" ; then
35 dnl Set some system-specific variables which are OK to set before compiler
37 PTHREAD_DEFS=-D_REENTRANT
39 dnl Tru64 Unix requires we use -pthread instead of linking the threads
40 dnl libraries directly, and we can't build threaded programs with gcc
41 dnl due to header file problems.
43 test -z "$CC" && CC=cc
46 dnl FreeBSD is similar:
49 PTHREAD_DEFS=-D_THREAD_SAFE
52 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
57 AC_SUBST(PTHREAD_DEFS)
59 dnl Checks for programs.
62 dnl Configure compiler flags for GCC
63 if test "$GCC" = yes; then
66 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts --pedantic"
69 CFLAGS="$CFLAGS -Wall --pedantic"
74 # missing_dir=`cd $ac_aux_dir && pwd`
75 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
77 dnl Checks for libraries.
78 if test "$LIBS" != -pthread; then
79 AC_CHECK_LIB(pthread, pthread_create)
80 AC_CHECK_LIB(pthreads, pthread_create)
82 AC_SEARCH_LIBS(gethostbyname, nsl)
83 AC_SEARCH_LIBS(connect, socket)
85 dnl Checks for header files.
87 dnl AC_HEADER_SYS_WAIT
92 dnl Checks for typedefs, structures, and compiler characteristics.
98 dnl Checks for library functions.
101 AC_REPLACE_FUNCS(snprintf)
102 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h xlocale.h)
104 dnl Checks for the zlib compression library.
105 if test "x$with_zlib" != xno ; then
106 AC_CHECK_HEADERS(zlib.h,
107 [AC_CHECK_LIB(z, zlibVersion,
112 if test "x$ok_zlib" = xyes ; then
113 dnl libcitadel will bring libz, so we don't need it here. LDFLAGS="-lz $LDFLAGS"
114 AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
117 dnl Here is the check for a libc integrated iconv
119 [ --disable-iconv do not use iconv charset conversion],
120 ok_iconv=no, ok_iconv=yes)
122 AC_MSG_CHECKING(Checking to see if your system supports iconv)
126 iconv_t ic = (iconv_t)(-1) ;
127 ic = iconv_open("UTF-8", "us-ascii");
142 dnl Check for iconv in external libiconv
143 if test "$ok_iconv" = no; then
144 AC_MSG_CHECKING(Checking for an external libiconv)
145 OLD_LDFLAGS="$LDFLAGS"
146 LDFLAGS="$LDFLAGS -liconv"
150 iconv_t ic = (iconv_t)(-1) ;
151 ic = iconv_open("UTF-8", "us-ascii");
161 LDFLAGS="$OLD_LDFLAGS"
166 if test "$ok_iconv" != "no"; then
167 AC_MSG_RESULT(WebCit will be built with character set conversion.)
168 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
170 AC_MSG_RESULT(WebCit will be built without character set conversion.)
173 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
176 dnl Checks for the libical iCalendar library.
177 AC_CHECK_HEADER(libical/ical.h,
178 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
183 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
188 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
193 dnl Check for libcitadel
194 AC_CHECK_HEADER(libcitadel.h,
195 [AC_CHECK_LIB(citadel, libcitadel_version_string,
197 LIBS="-lcitadel $LIBS"
198 SETUP_LIBS="-lcitadel $SETUP_LIBS"
201 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
206 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
213 # The big search for OpenSSL
214 if test "$with_ssl" != "no"; then
216 saved_LDFLAGS="$LDFLAGS"
217 saved_CFLAGS="$CFLAGS"
218 if test "x$prefix" != "xNONE"; then
219 tryssldir="$tryssldir $prefix"
221 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
222 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
223 CFLAGS="$saved_CFLAGS"
224 LDFLAGS="$saved_LDFLAGS"
225 LIBS="$saved_LIBS -lssl -lcrypto"
227 # Skip directories if they don't exist
228 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
231 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
232 # Try to use $ssldir/lib if it exists, otherwise
234 if test -d "$ssldir/lib" ; then
235 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
236 if test ! -z "$need_dash_r" ; then
237 LDFLAGS="-R$ssldir/lib $LDFLAGS"
240 LDFLAGS="-L$ssldir $saved_LDFLAGS"
241 if test ! -z "$need_dash_r" ; then
242 LDFLAGS="-R$ssldir $LDFLAGS"
245 # Try to use $ssldir/include if it exists, otherwise
247 if test -d "$ssldir/include" ; then
248 CFLAGS="-I$ssldir/include $saved_CFLAGS"
250 CFLAGS="-I$ssldir $saved_CFLAGS"
254 # Basic test to check for compatible version and correct linking
255 # *does not* test for RSA - that comes later.
259 #include <openssl/rand.h>
263 memset(a, 0, sizeof(a));
264 RAND_add(a, sizeof(a), sizeof(a));
265 return(RAND_status() <= 0);
274 if test ! -z "$found_crypto" ; then
279 if test -z "$ssldir" ; then
283 if test ! -z "$found_crypto" ; then
284 ac_cv_openssldir=$ssldir
286 ac_cv_openssldir="no"
290 LDFLAGS="$saved_LDFLAGS"
291 CFLAGS="$saved_CFLAGS"
293 if test "x$ac_cv_openssldir" != "xno" ; then
294 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
296 LIBS="-lssl -lcrypto $LIBS"
297 dnl Need to recover ssldir - test above runs in subshell
298 ssldir=$ac_cv_openssldir
299 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
300 # Try to use $ssldir/lib if it exists, otherwise
302 if test -d "$ssldir/lib" ; then
303 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
304 if test ! -z "$need_dash_r" ; then
305 LDFLAGS="-R$ssldir/lib $LDFLAGS"
308 LDFLAGS="-L$ssldir $saved_LDFLAGS"
309 if test ! -z "$need_dash_r" ; then
310 LDFLAGS="-R$ssldir $LDFLAGS"
313 # Try to use $ssldir/include if it exists, otherwise
315 if test -d "$ssldir/include" ; then
316 CFLAGS="-I$ssldir/include $saved_CFLAGS"
318 CFLAGS="-I$ssldir $saved_CFLAGS"
323 dnl Checks for the SSLdir
324 dnl this is a bit different than the rest,
325 dnl because of the citadel used to have a keys/ subdir.
327 [ --with-ssldir directory to store the ssl certificates under],
328 [ if test "x$withval" != "xno" ; then
331 if test "$found_ssl" = "no"; then
332 echo "Your setup was incomplete; ssldir doesn't make sense without openssl"
336 AC_SUBST(MAKE_SSL_DIR)
339 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
344 AC_CHECK_FUNCS(strftime_l uselocale gettext)
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])
418 dnl Checks where to put our templates
420 [ --with-wwwdir directory to put our templates],
421 [ if test "x$withval" != "xno" ; then
426 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
431 dnl Checks for the run-dir for the sockets
433 [ --with-rundir directory to place runtime files (UDS) to?],
434 [ if test "x$withval" != "xno" ; then
435 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
438 AC_SUBST(MAKE_RUN_DIR)
442 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
444 dnl Checks for the Datadir
446 [ --with-datadir directory to store the databases under],
447 [ if test "x$withval" != "xno" ; then
452 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
454 dnl Checks where to put our editor
455 AC_ARG_WITH(editordir,
456 [ --with-editordir directory to put our editor],
457 [ if test "x$withval" != "xno" ; then
462 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
465 AC_CONFIG_HEADER(sysdep.h)
466 AC_OUTPUT(Makefile po/Makefile )
468 echo ------------------------------------------------------------------------
469 echo 'Character set conversion support:' $ok_iconv
470 echo 'National language support: ' $ok_nls
471 echo 'Compression support: ' $ok_zlib