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_OPENSSL],
38 [ --with-ssl=PATH Specify path to OpenSSL installation ],
41 if test "x$withval" != "xno" ; then
48 AC_DEFINE([WEBCITDIR],"/usr/local/webcit", [ --with-webcitdir Directory Prefix])
50 dnl Set some system-specific variables which are OK to set before compiler
52 PTHREAD_DEFS=-D_REENTRANT
54 dnl Tru64 Unix requires we use -pthread instead of linking the threads
55 dnl libraries directly, and we can't build threaded programs with gcc
56 dnl due to header file problems.
58 test -z "$CC" && CC=cc
61 dnl FreeBSD is similar:
64 PTHREAD_DEFS=-D_THREAD_SAFE
67 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
70 AC_SUBST(PTHREAD_DEFS)
72 dnl Checks for programs.
75 dnl Configure compiler flags for GCC
76 if test "$GCC" = yes; then
79 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
82 CFLAGS="$CFLAGS -Wall"
87 # missing_dir=`cd $ac_aux_dir && pwd`
88 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
90 dnl Checks for libraries.
91 if test "$LIBS" != -pthread; then
92 AC_CHECK_LIB(pthread, pthread_create)
93 AC_CHECK_LIB(pthreads, pthread_create)
95 AC_SEARCH_LIBS(gethostbyname, nsl)
96 AC_SEARCH_LIBS(connect, socket)
98 dnl Checks for header files.
100 dnl AC_HEADER_SYS_WAIT
101 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
106 dnl Checks for typedefs, structures, and compiler characteristics.
112 dnl Checks for library functions.
115 AC_CHECK_FUNCS(backtrace)
116 AC_REPLACE_FUNCS(snprintf)
118 dnl Checks for the libical calendaring library.
119 AC_DEFINE([HAVE_LIBICAL],
120 [--with-libical use libical calendaring library],
121 ok_libical=no, ok_libical=yes)
123 if test "x$with_libical" != xno ; then
124 AC_CHECK_HEADERS(ical.h,
125 [AC_CHECK_LIB(ical, icalcomponent_new,
126 [ok_libical=yes],,)])
129 if test "x$ok_libical" = xyes ; then
136 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
137 v = 100*major + minor;
138 printf("libical version: %i\n", v);
140 printf("This version is ok.\n");
143 printf("libical 0.24 or newer required.\n");
144 printf("Citadel will be built without calendar support.\n");
150 AC_DEFINE(HAVE_LIBICAL)
157 dnl Checks for the zlib compression library.
158 AC_DEFINE([with_zlib],
159 [ --with-zlib use zlib compression if present],
161 [AC_CHECK_HEADERS(zlib.h,
162 [AC_CHECK_LIB(z, zlibVersion,
167 if test "x$ok_zlib" = xyes ; then
171 dnl Checks for the newt window library.
172 AC_ARG_WITH([ok_newt], [ --with-newt use newt window library],ok_newt=no, [ AC_CHECK_HEADERS(newt.h,
173 [AC_CHECK_LIB(newt, newtInit,
174 [ok_newt=yes],[ok_newt=no],
179 if test "x$ok_newt" = xyes ; then
180 SETUP_LIBS="-lnewt $SETUP_LIBS"
183 # The big search for OpenSSL
184 if test "$with_ssl" != "no"; then
186 saved_LDFLAGS="$LDFLAGS"
187 saved_CFLAGS="$CFLAGS"
188 if test "x$prefix" != "xNONE"; then
189 tryssldir="$tryssldir $prefix"
191 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
192 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
193 CFLAGS="$saved_CFLAGS"
194 LDFLAGS="$saved_LDFLAGS"
195 LIBS="$saved_LIBS -lssl -lcrypto"
197 # Skip directories if they don't exist
198 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
201 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
202 # Try to use $ssldir/lib if it exists, otherwise
204 if test -d "$ssldir/lib" ; then
205 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
206 if test ! -z "$need_dash_r" ; then
207 LDFLAGS="-R$ssldir/lib $LDFLAGS"
210 LDFLAGS="-L$ssldir $saved_LDFLAGS"
211 if test ! -z "$need_dash_r" ; then
212 LDFLAGS="-R$ssldir $LDFLAGS"
215 # Try to use $ssldir/include if it exists, otherwise
217 if test -d "$ssldir/include" ; then
218 CFLAGS="-I$ssldir/include $saved_CFLAGS"
220 CFLAGS="-I$ssldir $saved_CFLAGS"
224 # Basic test to check for compatible version and correct linking
225 # *does not* test for RSA - that comes later.
229 #include <openssl/rand.h>
233 memset(a, 0, sizeof(a));
234 RAND_add(a, sizeof(a), sizeof(a));
235 return(RAND_status() <= 0);
244 if test ! -z "$found_crypto" ; then
249 if test -z "$ssldir" ; then
253 if test ! -z "$found_crypto" ; then
254 ac_cv_openssldir=$ssldir
256 ac_cv_openssldir="no"
260 LDFLAGS="$saved_LDFLAGS"
261 CFLAGS="$saved_CFLAGS"
263 if test "x$ac_cv_openssldir" != "xno" ; then
264 AC_DEFINE(HAVE_OPENSSL)
265 LIBS="-lssl -lcrypto $LIBS"
266 dnl Need to recover ssldir - test above runs in subshell
267 ssldir=$ac_cv_openssldir
268 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
269 # Try to use $ssldir/lib if it exists, otherwise
271 if test -d "$ssldir/lib" ; then
272 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
273 if test ! -z "$need_dash_r" ; then
274 LDFLAGS="-R$ssldir/lib $LDFLAGS"
277 LDFLAGS="-L$ssldir $saved_LDFLAGS"
278 if test ! -z "$need_dash_r" ; then
279 LDFLAGS="-R$ssldir $LDFLAGS"
282 # Try to use $ssldir/include if it exists, otherwise
284 if test -d "$ssldir/include" ; then
285 CFLAGS="-I$ssldir/include $saved_CFLAGS"
287 CFLAGS="-I$ssldir $saved_CFLAGS"
293 dnl Here is the check for a usable iconv
295 AC_DEFINE([HAVE_ICONV],
296 [ --disable-iconv do not use iconv charset conversion],
297 ok_iconv=no, ok_iconv=yes)
299 if test "$ok_nls" != "no"; then
300 AC_MSG_RESULT(Checking to see if your system supports iconv...)
304 iconv_t ic = (iconv_t)(-1) ;
305 ic = iconv_open("UTF-8", "us-ascii");
315 if test "$ok_iconv" != "no"; then
316 AC_MSG_RESULT(WebCit will be built with character set conversion.)
317 AC_DEFINE(HAVE_ICONV)
319 AC_MSG_RESULT(WebCit will be built without character set conversion.)
324 dnl dnl Here is the check for libintl etc.
326 dnl AC_DEFINE([ENABLE_NLS],
327 dnl [ --disable-nls do not use Native Language Support],
328 dnl ok_nls=no, ok_nls=yes)
330 dnl if test "$ok_nls" != "no"; then
331 dnl AC_MSG_RESULT(Checking for per-thread NLS support...)
333 dnl #define _GNU_SOURCE
334 dnl #include <libintl.h>
335 dnl #include <locale.h>
336 dnl #include <time.h>
338 dnl char *foo = NULL;
341 dnl uselocale(LC_GLOBAL_LOCALE);
342 dnl foo = gettext("bar");
344 dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
349 dnl ok_uselocale=yes,
352 dnl ok_nls=$ok_uselocale
355 dnl if test "$ok_nls" != "no"; then
356 dnl AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
357 dnl ok_nls=$ok_xgettext
360 dnl if test "$ok_nls" != "no"; then
361 dnl AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
362 dnl ok_nls=$ok_msgmerge
365 dnl if test "$ok_nls" != "no"; then
366 dnl AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
367 dnl ok_nls=$ok_msgfmt
370 dnl if test "$ok_nls" != "no"; then
371 dnl AC_MSG_RESULT(WebCit will be built with national language support.)
372 dnl AC_DEFINE(ENABLE_NLS)
373 dnl CFLAGS="$CFLAGS -I\$(top_srcdir)/po"
374 dnl PROG_SUBDIRS="$PROG_SUBDIRS po"
375 dnl AC_CHECK_LIB(intl, gettext)
377 dnl AC_MSG_RESULT(WebCit will be built without national language support.)
379 dnl Checks for programs.
380 AM_GNU_GETTEXT_VERSION([0.14.5])
383 # if we have intl/...
384 AM_GNU_GETTEXT([external])
392 AC_ARG_WITH(staticdir, [ --with-staticdir=DIR where to put datafiles],[ staticdir=$withval ],[ staticdir=$prefix/static/ ] )
394 AC_OUTPUT(Makefile src/Makefile po/Makefile.in )
396 echo ------------------------------------------------------------------------
397 echo 'zlib compression: ' $ok_zlib
398 echo 'Calendar support: ' $ok_libical
399 echo 'Character set conversion support:' $ok_iconv
400 echo 'National language support: ' $ok_nls