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_CHECK_PROG(SED, sed, sed, no)
16 AC_PREFIX_DEFAULT(/usr/local/webcit)
18 AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
19 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
20 AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
22 [ --with-ssl=PATH Specify path to OpenSSL installation ],
24 if test "x$withval" != "xno" ; then
29 dnl Set some system-specific variables which are OK to set before compiler
31 PTHREAD_DEFS=-D_REENTRANT
33 dnl Tru64 Unix requires we use -pthread instead of linking the threads
34 dnl libraries directly, and we can't build threaded programs with gcc
35 dnl due to header file problems.
37 test -z "$CC" && CC=cc
40 dnl FreeBSD is similar:
43 PTHREAD_DEFS=-D_THREAD_SAFE
46 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
49 AC_SUBST(PTHREAD_DEFS)
51 dnl Checks for programs.
54 dnl Configure compiler flags for GCC
55 if test "$GCC" = yes; then
58 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
61 CFLAGS="$CFLAGS -Wall"
66 missing_dir=`cd $ac_aux_dir && pwd`
67 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
69 dnl Checks for libraries.
70 if test "$LIBS" != -pthread; then
71 AC_CHECK_LIB(pthread, pthread_create)
72 AC_CHECK_LIB(pthreads, pthread_create)
74 AC_SEARCH_LIBS(gethostbyname, nsl)
75 AC_SEARCH_LIBS(connect, socket)
77 dnl Checks for header files.
79 dnl AC_HEADER_SYS_WAIT
80 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
85 dnl Checks for typedefs, structures, and compiler characteristics.
91 dnl Checks for library functions.
94 dnl AC_CHECK_FUNCS(strerror)
95 AC_REPLACE_FUNCS(snprintf)
97 dnl Checks for the libical calendaring library.
98 if test "x$with_libical" != xno ; then
99 AC_CHECK_HEADERS(ical.h,
100 [AC_CHECK_LIB(ical, icalcomponent_new,
105 if test "x$ok_libical" = xyes ; then
112 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
113 v = 100*major + minor;
114 printf("libical version: %i\n", v);
116 printf("This version is ok.\n");
119 printf("libical 0.24 or newer required.\n");
120 printf("Citadel will be built without calendar support.\n");
126 AC_DEFINE(HAVE_LIBICAL)
133 dnl Checks for the zlib compression library.
134 if test "x$with_zlib" != xno ; then
135 AC_CHECK_HEADERS(zlib.h,
136 [AC_CHECK_LIB(z, zlibVersion,
141 if test "x$ok_zlib" = xyes ; then
146 dnl Checks for the newt window library.
147 if test "x$with_newt" != xno ; then
148 AC_CHECK_HEADERS(newt.h,
149 [AC_CHECK_LIB(newt, newtInit,
154 if test "x$ok_newt" = xyes ; then
155 SETUP_LIBS="-lnewt $SETUP_LIBS"
159 # The big search for OpenSSL
160 if test "$with_ssl" != "no"; then
162 saved_LDFLAGS="$LDFLAGS"
163 saved_CFLAGS="$CFLAGS"
164 if test "x$prefix" != "xNONE"; then
165 tryssldir="$tryssldir $prefix"
167 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
168 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
169 CFLAGS="$saved_CFLAGS"
170 LDFLAGS="$saved_LDFLAGS"
171 LIBS="$saved_LIBS -lssl -lcrypto"
173 # Skip directories if they don't exist
174 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
177 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
178 # Try to use $ssldir/lib if it exists, otherwise
180 if test -d "$ssldir/lib" ; then
181 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
182 if test ! -z "$need_dash_r" ; then
183 LDFLAGS="-R$ssldir/lib $LDFLAGS"
186 LDFLAGS="-L$ssldir $saved_LDFLAGS"
187 if test ! -z "$need_dash_r" ; then
188 LDFLAGS="-R$ssldir $LDFLAGS"
191 # Try to use $ssldir/include if it exists, otherwise
193 if test -d "$ssldir/include" ; then
194 CFLAGS="-I$ssldir/include $saved_CFLAGS"
196 CFLAGS="-I$ssldir $saved_CFLAGS"
200 # Basic test to check for compatible version and correct linking
201 # *does not* test for RSA - that comes later.
205 #include <openssl/rand.h>
209 memset(a, 0, sizeof(a));
210 RAND_add(a, sizeof(a), sizeof(a));
211 return(RAND_status() <= 0);
220 if test ! -z "$found_crypto" ; then
225 if test -z "$ssldir" ; then
229 if test ! -z "$found_crypto" ; then
230 ac_cv_openssldir=$ssldir
232 ac_cv_openssldir="no"
236 LDFLAGS="$saved_LDFLAGS"
237 CFLAGS="$saved_CFLAGS"
239 if test "x$ac_cv_openssldir" != "xno" ; then
240 AC_DEFINE(HAVE_OPENSSL)
241 LIBS="-lssl -lcrypto $LIBS"
242 dnl Need to recover ssldir - test above runs in subshell
243 ssldir=$ac_cv_openssldir
244 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
245 # Try to use $ssldir/lib if it exists, otherwise
247 if test -d "$ssldir/lib" ; then
248 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
249 if test ! -z "$need_dash_r" ; then
250 LDFLAGS="-R$ssldir/lib $LDFLAGS"
253 LDFLAGS="-L$ssldir $saved_LDFLAGS"
254 if test ! -z "$need_dash_r" ; then
255 LDFLAGS="-R$ssldir $LDFLAGS"
258 # Try to use $ssldir/include if it exists, otherwise
260 if test -d "$ssldir/include" ; then
261 CFLAGS="-I$ssldir/include $saved_CFLAGS"
263 CFLAGS="-I$ssldir $saved_CFLAGS"
273 AC_OUTPUT(Makefile intl/Makefile po/Makefile.in po/Makefile )