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"
69 CFLAGS="$CFLAGS -Wall"
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)
105 dnl Here is the check for a libc integrated iconv
107 [ --disable-iconv do not use iconv charset conversion],
108 ok_iconv=no, ok_iconv=yes)
110 AC_MSG_CHECKING(Checking to see if your system supports iconv)
114 iconv_t ic = (iconv_t)(-1) ;
115 ic = iconv_open("UTF-8", "us-ascii");
130 dnl Check for iconv in external libiconv
131 if test "$ok_iconv" = no; then
132 AC_MSG_CHECKING(Checking for an external libiconv)
133 OLD_LDFLAGS="$LDFLAGS"
134 LDFLAGS="$LDFLAGS -liconv"
138 iconv_t ic = (iconv_t)(-1) ;
139 ic = iconv_open("UTF-8", "us-ascii");
149 LDFLAGS="$OLD_LDFLAGS"
154 if test "$ok_iconv" != "no"; then
155 AC_MSG_RESULT(WebCit will be built with character set conversion.)
156 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
158 AC_MSG_RESULT(WebCit will be built without character set conversion.)
161 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
164 dnl Checks for the libical iCalendar library.
165 AC_CHECK_HEADER(libical/ical.h,
166 [AC_CHECK_LIB(ical, icaltimezone_set_tzid_prefix,
171 AC_MSG_ERROR(libical was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
176 AC_MSG_ERROR(libical/ical.h was not found and is required. More info: http://www.citadel.org/doku.php/installation:start)
181 dnl Check for libcitadel
182 AC_CHECK_HEADER(libcitadel.h,
183 [AC_CHECK_LIB(citadel, libcitadel_version_string,
185 LIBS="-lcitadel $LIBS"
188 AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
193 AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
200 # The big search for OpenSSL
201 if test "$with_ssl" != "no"; then
203 saved_LDFLAGS="$LDFLAGS"
204 saved_CFLAGS="$CFLAGS"
205 if test "x$prefix" != "xNONE"; then
206 tryssldir="$tryssldir $prefix"
208 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
209 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
210 CFLAGS="$saved_CFLAGS"
211 LDFLAGS="$saved_LDFLAGS"
212 LIBS="$saved_LIBS -lssl -lcrypto"
214 # Skip directories if they don't exist
215 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
218 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
219 # Try to use $ssldir/lib if it exists, otherwise
221 if test -d "$ssldir/lib" ; then
222 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
223 if test ! -z "$need_dash_r" ; then
224 LDFLAGS="-R$ssldir/lib $LDFLAGS"
227 LDFLAGS="-L$ssldir $saved_LDFLAGS"
228 if test ! -z "$need_dash_r" ; then
229 LDFLAGS="-R$ssldir $LDFLAGS"
232 # Try to use $ssldir/include if it exists, otherwise
234 if test -d "$ssldir/include" ; then
235 CFLAGS="-I$ssldir/include $saved_CFLAGS"
237 CFLAGS="-I$ssldir $saved_CFLAGS"
241 # Basic test to check for compatible version and correct linking
242 # *does not* test for RSA - that comes later.
246 #include <openssl/rand.h>
250 memset(a, 0, sizeof(a));
251 RAND_add(a, sizeof(a), sizeof(a));
252 return(RAND_status() <= 0);
261 if test ! -z "$found_crypto" ; then
266 if test -z "$ssldir" ; then
270 if test ! -z "$found_crypto" ; then
271 ac_cv_openssldir=$ssldir
273 ac_cv_openssldir="no"
277 LDFLAGS="$saved_LDFLAGS"
278 CFLAGS="$saved_CFLAGS"
280 if test "x$ac_cv_openssldir" != "xno" ; then
281 AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
282 LIBS="-lssl -lcrypto $LIBS"
283 dnl Need to recover ssldir - test above runs in subshell
284 ssldir=$ac_cv_openssldir
285 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
286 # Try to use $ssldir/lib if it exists, otherwise
288 if test -d "$ssldir/lib" ; then
289 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
290 if test ! -z "$need_dash_r" ; then
291 LDFLAGS="-R$ssldir/lib $LDFLAGS"
294 LDFLAGS="-L$ssldir $saved_LDFLAGS"
295 if test ! -z "$need_dash_r" ; then
296 LDFLAGS="-R$ssldir $LDFLAGS"
299 # Try to use $ssldir/include if it exists, otherwise
301 if test -d "$ssldir/include" ; then
302 CFLAGS="-I$ssldir/include $saved_CFLAGS"
304 CFLAGS="-I$ssldir $saved_CFLAGS"
309 dnl Checks for the SSLdir
310 dnl this is a bit different than the rest,
311 dnl because of the citadel used to have a keys/ subdir.
313 [ --with-ssldir directory to store the ssl certificates under],
314 [ if test "x$withval" != "xno" ; then
318 AC_SUBST(MAKE_SSL_DIR)
321 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
326 AC_CHECK_FUNCS(strftime_l uselocale gettext)
328 if test "$ok_nls" != "no"; then
329 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
333 if test "$ok_nls" != "no"; then
334 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
338 if test "$ok_nls" != "no"; then
339 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
343 if test "$ok_nls" != "no"; then
344 AC_MSG_RESULT(WebCit will be built with national language support.)
345 AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
346 PROG_SUBDIRS="$PROG_SUBDIRS po"
348 AC_MSG_RESULT(WebCit will be built without national language support.)
353 dnl disable backtrace if we don't want it.
355 [ --with-gprof enable profiling],
356 [ if test "x$withval" != "xno" ; then
357 CFLAGS="$CFLAGS -pg "
358 LDFLAGS="$LDFLAGS -pg "
363 dnl disable backtrace if we don't want it.
364 AC_ARG_WITH(backtrace,
365 [ --with-backtrace enable backtrace dumps in the syslog],
366 [ if test "x$withval" != "xno" ; then
367 CFLAGS="$CFLAGS -rdynamic "
368 LDFLAGS="$LDFLAGS -rdynamic "
369 AC_CHECK_FUNCS(backtrace)
374 if test "$prefix" = NONE; then
375 datadir=$ac_default_prefix
376 localedir=$ac_default_prefix
377 wwwdir=$ac_default_prefix
378 rundir=$ac_default_prefix
379 editordir=$ac_default_prefix/tiny_mce
385 editordir=$prefix/tiny_mce
388 dnl where to put the locale files
389 AC_ARG_WITH(localedir,
390 [ --with-localedir directory to put the locale files to],
391 [ if test "x$withval" != "xno" ; then
396 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
400 dnl Checks where to put our templates
402 [ --with-wwwdir directory to put our templates],
403 [ if test "x$withval" != "xno" ; then
408 AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
413 dnl Checks for the run-dir for the sockets
415 [ --with-rundir directory to place runtime files (UDS) to?],
416 [ if test "x$withval" != "xno" ; then
417 AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
420 AC_SUBST(MAKE_RUN_DIR)
424 AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])
426 dnl Checks for the Datadir
428 [ --with-datadir directory to store the databases under],
429 [ if test "x$withval" != "xno" ; then
434 AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])
436 dnl Checks where to put our editor
437 AC_ARG_WITH(editordir,
438 [ --with-editordir directory to put our editor],
439 [ if test "x$withval" != "xno" ; then
444 AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])
447 AC_CONFIG_HEADER(sysdep.h)
448 AC_OUTPUT(Makefile po/Makefile )
450 echo ------------------------------------------------------------------------
451 echo 'Character set conversion support:' $ok_iconv
452 echo 'National language support: ' $ok_nls