1 dnl Process this file with autoconf to produce a configure script.
8 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
9 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
13 AC_SUBST(PROG_SUBDIRS)
16 missing_dir=`cd $ac_aux_dir && pwd`
17 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
18 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
19 AC_CHECK_PROG(SED, sed, sed, no)
20 AC_PREFIX_DEFAULT(/usr/local/webcit)
22 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
23 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
25 [ --with-ssl=PATH Specify path to OpenSSL installation ],
27 if test "x$withval" != "xno" ; then
32 dnl Set some system-specific variables which are OK to set before compiler
34 PTHREAD_DEFS=-D_REENTRANT
36 dnl Tru64 Unix requires we use -pthread instead of linking the threads
37 dnl libraries directly, and we can't build threaded programs with gcc
38 dnl due to header file problems.
40 test -z "$CC" && CC=cc
43 dnl FreeBSD is similar:
46 PTHREAD_DEFS=-D_THREAD_SAFE
49 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
52 AC_SUBST(PTHREAD_DEFS)
54 dnl Checks for programs.
57 dnl Configure compiler flags for GCC
58 if test "$GCC" = yes; then
61 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
64 CFLAGS="$CFLAGS -Wall"
69 # missing_dir=`cd $ac_aux_dir && pwd`
70 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
72 dnl Checks for libraries.
73 if test "$LIBS" != -pthread; then
74 AC_CHECK_LIB(pthread, pthread_create)
75 AC_CHECK_LIB(pthreads, pthread_create)
77 AC_SEARCH_LIBS(gethostbyname, nsl)
78 AC_SEARCH_LIBS(connect, socket)
80 dnl Checks for header files.
82 dnl AC_HEADER_SYS_WAIT
83 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
88 dnl Checks for typedefs, structures, and compiler characteristics.
94 dnl Checks for library functions.
97 dnl AC_CHECK_FUNCS(strerror)
98 AC_REPLACE_FUNCS(snprintf)
100 dnl Checks for the libical calendaring library.
101 if test "x$with_libical" != xno ; then
102 AC_CHECK_HEADERS(ical.h,
103 [AC_CHECK_LIB(ical, icalcomponent_new,
108 if test "x$ok_libical" = xyes ; then
115 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
116 v = 100*major + minor;
117 printf("libical version: %i\n", v);
119 printf("This version is ok.\n");
122 printf("libical 0.24 or newer required.\n");
123 printf("Citadel will be built without calendar support.\n");
129 AC_DEFINE(HAVE_LIBICAL)
136 dnl Checks for the zlib compression library.
137 if test "x$with_zlib" != xno ; then
138 AC_CHECK_HEADERS(zlib.h,
139 [AC_CHECK_LIB(z, zlibVersion,
144 if test "x$ok_zlib" = xyes ; then
149 # The big search for OpenSSL
150 if test "$with_ssl" != "no"; then
152 saved_LDFLAGS="$LDFLAGS"
153 saved_CFLAGS="$CFLAGS"
154 if test "x$prefix" != "xNONE"; then
155 tryssldir="$tryssldir $prefix"
157 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
158 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
159 CFLAGS="$saved_CFLAGS"
160 LDFLAGS="$saved_LDFLAGS"
161 LIBS="$saved_LIBS -lssl -lcrypto"
163 # Skip directories if they don't exist
164 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
167 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
168 # Try to use $ssldir/lib if it exists, otherwise
170 if test -d "$ssldir/lib" ; then
171 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
172 if test ! -z "$need_dash_r" ; then
173 LDFLAGS="-R$ssldir/lib $LDFLAGS"
176 LDFLAGS="-L$ssldir $saved_LDFLAGS"
177 if test ! -z "$need_dash_r" ; then
178 LDFLAGS="-R$ssldir $LDFLAGS"
181 # Try to use $ssldir/include if it exists, otherwise
183 if test -d "$ssldir/include" ; then
184 CFLAGS="-I$ssldir/include $saved_CFLAGS"
186 CFLAGS="-I$ssldir $saved_CFLAGS"
190 # Basic test to check for compatible version and correct linking
191 # *does not* test for RSA - that comes later.
195 #include <openssl/rand.h>
199 memset(a, 0, sizeof(a));
200 RAND_add(a, sizeof(a), sizeof(a));
201 return(RAND_status() <= 0);
210 if test ! -z "$found_crypto" ; then
215 if test -z "$ssldir" ; then
219 if test ! -z "$found_crypto" ; then
220 ac_cv_openssldir=$ssldir
222 ac_cv_openssldir="no"
226 LDFLAGS="$saved_LDFLAGS"
227 CFLAGS="$saved_CFLAGS"
229 if test "x$ac_cv_openssldir" != "xno" ; then
230 AC_DEFINE(HAVE_OPENSSL)
231 LIBS="-lssl -lcrypto $LIBS"
232 dnl Need to recover ssldir - test above runs in subshell
233 ssldir=$ac_cv_openssldir
234 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
235 # Try to use $ssldir/lib if it exists, otherwise
237 if test -d "$ssldir/lib" ; then
238 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
239 if test ! -z "$need_dash_r" ; then
240 LDFLAGS="-R$ssldir/lib $LDFLAGS"
243 LDFLAGS="-L$ssldir $saved_LDFLAGS"
244 if test ! -z "$need_dash_r" ; then
245 LDFLAGS="-R$ssldir $LDFLAGS"
248 # Try to use $ssldir/include if it exists, otherwise
250 if test -d "$ssldir/include" ; then
251 CFLAGS="-I$ssldir/include $saved_CFLAGS"
253 CFLAGS="-I$ssldir $saved_CFLAGS"
259 dnl Here is the check for a usable iconv
262 [ --disable-iconv do not use iconv charset conversion],
263 ok_iconv=no, ok_iconv=yes)
265 if test "$ok_nls" != "no"; then
266 AC_MSG_RESULT(Checking to see if your system supports iconv...)
270 iconv_t ic = (iconv_t)(-1) ;
271 ic = iconv_open("UTF-8", "us-ascii");
281 if test "$ok_iconv" != "no"; then
282 AC_MSG_RESULT(WebCit will be built with character set conversion.)
283 AC_DEFINE(HAVE_ICONV)
285 AC_MSG_RESULT(WebCit will be built without character set conversion.)
290 dnl Here is the check for libintl etc.
293 [ --disable-nls do not use Native Language Support],
294 ok_nls=no, ok_nls=yes)
296 if test "$ok_nls" != "no"; then
297 AC_MSG_RESULT(Checking for per-thread NLS support...)
307 uselocale(LC_GLOBAL_LOCALE);
308 foo = gettext("bar");
310 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
321 if test "$ok_nls" != "no"; then
322 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
326 if test "$ok_nls" != "no"; then
327 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
331 if test "$ok_nls" != "no"; then
332 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
336 if test "$ok_nls" != "no"; then
337 AC_MSG_RESULT(WebCit will be built with national language support.)
338 AC_DEFINE(ENABLE_NLS)
339 PROG_SUBDIRS="$PROG_SUBDIRS po"
341 AC_MSG_RESULT(WebCit will be built without national language support.)
347 if test "$prefix" = NONE; then
348 LOCALEDIR=$ac_default_prefix
349 WWWDIR=$ac_default_prefix
350 EDITORDIR=$ac_default_prefix/tiny_mce
354 EDITORDIR=$prefix/tiny_mce
357 dnl where to put the locale files
358 AC_ARG_WITH(localedir,
359 [ --with-localedir directory to put the locale files to],
360 [ if test "x$withval" != "xno" ; then
367 dnl Checks where to put our templates
369 [ --with-wwwdir directory to put our templates],
370 [ if test "x$withval" != "xno" ; then
377 dnl Checks where to put our editor
378 AC_ARG_WITH(editordir,
379 [ --with-editordir directory to put our editor],
380 [ if test "x$withval" != "xno" ; then
388 AC_OUTPUT(Makefile po/Makefile )
390 echo ------------------------------------------------------------------------
391 echo 'zlib compression: ' $ok_zlib
392 echo 'Calendar support: ' $ok_libical
393 echo 'Character set conversion support:' $ok_iconv
394 echo 'National language support: ' $ok_nls