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)
6 AM_INIT_AUTOMAKE(webcit,6.72)
7 AM_CONFIG_HEADER(config.h)
10 dnl Make sure we see all GNU and Solaris extensions.
12 #AC_CONFIG_HEADERS(sysdep.h)
16 #AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
17 #AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
20 #AM_INIT_AUTOMAKE(gettext, 0.14.5)
22 AC_SUBST(PROG_SUBDIRS)
25 AC_CHECK_PROG(AUTOCONF, autoconf)
26 AC_CHECK_PROG(SED, sed, sed, no)
27 AC_PREFIX_DEFAULT(/usr/local/webcit)
29 #AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
30 #AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
31 #AC_ARG_WITH(with_newt, [ --with-newt use newt window library])
33 # [ --with-ssl=PATH Specify path to OpenSSL installation ],
35 # if test "x$withval" != "xno" ; then
40 #AC_DEFINE([HAVE_ICAL], [ --with-libical use libical calendaring library])
41 AC_DEFINE([HAVE_OPENSSL],
42 [ --with-ssl=PATH Specify path to OpenSSL installation ],
45 if test "x$withval" != "xno" ; then
53 dnl Set some system-specific variables which are OK to set before compiler
55 PTHREAD_DEFS=-D_REENTRANT
57 dnl Tru64 Unix requires we use -pthread instead of linking the threads
58 dnl libraries directly, and we can't build threaded programs with gcc
59 dnl due to header file problems.
61 test -z "$CC" && CC=cc
64 dnl FreeBSD is similar:
67 PTHREAD_DEFS=-D_THREAD_SAFE
70 PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
73 AC_SUBST(PTHREAD_DEFS)
75 dnl Checks for programs.
78 dnl Configure compiler flags for GCC
79 if test "$GCC" = yes; then
82 CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
85 CFLAGS="$CFLAGS -Wall"
90 # missing_dir=`cd $ac_aux_dir && pwd`
91 # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
93 dnl Checks for libraries.
94 if test "$LIBS" != -pthread; then
95 AC_CHECK_LIB(pthread, pthread_create)
96 AC_CHECK_LIB(pthreads, pthread_create)
98 AC_SEARCH_LIBS(gethostbyname, nsl)
99 AC_SEARCH_LIBS(connect, socket)
101 dnl Checks for header files.
103 dnl AC_HEADER_SYS_WAIT
104 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
109 dnl Checks for typedefs, structures, and compiler characteristics.
115 dnl Checks for library functions.
118 AC_CHECK_FUNCS(backtrace)
119 AC_REPLACE_FUNCS(snprintf)
121 dnl Checks for the libical calendaring library.
122 AC_DEFINE([HAVE_LIBICAL],
123 [--with-libical use libical calendaring library],
124 ok_libical=no, ok_libical=yes)
126 if test "x$with_libical" != xno ; then
127 AC_CHECK_HEADERS(ical.h,
128 [AC_CHECK_LIB(ical, icalcomponent_new,
129 [ok_libical=yes],,)])
132 if test "x$ok_libical" = xyes ; then
139 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
140 v = 100*major + minor;
141 printf("libical version: %i\n", v);
143 printf("This version is ok.\n");
146 printf("libical 0.24 or newer required.\n");
147 printf("Citadel will be built without calendar support.\n");
153 AC_DEFINE(HAVE_LIBICAL)
160 dnl Checks for the zlib compression library.
161 AC_DEFINE([with_zlib],
162 [ --with-zlib use zlib compression if present],
164 [AC_CHECK_HEADERS(zlib.h,
165 [AC_CHECK_LIB(z, zlibVersion,
170 if test "x$ok_zlib" = xyes ; then
174 dnl Checks for the newt window library.
175 AC_ARG_WITH([ok_newt], [ --with-newt use newt window library],ok_newt=no, [ AC_CHECK_HEADERS(newt.h,
176 [AC_CHECK_LIB(newt, newtInit,
177 [ok_newt=yes],[ok_newt=no],
182 if test "x$ok_newt" = xyes ; then
183 SETUP_LIBS="-lnewt $SETUP_LIBS"
186 # The big search for OpenSSL
187 if test "$with_ssl" != "no"; then
189 saved_LDFLAGS="$LDFLAGS"
190 saved_CFLAGS="$CFLAGS"
191 if test "x$prefix" != "xNONE"; then
192 tryssldir="$tryssldir $prefix"
194 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
195 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
196 CFLAGS="$saved_CFLAGS"
197 LDFLAGS="$saved_LDFLAGS"
198 LIBS="$saved_LIBS -lssl -lcrypto"
200 # Skip directories if they don't exist
201 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
204 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
205 # Try to use $ssldir/lib if it exists, otherwise
207 if test -d "$ssldir/lib" ; then
208 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
209 if test ! -z "$need_dash_r" ; then
210 LDFLAGS="-R$ssldir/lib $LDFLAGS"
213 LDFLAGS="-L$ssldir $saved_LDFLAGS"
214 if test ! -z "$need_dash_r" ; then
215 LDFLAGS="-R$ssldir $LDFLAGS"
218 # Try to use $ssldir/include if it exists, otherwise
220 if test -d "$ssldir/include" ; then
221 CFLAGS="-I$ssldir/include $saved_CFLAGS"
223 CFLAGS="-I$ssldir $saved_CFLAGS"
227 # Basic test to check for compatible version and correct linking
228 # *does not* test for RSA - that comes later.
232 #include <openssl/rand.h>
236 memset(a, 0, sizeof(a));
237 RAND_add(a, sizeof(a), sizeof(a));
238 return(RAND_status() <= 0);
247 if test ! -z "$found_crypto" ; then
252 if test -z "$ssldir" ; then
256 if test ! -z "$found_crypto" ; then
257 ac_cv_openssldir=$ssldir
259 ac_cv_openssldir="no"
263 LDFLAGS="$saved_LDFLAGS"
264 CFLAGS="$saved_CFLAGS"
266 if test "x$ac_cv_openssldir" != "xno" ; then
267 AC_DEFINE(HAVE_OPENSSL)
268 LIBS="-lssl -lcrypto $LIBS"
269 dnl Need to recover ssldir - test above runs in subshell
270 ssldir=$ac_cv_openssldir
271 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
272 # Try to use $ssldir/lib if it exists, otherwise
274 if test -d "$ssldir/lib" ; then
275 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
276 if test ! -z "$need_dash_r" ; then
277 LDFLAGS="-R$ssldir/lib $LDFLAGS"
280 LDFLAGS="-L$ssldir $saved_LDFLAGS"
281 if test ! -z "$need_dash_r" ; then
282 LDFLAGS="-R$ssldir $LDFLAGS"
285 # Try to use $ssldir/include if it exists, otherwise
287 if test -d "$ssldir/include" ; then
288 CFLAGS="-I$ssldir/include $saved_CFLAGS"
290 CFLAGS="-I$ssldir $saved_CFLAGS"
296 dnl Here is the check for a usable iconv
298 AC_DEFINE([HAVE_ICONV],
299 [ --disable-iconv do not use iconv charset conversion],
300 ok_iconv=no, ok_iconv=yes)
302 if test "$ok_nls" != "no"; then
303 AC_MSG_RESULT(Checking to see if your system supports iconv...)
307 iconv_t ic = (iconv_t)(-1) ;
308 ic = iconv_open("UTF-8", "us-ascii");
318 if test "$ok_iconv" != "no"; then
319 AC_MSG_RESULT(WebCit will be built with character set conversion.)
320 AC_DEFINE(HAVE_ICONV)
322 AC_MSG_RESULT(WebCit will be built without character set conversion.)
325 AC_DEFINE_UNQUOTED([PREFIX],["$prefix"],where should we make our root?)
328 dnl dnl Here is the check for libintl etc.
330 dnl AC_DEFINE([ENABLE_NLS],
331 dnl [ --disable-nls do not use Native Language Support],
332 dnl ok_nls=no, ok_nls=yes)
334 dnl if test "$ok_nls" != "no"; then
335 dnl AC_MSG_RESULT(Checking for per-thread NLS support...)
337 dnl #define _GNU_SOURCE
338 dnl #include <libintl.h>
339 dnl #include <locale.h>
340 dnl #include <time.h>
342 dnl char *foo = NULL;
345 dnl uselocale(LC_GLOBAL_LOCALE);
346 dnl foo = gettext("bar");
348 dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
353 dnl ok_uselocale=yes,
356 dnl ok_nls=$ok_uselocale
359 dnl if test "$ok_nls" != "no"; then
360 dnl AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
361 dnl ok_nls=$ok_xgettext
364 dnl if test "$ok_nls" != "no"; then
365 dnl AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
366 dnl ok_nls=$ok_msgmerge
369 dnl if test "$ok_nls" != "no"; then
370 dnl AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
371 dnl ok_nls=$ok_msgfmt
374 dnl if test "$ok_nls" != "no"; then
375 dnl AC_MSG_RESULT(WebCit will be built with national language support.)
376 dnl AC_DEFINE(ENABLE_NLS)
377 dnl CFLAGS="$CFLAGS -I\$(top_srcdir)/po"
378 dnl PROG_SUBDIRS="$PROG_SUBDIRS po"
379 dnl AC_CHECK_LIB(intl, gettext)
381 dnl AC_MSG_RESULT(WebCit will be built without national language support.)
383 dnl Checks for programs.
384 AM_GNU_GETTEXT_VERSION([0.14])
387 # if we have intl/...
388 AM_GNU_GETTEXT([external])
394 AC_ARG_WITH(rundir, [ --with-rundir=DIR where to find the citadel servers sockets (overridable by -h at runtime.)],
395 [ rundir=$withval ],[ rundir=/usr/local/citadel ] )
396 AC_DEFINE_UNQUOTED([RUNDIR],["$rundir"],where should we make look for citadel sockets??)
399 AC_ARG_WITH(staticdir, [ --with-staticdir=DIR where to put datafiles],
400 [ staticdir=$withval ],[ staticdir=$prefix ] )
403 AC_ARG_WITH(staticrundir, [ --with-staticrundir=DIR where to search datafiles at runtime],
404 [ staticrundir=$withval ],[ staticrundir=$staticdir ] )
406 AC_DEFINE_UNQUOTED([DATADIR],["$staticrundir"],where should we make our root?)
409 AC_ARG_WITH(editordir, [ --with-editordir=DIR where to search the editor at runtime],
410 [ editordir=$withval ],[ editordir=$staticrundir ] )
412 AC_DEFINE_UNQUOTED([EDITORDIR],["$editordir"],where find the editor (tiny_mce)?)
416 AC_OUTPUT(Makefile src/Makefile po/Makefile.in )
419 echo ------------------------------------------------------------------------
420 echo 'zlib compression: ' $ok_zlib
421 echo 'Calendar support: ' $ok_libical
422 echo 'Character set conversion support:' $ok_iconv
423 echo 'National language support: ' $ok_nls