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)
84 dnl Checks for typedefs, structures, and compiler characteristics.
90 dnl Checks for library functions.
93 dnl AC_CHECK_FUNCS(strerror)
94 AC_REPLACE_FUNCS(snprintf)
96 dnl Checks for the libical calendaring library.
97 if test "x$with_libical" != xno ; then
98 AC_CHECK_HEADERS(ical.h,
99 [AC_CHECK_LIB(ical, icalcomponent_new,
104 if test "x$ok_libical" = xyes ; then
111 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
112 v = 100*major + minor;
113 printf("libical version: %i\n", v);
115 printf("This version is ok.\n");
118 printf("libical 0.24 or newer required.\n");
119 printf("Citadel will be built without calendar support.\n");
125 AC_DEFINE(HAVE_LIBICAL)
132 dnl Checks for the zlib compression library.
133 if test "x$with_zlib" != xno ; then
134 AC_CHECK_HEADERS(zlib.h,
135 [AC_CHECK_LIB(z, zlibVersion,
140 if test "x$ok_zlib" = xyes ; then
145 dnl Checks for the newt window library.
146 if test "x$with_newt" != xno ; then
147 AC_CHECK_HEADERS(newt.h,
148 [AC_CHECK_LIB(newt, newtInit,
153 if test "x$ok_newt" = xyes ; then
154 SETUP_LIBS="-lnewt $SETUP_LIBS"
158 # The big search for OpenSSL
159 if test "$with_ssl" != "no"; then
161 saved_LDFLAGS="$LDFLAGS"
162 saved_CFLAGS="$CFLAGS"
163 if test "x$prefix" != "xNONE"; then
164 tryssldir="$tryssldir $prefix"
166 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
167 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
168 CFLAGS="$saved_CFLAGS"
169 LDFLAGS="$saved_LDFLAGS"
170 LIBS="$saved_LIBS -lssl -lcrypto"
172 # Skip directories if they don't exist
173 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
176 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
177 # Try to use $ssldir/lib if it exists, otherwise
179 if test -d "$ssldir/lib" ; then
180 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
181 if test ! -z "$need_dash_r" ; then
182 LDFLAGS="-R$ssldir/lib $LDFLAGS"
185 LDFLAGS="-L$ssldir $saved_LDFLAGS"
186 if test ! -z "$need_dash_r" ; then
187 LDFLAGS="-R$ssldir $LDFLAGS"
190 # Try to use $ssldir/include if it exists, otherwise
192 if test -d "$ssldir/include" ; then
193 CFLAGS="-I$ssldir/include $saved_CFLAGS"
195 CFLAGS="-I$ssldir $saved_CFLAGS"
199 # Basic test to check for compatible version and correct linking
200 # *does not* test for RSA - that comes later.
204 #include <openssl/rand.h>
208 memset(a, 0, sizeof(a));
209 RAND_add(a, sizeof(a), sizeof(a));
210 return(RAND_status() <= 0);
219 if test ! -z "$found_crypto" ; then
224 if test -z "$ssldir" ; then
228 if test ! -z "$found_crypto" ; then
229 ac_cv_openssldir=$ssldir
231 ac_cv_openssldir="no"
235 LDFLAGS="$saved_LDFLAGS"
236 CFLAGS="$saved_CFLAGS"
238 if test "x$ac_cv_openssldir" != "xno" ; then
239 AC_DEFINE(HAVE_OPENSSL)
240 LIBS="-lssl -lcrypto $LIBS"
241 dnl Need to recover ssldir - test above runs in subshell
242 ssldir=$ac_cv_openssldir
243 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
244 # Try to use $ssldir/lib if it exists, otherwise
246 if test -d "$ssldir/lib" ; then
247 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
248 if test ! -z "$need_dash_r" ; then
249 LDFLAGS="-R$ssldir/lib $LDFLAGS"
252 LDFLAGS="-L$ssldir $saved_LDFLAGS"
253 if test ! -z "$need_dash_r" ; then
254 LDFLAGS="-R$ssldir $LDFLAGS"
257 # Try to use $ssldir/include if it exists, otherwise
259 if test -d "$ssldir/include" ; then
260 CFLAGS="-I$ssldir/include $saved_CFLAGS"
262 CFLAGS="-I$ssldir $saved_CFLAGS"
272 AC_OUTPUT(Makefile intl/Makefile po/Makefile.in )