1 dnl Process this file with autoconf to produce a configure script.
8 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
9 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
15 AC_PREFIX_DEFAULT(/usr/local/webcit)
17 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
18 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
19 AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
21 [ --with-ssl=PATH Specify path to OpenSSL installation ],
23 if test "x$withval" != "xno" ; then
28 dnl Set some system-specific variables which are OK to set before compiler
30 PTHREAD_DEFS=-D_REENTRANT
32 dnl Tru64 Unix requires we use -pthread instead of linking the threads
33 dnl libraries directly, and we can't build threaded programs with gcc
34 dnl due to header file problems.
36 test -z "$CC" && CC=cc
39 dnl FreeBSD is similar:
42 PTHREAD_DEFS=-D_THREAD_SAFE
45 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
48 AC_SUBST(PTHREAD_DEFS)
50 dnl Checks for programs.
53 dnl Configure compiler flags for GCC
54 if test "$GCC" = yes; then
57 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
60 CFLAGS="$CFLAGS -Wall"
65 missing_dir=`cd $ac_aux_dir && pwd`
66 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
68 dnl Checks for libraries.
69 if test "$LIBS" != -pthread; then
70 AC_CHECK_LIB(pthread, pthread_create)
71 AC_CHECK_LIB(pthreads, pthread_create)
73 AC_SEARCH_LIBS(gethostbyname, nsl)
74 AC_SEARCH_LIBS(connect, socket)
76 dnl Checks for header files.
78 dnl AC_HEADER_SYS_WAIT
79 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
81 dnl Checks for typedefs, structures, and compiler characteristics.
87 dnl Checks for library functions.
90 dnl AC_CHECK_FUNCS(strerror)
91 AC_REPLACE_FUNCS(snprintf)
93 dnl Checks for the libical calendaring library.
94 if test "x$with_libical" != xno ; then
95 AC_CHECK_HEADERS(ical.h,
96 [AC_CHECK_LIB(ical, icalcomponent_new,
101 if test "x$ok_libical" = xyes ; then
108 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
109 v = 100*major + minor;
110 printf("libical version: %i\n", v);
112 printf("This version is ok.\n");
115 printf("libical 0.24 or newer required.\n");
116 printf("Citadel will be built without calendar support.\n");
122 AC_DEFINE(HAVE_LIBICAL)
129 dnl Checks for the zlib compression library.
130 if test "x$with_zlib" != xno ; then
131 AC_CHECK_HEADERS(zlib.h,
132 [AC_CHECK_LIB(z, zlibVersion,
137 if test "x$ok_zlib" = xyes ; then
142 dnl Checks for the newt window library.
143 if test "x$with_newt" != xno ; then
144 AC_CHECK_HEADERS(newt.h,
145 [AC_CHECK_LIB(newt, newtInit,
150 if test "x$ok_newt" = xyes ; then
151 SETUP_LIBS="-lnewt $SETUP_LIBS"
155 # The big search for OpenSSL
156 if test "$with_ssl" != "no"; then
158 saved_LDFLAGS="$LDFLAGS"
159 saved_CFLAGS="$CFLAGS"
160 if test "x$prefix" != "xNONE"; then
161 tryssldir="$tryssldir $prefix"
163 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
164 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
165 CFLAGS="$saved_CFLAGS"
166 LDFLAGS="$saved_LDFLAGS"
167 LIBS="$saved_LIBS -lssl -lcrypto"
169 # Skip directories if they don't exist
170 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
173 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
174 # Try to use $ssldir/lib if it exists, otherwise
176 if test -d "$ssldir/lib" ; then
177 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
178 if test ! -z "$need_dash_r" ; then
179 LDFLAGS="-R$ssldir/lib $LDFLAGS"
182 LDFLAGS="-L$ssldir $saved_LDFLAGS"
183 if test ! -z "$need_dash_r" ; then
184 LDFLAGS="-R$ssldir $LDFLAGS"
187 # Try to use $ssldir/include if it exists, otherwise
189 if test -d "$ssldir/include" ; then
190 CFLAGS="-I$ssldir/include $saved_CFLAGS"
192 CFLAGS="-I$ssldir $saved_CFLAGS"
196 # Basic test to check for compatible version and correct linking
197 # *does not* test for RSA - that comes later.
201 #include <openssl/rand.h>
205 memset(a, 0, sizeof(a));
206 RAND_add(a, sizeof(a), sizeof(a));
207 return(RAND_status() <= 0);
216 if test ! -z "$found_crypto" ; then
221 if test -z "$ssldir" ; then
225 if test ! -z "$found_crypto" ; then
226 ac_cv_openssldir=$ssldir
228 ac_cv_openssldir="no"
232 LDFLAGS="$saved_LDFLAGS"
233 CFLAGS="$saved_CFLAGS"
235 if test "x$ac_cv_openssldir" != "xno" ; then
236 AC_DEFINE(HAVE_OPENSSL)
237 LIBS="-lssl -lcrypto $LIBS"
238 dnl Need to recover ssldir - test above runs in subshell
239 ssldir=$ac_cv_openssldir
240 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
241 # Try to use $ssldir/lib if it exists, otherwise
243 if test -d "$ssldir/lib" ; then
244 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
245 if test ! -z "$need_dash_r" ; then
246 LDFLAGS="-R$ssldir/lib $LDFLAGS"
249 LDFLAGS="-L$ssldir $saved_LDFLAGS"
250 if test ! -z "$need_dash_r" ; then
251 LDFLAGS="-R$ssldir $LDFLAGS"
254 # Try to use $ssldir/include if it exists, otherwise
256 if test -d "$ssldir/include" ; then
257 CFLAGS="-I$ssldir/include $saved_CFLAGS"
259 CFLAGS="-I$ssldir $saved_CFLAGS"
269 AC_OUTPUT(Makefile intl/Makefile po/Makefile.in )