1 dnl Process this file with autoconf to produce a configure script.
8 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
9 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
12 AC_SUBST(PROG_SUBDIRS)
16 AC_CHECK_PROG(SED, sed, sed, no)
17 AC_PREFIX_DEFAULT(/usr/local/webcit)
19 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
20 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
21 AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
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 dnl ### missing_dir=`cd $ac_aux_dir && pwd`
68 dnl ### 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 dnl Checks for the newt window library.
148 if test "x$with_newt" != xno ; then
149 AC_CHECK_HEADERS(newt.h,
150 [AC_CHECK_LIB(newt, newtInit,
155 if test "x$ok_newt" = xyes ; then
156 SETUP_LIBS="-lnewt $SETUP_LIBS"
160 # The big search for OpenSSL
161 if test "$with_ssl" != "no"; then
163 saved_LDFLAGS="$LDFLAGS"
164 saved_CFLAGS="$CFLAGS"
165 if test "x$prefix" != "xNONE"; then
166 tryssldir="$tryssldir $prefix"
168 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
169 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
170 CFLAGS="$saved_CFLAGS"
171 LDFLAGS="$saved_LDFLAGS"
172 LIBS="$saved_LIBS -lssl -lcrypto"
174 # Skip directories if they don't exist
175 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
178 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
179 # Try to use $ssldir/lib if it exists, otherwise
181 if test -d "$ssldir/lib" ; then
182 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
183 if test ! -z "$need_dash_r" ; then
184 LDFLAGS="-R$ssldir/lib $LDFLAGS"
187 LDFLAGS="-L$ssldir $saved_LDFLAGS"
188 if test ! -z "$need_dash_r" ; then
189 LDFLAGS="-R$ssldir $LDFLAGS"
192 # Try to use $ssldir/include if it exists, otherwise
194 if test -d "$ssldir/include" ; then
195 CFLAGS="-I$ssldir/include $saved_CFLAGS"
197 CFLAGS="-I$ssldir $saved_CFLAGS"
201 # Basic test to check for compatible version and correct linking
202 # *does not* test for RSA - that comes later.
206 #include <openssl/rand.h>
210 memset(a, 0, sizeof(a));
211 RAND_add(a, sizeof(a), sizeof(a));
212 return(RAND_status() <= 0);
221 if test ! -z "$found_crypto" ; then
226 if test -z "$ssldir" ; then
230 if test ! -z "$found_crypto" ; then
231 ac_cv_openssldir=$ssldir
233 ac_cv_openssldir="no"
237 LDFLAGS="$saved_LDFLAGS"
238 CFLAGS="$saved_CFLAGS"
240 if test "x$ac_cv_openssldir" != "xno" ; then
241 AC_DEFINE(HAVE_OPENSSL)
242 LIBS="-lssl -lcrypto $LIBS"
243 dnl Need to recover ssldir - test above runs in subshell
244 ssldir=$ac_cv_openssldir
245 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
246 # Try to use $ssldir/lib if it exists, otherwise
248 if test -d "$ssldir/lib" ; then
249 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
250 if test ! -z "$need_dash_r" ; then
251 LDFLAGS="-R$ssldir/lib $LDFLAGS"
254 LDFLAGS="-L$ssldir $saved_LDFLAGS"
255 if test ! -z "$need_dash_r" ; then
256 LDFLAGS="-R$ssldir $LDFLAGS"
259 # Try to use $ssldir/include if it exists, otherwise
261 if test -d "$ssldir/include" ; then
262 CFLAGS="-I$ssldir/include $saved_CFLAGS"
264 CFLAGS="-I$ssldir $saved_CFLAGS"
270 dnl Here is the check for a usable iconv
273 [ --disable-iconv do not use iconv charset conversion],
274 ok_iconv=no, ok_iconv=yes)
276 if test "$ok_nls" != "no"; then
277 AC_MSG_RESULT(Checking to see if your system supports iconv...)
281 iconv_t ic = (iconv_t)(-1) ;
282 ic = iconv_open("UTF-8", "us-ascii");
292 if test "$ok_iconv" != "no"; then
293 AC_MSG_RESULT(WebCit will be built with character set conversion.)
294 AC_DEFINE(HAVE_ICONV)
296 AC_MSG_RESULT(WebCit will be built without character set conversion.)
301 dnl Here is the check for libintl etc.
304 [ --disable-nls do not use Native Language Support],
305 ok_nls=no, ok_nls=yes)
307 if test "$ok_nls" != "no"; then
308 AC_MSG_RESULT(Checking to see if your system supports multithreaded NLS...)
315 uselocale(LC_GLOBAL_LOCALE);
316 foo = gettext("bar");
325 if test "$ok_nls" != "no"; then
326 AC_CHECK_PROG(ok_nls, xgettext, yes, no)
329 if test "$ok_nls" != "no"; then
330 AC_CHECK_PROG(ok_nls, msgmerge, yes, no)
333 if test "$ok_nls" != "no"; then
334 AC_CHECK_PROG(ok_nls, msgfmt, yes, no)
337 if test "$ok_nls" != "no"; then
338 AC_MSG_RESULT(WebCit will be built with national language support.)
339 AC_DEFINE(ENABLE_NLS)
340 PROG_SUBDIRS="$PROG_SUBDIRS po"
342 AC_MSG_RESULT(WebCit will be built without national language support.)
347 AC_OUTPUT(Makefile po/Makefile )