1 dnl Process this file with autoconf to produce a configure script.
3 dnl AC_CONFIG_AUX_DIR([autoconf])
4 AC_INIT(src/webserver.c)
5 AM_INIT_AUTOMAKE(webcit,6.72)
6 AM_CONFIG_HEADER(config.h)
8 #AC_CONFIG_HEADERS(sysdep.h)
12 #AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
13 #AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
16 #AM_INIT_AUTOMAKE(gettext, 0.14.5)
18 AC_SUBST(PROG_SUBDIRS)
21 AC_CHECK_PROG(AUTOCONF, autoconf)
22 AC_CHECK_PROG(SED, sed, sed, no)
23 AC_PREFIX_DEFAULT(/usr/local/webcit)
25 #AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
26 #AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
27 #AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
29 # [ --with-ssl=PATH Specify path to OpenSSL installation ],
31 # if test "x$withval" != "xno" ; then
36 #AC_DEFINE([HAVE_ICAL], [ --with-libical use libical calendaring library])
37 AC_DEFINE([HAVE_ZLIB], [ --with-zlib use zlib compression if present],ok_zlib=no, ok_zlib=yes)
38 AC_DEFINE([HAVE_OPENSSL],
39 [ --with-ssl=PATH Specify path to OpenSSL installation ],
42 if test "x$withval" != "xno" ; then
49 AC_DEFINE([WEBCITDIR],"/usr/local/webcit", [ --with-webcitdir Directory Prefix])
51 dnl Set some system-specific variables which are OK to set before compiler
53 PTHREAD_DEFS=-D_REENTRANT
55 dnl Tru64 Unix requires we use -pthread instead of linking the threads
56 dnl libraries directly, and we can't build threaded programs with gcc
57 dnl due to header file problems.
59 test -z "$CC" && CC=cc
62 dnl FreeBSD is similar:
65 PTHREAD_DEFS=-D_THREAD_SAFE
68 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
71 AC_SUBST(PTHREAD_DEFS)
73 dnl Checks for programs.
76 dnl Configure compiler flags for GCC
77 if test "$GCC" = yes; then
80 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
83 CFLAGS="$CFLAGS -Wall"
88 # missing_dir=`cd $ac_aux_dir && pwd`
89 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
91 dnl Checks for libraries.
92 if test "$LIBS" != -pthread; then
93 AC_CHECK_LIB(pthread, pthread_create)
94 AC_CHECK_LIB(pthreads, pthread_create)
96 AC_SEARCH_LIBS(gethostbyname, nsl)
97 AC_SEARCH_LIBS(connect, socket)
99 dnl Checks for header files.
101 dnl AC_HEADER_SYS_WAIT
102 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
107 dnl Checks for typedefs, structures, and compiler characteristics.
113 dnl Checks for library functions.
116 AC_CHECK_FUNCS(backtrace)
117 AC_REPLACE_FUNCS(snprintf)
119 dnl Checks for the libical calendaring library.
120 AC_DEFINE([HAVE_LIBICAL],
121 [--with-libical use libical calendaring library],
122 ok_libical=no, ok_libical=yes)
124 if test "x$with_libical" != xno ; then
125 AC_CHECK_HEADERS(ical.h,
126 [AC_CHECK_LIB(ical, icalcomponent_new,
127 [ok_libical=yes],,)])
130 if test "x$ok_libical" = xyes ; then
137 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
138 v = 100*major + minor;
139 printf("libical version: %i\n", v);
141 printf("This version is ok.\n");
144 printf("libical 0.24 or newer required.\n");
145 printf("Citadel will be built without calendar support.\n");
151 AC_DEFINE(HAVE_LIBICAL)
158 dnl Checks for the zlib compression library.
159 if test "x$with_zlib" != xno ; then
160 AC_CHECK_HEADERS(zlib.h,
161 [AC_CHECK_LIB(z, zlibVersion,
166 if test "x$ok_zlib" = xyes ; then
171 dnl Checks for the newt window library.
172 dnl#if test "x$with_newt" != xno ; then
174 dnl AC_DEFINE([HAVE_NEWT],
175 dnl [ --with-newt use newt window library],ok_newt=no,
176 dnl [AC_CHECK_HEADERS(newt.h,
177 dnl [AC_CHECK_LIB(newt, newtInit,
178 dnl [ok_newt=yes],[ok_newt=no],
186 dnl if test "x$ok_newt" = xyes ; then
187 dnl SETUP_LIBS="-lnewt $SETUP_LIBS"
188 dnl AC_DEFINE(HAVE_NEWT)
191 # The big search for OpenSSL
192 if test "$with_ssl" != "no"; then
194 saved_LDFLAGS="$LDFLAGS"
195 saved_CFLAGS="$CFLAGS"
196 if test "x$prefix" != "xNONE"; then
197 tryssldir="$tryssldir $prefix"
199 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
200 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
201 CFLAGS="$saved_CFLAGS"
202 LDFLAGS="$saved_LDFLAGS"
203 LIBS="$saved_LIBS -lssl -lcrypto"
205 # Skip directories if they don't exist
206 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
209 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
210 # Try to use $ssldir/lib if it exists, otherwise
212 if test -d "$ssldir/lib" ; then
213 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
214 if test ! -z "$need_dash_r" ; then
215 LDFLAGS="-R$ssldir/lib $LDFLAGS"
218 LDFLAGS="-L$ssldir $saved_LDFLAGS"
219 if test ! -z "$need_dash_r" ; then
220 LDFLAGS="-R$ssldir $LDFLAGS"
223 # Try to use $ssldir/include if it exists, otherwise
225 if test -d "$ssldir/include" ; then
226 CFLAGS="-I$ssldir/include $saved_CFLAGS"
228 CFLAGS="-I$ssldir $saved_CFLAGS"
232 # Basic test to check for compatible version and correct linking
233 # *does not* test for RSA - that comes later.
237 #include <openssl/rand.h>
241 memset(a, 0, sizeof(a));
242 RAND_add(a, sizeof(a), sizeof(a));
243 return(RAND_status() <= 0);
252 if test ! -z "$found_crypto" ; then
257 if test -z "$ssldir" ; then
261 if test ! -z "$found_crypto" ; then
262 ac_cv_openssldir=$ssldir
264 ac_cv_openssldir="no"
268 LDFLAGS="$saved_LDFLAGS"
269 CFLAGS="$saved_CFLAGS"
271 if test "x$ac_cv_openssldir" != "xno" ; then
272 AC_DEFINE(HAVE_OPENSSL)
273 LIBS="-lssl -lcrypto $LIBS"
274 dnl Need to recover ssldir - test above runs in subshell
275 ssldir=$ac_cv_openssldir
276 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
277 # Try to use $ssldir/lib if it exists, otherwise
279 if test -d "$ssldir/lib" ; then
280 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
281 if test ! -z "$need_dash_r" ; then
282 LDFLAGS="-R$ssldir/lib $LDFLAGS"
285 LDFLAGS="-L$ssldir $saved_LDFLAGS"
286 if test ! -z "$need_dash_r" ; then
287 LDFLAGS="-R$ssldir $LDFLAGS"
290 # Try to use $ssldir/include if it exists, otherwise
292 if test -d "$ssldir/include" ; then
293 CFLAGS="-I$ssldir/include $saved_CFLAGS"
295 CFLAGS="-I$ssldir $saved_CFLAGS"
301 dnl Here is the check for a usable iconv
303 AC_DEFINE([HAVE_ICONV],
304 [ --disable-iconv do not use iconv charset conversion],
305 ok_iconv=no, ok_iconv=yes)
307 if test "$ok_nls" != "no"; then
308 AC_MSG_RESULT(Checking to see if your system supports iconv...)
312 iconv_t ic = (iconv_t)(-1) ;
313 ic = iconv_open("UTF-8", "us-ascii");
323 if test "$ok_iconv" != "no"; then
324 AC_MSG_RESULT(WebCit will be built with character set conversion.)
325 AC_DEFINE(HAVE_ICONV)
327 AC_MSG_RESULT(WebCit will be built without character set conversion.)
332 dnl dnl Here is the check for libintl etc.
334 dnl AC_DEFINE([ENABLE_NLS],
335 dnl [ --disable-nls do not use Native Language Support],
336 dnl ok_nls=no, ok_nls=yes)
338 dnl if test "$ok_nls" != "no"; then
339 dnl AC_MSG_RESULT(Checking for per-thread NLS support...)
341 dnl #define _GNU_SOURCE
342 dnl #include <libintl.h>
343 dnl #include <locale.h>
344 dnl #include <time.h>
346 dnl char *foo = NULL;
349 dnl uselocale(LC_GLOBAL_LOCALE);
350 dnl foo = gettext("bar");
352 dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
357 dnl ok_uselocale=yes,
360 dnl ok_nls=$ok_uselocale
363 dnl if test "$ok_nls" != "no"; then
364 dnl AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
365 dnl ok_nls=$ok_xgettext
368 dnl if test "$ok_nls" != "no"; then
369 dnl AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
370 dnl ok_nls=$ok_msgmerge
373 dnl if test "$ok_nls" != "no"; then
374 dnl AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
375 dnl ok_nls=$ok_msgfmt
378 dnl if test "$ok_nls" != "no"; then
379 dnl AC_MSG_RESULT(WebCit will be built with national language support.)
380 dnl AC_DEFINE(ENABLE_NLS)
381 dnl CFLAGS="$CFLAGS -I\$(top_srcdir)/po"
382 dnl PROG_SUBDIRS="$PROG_SUBDIRS po"
383 dnl AC_CHECK_LIB(intl, gettext)
385 dnl AC_MSG_RESULT(WebCit will be built without national language support.)
387 dnl Checks for programs.
388 AM_GNU_GETTEXT_VERSION([0.14.5])
391 # if we have intl/...
392 AM_GNU_GETTEXT([external])
401 AC_ARG_WITH(with_staticdir, [ --with-staticdir where to put datafiles])
404 AC_OUTPUT(Makefile src/Makefile po/Makefile.in )
406 echo ------------------------------------------------------------------------
407 echo 'zlib compression: ' $ok_zlib
408 echo 'Calendar support: ' $ok_libical
409 echo 'Character set conversion support:' $ok_iconv
410 echo 'National language support: ' $ok_nls