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])
22 AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
24 [ --with-ssl=PATH Specify path to OpenSSL installation ],
26 if test "x$withval" != "xno" ; then
31 dnl Set some system-specific variables which are OK to set before compiler
33 PTHREAD_DEFS=-D_REENTRANT
35 dnl Tru64 Unix requires we use -pthread instead of linking the threads
36 dnl libraries directly, and we can't build threaded programs with gcc
37 dnl due to header file problems.
39 test -z "$CC" && CC=cc
42 dnl FreeBSD is similar:
45 PTHREAD_DEFS=-D_THREAD_SAFE
48 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
51 AC_SUBST(PTHREAD_DEFS)
53 dnl Checks for programs.
56 dnl Configure compiler flags for GCC
57 if test "$GCC" = yes; then
60 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
63 CFLAGS="$CFLAGS -Wall"
68 # missing_dir=`cd $ac_aux_dir && pwd`
69 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
71 dnl Checks for libraries.
72 if test "$LIBS" != -pthread; then
73 AC_CHECK_LIB(pthread, pthread_create)
74 AC_CHECK_LIB(pthreads, pthread_create)
76 AC_SEARCH_LIBS(gethostbyname, nsl)
77 AC_SEARCH_LIBS(connect, socket)
79 dnl Checks for header files.
81 dnl AC_HEADER_SYS_WAIT
82 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
87 dnl Checks for typedefs, structures, and compiler characteristics.
93 dnl Checks for library functions.
96 dnl AC_CHECK_FUNCS(strerror)
97 AC_REPLACE_FUNCS(snprintf)
99 dnl Checks for the libical calendaring library.
100 if test "x$with_libical" != xno ; then
101 AC_CHECK_HEADERS(ical.h,
102 [AC_CHECK_LIB(ical, icalcomponent_new,
107 if test "x$ok_libical" = xyes ; then
114 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
115 v = 100*major + minor;
116 printf("libical version: %i\n", v);
118 printf("This version is ok.\n");
121 printf("libical 0.24 or newer required.\n");
122 printf("Citadel will be built without calendar support.\n");
128 AC_DEFINE(HAVE_LIBICAL)
135 dnl Checks for the zlib compression library.
136 if test "x$with_zlib" != xno ; then
137 AC_CHECK_HEADERS(zlib.h,
138 [AC_CHECK_LIB(z, zlibVersion,
143 if test "x$ok_zlib" = xyes ; then
148 dnl Checks for the newt window library.
149 if test "x$with_newt" != xno ; then
150 AC_CHECK_HEADERS(newt.h,
151 [AC_CHECK_LIB(newt, newtInit,
156 if test "x$ok_newt" = xyes ; then
157 SETUP_LIBS="-lnewt $SETUP_LIBS"
161 # The big search for OpenSSL
162 if test "$with_ssl" != "no"; then
164 saved_LDFLAGS="$LDFLAGS"
165 saved_CFLAGS="$CFLAGS"
166 if test "x$prefix" != "xNONE"; then
167 tryssldir="$tryssldir $prefix"
169 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
170 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
171 CFLAGS="$saved_CFLAGS"
172 LDFLAGS="$saved_LDFLAGS"
173 LIBS="$saved_LIBS -lssl -lcrypto"
175 # Skip directories if they don't exist
176 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
179 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
180 # Try to use $ssldir/lib if it exists, otherwise
182 if test -d "$ssldir/lib" ; then
183 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
184 if test ! -z "$need_dash_r" ; then
185 LDFLAGS="-R$ssldir/lib $LDFLAGS"
188 LDFLAGS="-L$ssldir $saved_LDFLAGS"
189 if test ! -z "$need_dash_r" ; then
190 LDFLAGS="-R$ssldir $LDFLAGS"
193 # Try to use $ssldir/include if it exists, otherwise
195 if test -d "$ssldir/include" ; then
196 CFLAGS="-I$ssldir/include $saved_CFLAGS"
198 CFLAGS="-I$ssldir $saved_CFLAGS"
202 # Basic test to check for compatible version and correct linking
203 # *does not* test for RSA - that comes later.
207 #include <openssl/rand.h>
211 memset(a, 0, sizeof(a));
212 RAND_add(a, sizeof(a), sizeof(a));
213 return(RAND_status() <= 0);
222 if test ! -z "$found_crypto" ; then
227 if test -z "$ssldir" ; then
231 if test ! -z "$found_crypto" ; then
232 ac_cv_openssldir=$ssldir
234 ac_cv_openssldir="no"
238 LDFLAGS="$saved_LDFLAGS"
239 CFLAGS="$saved_CFLAGS"
241 if test "x$ac_cv_openssldir" != "xno" ; then
242 AC_DEFINE(HAVE_OPENSSL)
243 LIBS="-lssl -lcrypto $LIBS"
244 dnl Need to recover ssldir - test above runs in subshell
245 ssldir=$ac_cv_openssldir
246 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
247 # Try to use $ssldir/lib if it exists, otherwise
249 if test -d "$ssldir/lib" ; then
250 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
251 if test ! -z "$need_dash_r" ; then
252 LDFLAGS="-R$ssldir/lib $LDFLAGS"
255 LDFLAGS="-L$ssldir $saved_LDFLAGS"
256 if test ! -z "$need_dash_r" ; then
257 LDFLAGS="-R$ssldir $LDFLAGS"
260 # Try to use $ssldir/include if it exists, otherwise
262 if test -d "$ssldir/include" ; then
263 CFLAGS="-I$ssldir/include $saved_CFLAGS"
265 CFLAGS="-I$ssldir $saved_CFLAGS"
271 dnl Here is the check for a usable iconv
274 [ --disable-iconv do not use iconv charset conversion],
275 ok_iconv=no, ok_iconv=yes)
277 if test "$ok_nls" != "no"; then
278 AC_MSG_RESULT(Checking to see if your system supports iconv...)
282 iconv_t ic = (iconv_t)(-1) ;
283 ic = iconv_open("UTF-8", "us-ascii");
293 if test "$ok_iconv" != "no"; then
294 AC_MSG_RESULT(WebCit will be built with character set conversion.)
295 AC_DEFINE(HAVE_ICONV)
297 AC_MSG_RESULT(WebCit will be built without character set conversion.)
302 dnl Here is the check for libintl etc.
305 [ --disable-nls do not use Native Language Support],
306 ok_nls=no, ok_nls=yes)
308 if test "$ok_nls" != "no"; then
309 AC_MSG_RESULT(Checking to see if your system supports multithreaded NLS...)
316 uselocale(LC_GLOBAL_LOCALE);
317 foo = gettext("bar");
327 if test "$ok_nls" != "no"; then
328 AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
332 if test "$ok_nls" != "no"; then
333 AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
337 if test "$ok_nls" != "no"; then
338 AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
342 if test "$ok_nls" != "no"; then
343 AC_MSG_RESULT(WebCit will be built with national language support.)
344 AC_DEFINE(ENABLE_NLS)
345 PROG_SUBDIRS="$PROG_SUBDIRS po"
347 AC_MSG_RESULT(WebCit will be built without national language support.)
352 AC_OUTPUT(Makefile po/Makefile )
354 echo ------------------------------------------------------------------------
355 echo 'zlib compression: ' $ok_zlib
356 echo 'Calendar support: ' $ok_libical
357 echo 'Character set conversion support:' $ok_iconv
358 echo 'National language support: ' $ok_nls