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 AC_CHECK_PROG(AUTOCONF, autoconf)
17 AC_CHECK_PROG(SED, sed, sed, no)
18 AC_PREFIX_DEFAULT(/usr/local/webcit)
20 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
21 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
23 [ --with-ssl=PATH Specify path to OpenSSL installation ],
25 if test "x$withval" != "xno" ; then
30 dnl Set some system-specific variables which are OK to set before compiler
32 PTHREAD_DEFS=-D_REENTRANT
34 dnl Tru64 Unix requires we use -pthread instead of linking the threads
35 dnl libraries directly, and we can't build threaded programs with gcc
36 dnl due to header file problems.
38 test -z "$CC" && CC=cc
41 dnl FreeBSD is similar:
44 PTHREAD_DEFS=-D_THREAD_SAFE
47 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
50 AC_SUBST(PTHREAD_DEFS)
52 dnl Checks for programs.
55 dnl Configure compiler flags for GCC
56 if test "$GCC" = yes; then
59 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
62 CFLAGS="$CFLAGS -Wall"
67 # missing_dir=`cd $ac_aux_dir && pwd`
68 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
70 dnl Checks for libraries.
71 if test "$LIBS" != -pthread; then
72 AC_CHECK_LIB(pthread, pthread_create)
73 AC_CHECK_LIB(pthreads, pthread_create)
75 AC_SEARCH_LIBS(gethostbyname, nsl)
76 AC_SEARCH_LIBS(connect, socket)
78 dnl Checks for header files.
80 dnl AC_HEADER_SYS_WAIT
81 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
86 dnl Checks for typedefs, structures, and compiler characteristics.
92 dnl Checks for library functions.
95 dnl AC_CHECK_FUNCS(strerror)
96 AC_REPLACE_FUNCS(snprintf)
98 dnl Checks for the libical calendaring library.
99 if test "x$with_libical" != xno ; then
100 AC_CHECK_HEADERS(ical.h,
101 [AC_CHECK_LIB(ical, icalcomponent_new,
106 if test "x$ok_libical" = xyes ; then
113 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
114 v = 100*major + minor;
115 printf("libical version: %i\n", v);
117 printf("This version is ok.\n");
120 printf("libical 0.24 or newer required.\n");
121 printf("Citadel will be built without calendar support.\n");
127 AC_DEFINE(HAVE_LIBICAL)
134 dnl Checks for the zlib compression library.
135 if test "x$with_zlib" != xno ; then
136 AC_CHECK_HEADERS(zlib.h,
137 [AC_CHECK_LIB(z, zlibVersion,
142 if test "x$ok_zlib" = xyes ; then
147 # The big search for OpenSSL
148 if test "$with_ssl" != "no"; then
150 saved_LDFLAGS="$LDFLAGS"
151 saved_CFLAGS="$CFLAGS"
152 if test "x$prefix" != "xNONE"; then
153 tryssldir="$tryssldir $prefix"
155 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
156 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
157 CFLAGS="$saved_CFLAGS"
158 LDFLAGS="$saved_LDFLAGS"
159 LIBS="$saved_LIBS -lssl -lcrypto"
161 # Skip directories if they don't exist
162 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
165 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
166 # Try to use $ssldir/lib if it exists, otherwise
168 if test -d "$ssldir/lib" ; then
169 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
170 if test ! -z "$need_dash_r" ; then
171 LDFLAGS="-R$ssldir/lib $LDFLAGS"
174 LDFLAGS="-L$ssldir $saved_LDFLAGS"
175 if test ! -z "$need_dash_r" ; then
176 LDFLAGS="-R$ssldir $LDFLAGS"
179 # Try to use $ssldir/include if it exists, otherwise
181 if test -d "$ssldir/include" ; then
182 CFLAGS="-I$ssldir/include $saved_CFLAGS"
184 CFLAGS="-I$ssldir $saved_CFLAGS"
188 # Basic test to check for compatible version and correct linking
189 # *does not* test for RSA - that comes later.
193 #include <openssl/rand.h>
197 memset(a, 0, sizeof(a));
198 RAND_add(a, sizeof(a), sizeof(a));
199 return(RAND_status() <= 0);
208 if test ! -z "$found_crypto" ; then
213 if test -z "$ssldir" ; then
217 if test ! -z "$found_crypto" ; then
218 ac_cv_openssldir=$ssldir
220 ac_cv_openssldir="no"
224 LDFLAGS="$saved_LDFLAGS"
225 CFLAGS="$saved_CFLAGS"
227 if test "x$ac_cv_openssldir" != "xno" ; then
228 AC_DEFINE(HAVE_OPENSSL)
229 LIBS="-lssl -lcrypto $LIBS"
230 dnl Need to recover ssldir - test above runs in subshell
231 ssldir=$ac_cv_openssldir
232 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
233 # Try to use $ssldir/lib if it exists, otherwise
235 if test -d "$ssldir/lib" ; then
236 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
237 if test ! -z "$need_dash_r" ; then
238 LDFLAGS="-R$ssldir/lib $LDFLAGS"
241 LDFLAGS="-L$ssldir $saved_LDFLAGS"
242 if test ! -z "$need_dash_r" ; then
243 LDFLAGS="-R$ssldir $LDFLAGS"
246 # Try to use $ssldir/include if it exists, otherwise
248 if test -d "$ssldir/include" ; then
249 CFLAGS="-I$ssldir/include $saved_CFLAGS"
251 CFLAGS="-I$ssldir $saved_CFLAGS"
257 dnl Here is the check for a usable iconv
260 [ --disable-iconv do not use iconv charset conversion],
261 ok_iconv=no, ok_iconv=yes)
263 if test "$ok_nls" != "no"; then
264 AC_MSG_RESULT(Checking to see if your system supports iconv...)
268 iconv_t ic = (iconv_t)(-1) ;
269 ic = iconv_open("UTF-8", "us-ascii");
279 if test "$ok_iconv" != "no"; then
280 AC_MSG_RESULT(WebCit will be built with character set conversion.)
281 AC_DEFINE(HAVE_ICONV)
283 AC_MSG_RESULT(WebCit will be built without character set conversion.)
288 dnl Here is the check for libintl etc.
291 [ --disable-nls do not use Native Language Support],
292 ok_nls=no, ok_nls=yes)
294 if test "$ok_nls" != "no"; then
295 AC_MSG_RESULT(Checking for per-thread NLS support...)
305 uselocale(LC_GLOBAL_LOCALE);
306 foo = gettext("bar");
308 strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
319 if test "$ok_nls" != "no"; then
320 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
324 if test "$ok_nls" != "no"; then
325 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
329 if test "$ok_nls" != "no"; then
330 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
334 if test "$ok_nls" != "no"; then
335 AC_MSG_RESULT(WebCit will be built with national language support.)
336 AC_DEFINE(ENABLE_NLS)
337 PROG_SUBDIRS="$PROG_SUBDIRS po"
339 AC_MSG_RESULT(WebCit will be built without national language support.)
344 AC_OUTPUT(Makefile po/Makefile )
346 echo ------------------------------------------------------------------------
347 echo 'zlib compression: ' $ok_zlib
348 echo 'Calendar support: ' $ok_libical
349 echo 'Character set conversion support:' $ok_iconv
350 echo 'National language support: ' $ok_nls