1 dnl Process this file with autoconf to produce a configure script.
3 dnl AC_CONFIG_AUX_DIR([autoconf])
4 AC_INIT([webcit],[6.80],[uncensored.citadel.org])
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_CHECK_LIB(iconv, libiconv, [LIBS="$LIBS -liconv"])
99 AC_SEARCH_LIBS(gethostbyname, nsl)
100 AC_SEARCH_LIBS(connect, socket)
102 dnl Checks for header files.
104 dnl AC_HEADER_SYS_WAIT
105 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
110 dnl Checks for typedefs, structures, and compiler characteristics.
116 dnl Checks for library functions.
119 AC_CHECK_FUNCS(backtrace)
120 AC_REPLACE_FUNCS(snprintf)
122 dnl Checks for the libical calendaring library.
123 AC_DEFINE([HAVE_LIBICAL],
124 [--with-libical use libical calendaring library],
125 ok_libical=no, ok_libical=yes)
127 if test "x$with_libical" != xno ; then
128 AC_CHECK_HEADERS(ical.h,
129 [AC_CHECK_LIB(ical, icalcomponent_new,
130 [ok_libical=yes],,)])
133 if test "x$ok_libical" = xyes ; then
140 sscanf(ICAL_VERSION, "%d.%d", &major, &minor);
141 v = 100*major + minor;
142 printf("libical version: %i\n", v);
144 printf("This version is ok.\n");
147 printf("libical 0.24 or newer required.\n");
148 printf("Citadel will be built without calendar support.\n");
154 AC_DEFINE(HAVE_LIBICAL)
161 dnl Checks for the zlib compression library.
162 AC_DEFINE([with_zlib],
163 [ --with-zlib use zlib compression if present],
165 [AC_CHECK_HEADERS(zlib.h,
166 [AC_CHECK_LIB(z, zlibVersion,
171 if test "x$ok_zlib" = xyes ; then
175 dnl Checks for the newt window library.
176 AC_ARG_WITH([ok_newt], [ --with-newt use newt window library],ok_newt=no, [ AC_CHECK_HEADERS(newt.h,
177 [AC_CHECK_LIB(newt, newtInit,
178 [ok_newt=yes],[ok_newt=no],
183 if test "x$ok_newt" = xyes ; then
184 SETUP_LIBS="-lnewt $SETUP_LIBS"
187 # The big search for OpenSSL
188 if test "$with_ssl" != "no"; then
190 saved_LDFLAGS="$LDFLAGS"
191 saved_CFLAGS="$CFLAGS"
192 if test "x$prefix" != "xNONE"; then
193 tryssldir="$tryssldir $prefix"
195 AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
196 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
197 CFLAGS="$saved_CFLAGS"
198 LDFLAGS="$saved_LDFLAGS"
199 LIBS="$saved_LIBS -lssl -lcrypto"
201 # Skip directories if they don't exist
202 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
205 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
206 # Try to use $ssldir/lib if it exists, otherwise
208 if test -d "$ssldir/lib" ; then
209 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
210 if test ! -z "$need_dash_r" ; then
211 LDFLAGS="-R$ssldir/lib $LDFLAGS"
214 LDFLAGS="-L$ssldir $saved_LDFLAGS"
215 if test ! -z "$need_dash_r" ; then
216 LDFLAGS="-R$ssldir $LDFLAGS"
219 # Try to use $ssldir/include if it exists, otherwise
221 if test -d "$ssldir/include" ; then
222 CFLAGS="-I$ssldir/include $saved_CFLAGS"
224 CFLAGS="-I$ssldir $saved_CFLAGS"
228 # Basic test to check for compatible version and correct linking
229 # *does not* test for RSA - that comes later.
233 #include <openssl/rand.h>
237 memset(a, 0, sizeof(a));
238 RAND_add(a, sizeof(a), sizeof(a));
239 return(RAND_status() <= 0);
248 if test ! -z "$found_crypto" ; then
253 if test -z "$ssldir" ; then
257 if test ! -z "$found_crypto" ; then
258 ac_cv_openssldir=$ssldir
260 ac_cv_openssldir="no"
264 LDFLAGS="$saved_LDFLAGS"
265 CFLAGS="$saved_CFLAGS"
267 if test "x$ac_cv_openssldir" != "xno" ; then
268 AC_DEFINE(HAVE_OPENSSL)
269 LIBS="-lssl -lcrypto $LIBS"
270 dnl Need to recover ssldir - test above runs in subshell
271 ssldir=$ac_cv_openssldir
272 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
273 # Try to use $ssldir/lib if it exists, otherwise
275 if test -d "$ssldir/lib" ; then
276 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
277 if test ! -z "$need_dash_r" ; then
278 LDFLAGS="-R$ssldir/lib $LDFLAGS"
281 LDFLAGS="-L$ssldir $saved_LDFLAGS"
282 if test ! -z "$need_dash_r" ; then
283 LDFLAGS="-R$ssldir $LDFLAGS"
286 # Try to use $ssldir/include if it exists, otherwise
288 if test -d "$ssldir/include" ; then
289 CFLAGS="-I$ssldir/include $saved_CFLAGS"
291 CFLAGS="-I$ssldir $saved_CFLAGS"
297 dnl Here is the check for a usable iconv
299 AC_DEFINE([HAVE_ICONV],
300 [ --disable-iconv do not use iconv charset conversion],
301 ok_iconv=no, ok_iconv=yes)
303 if test "$ok_nls" != "no"; then
304 AC_MSG_RESULT(Checking to see if your system supports iconv...)
308 iconv_t ic = (iconv_t)(-1) ;
309 ic = iconv_open("UTF-8", "us-ascii");
319 if test "$ok_iconv" != "no"; then
320 AC_MSG_RESULT(WebCit will be built with character set conversion.)
321 AC_DEFINE(HAVE_ICONV)
323 AC_MSG_RESULT(WebCit will be built without character set conversion.)
326 AC_DEFINE_UNQUOTED([PREFIX],["$prefix"],where should we make our root?)
329 dnl dnl Here is the check for libintl etc.
331 dnl AC_DEFINE([ENABLE_NLS],
332 dnl [ --disable-nls do not use Native Language Support],
333 dnl ok_nls=no, ok_nls=yes)
335 dnl if test "$ok_nls" != "no"; then
336 dnl AC_MSG_RESULT(Checking for per-thread NLS support...)
338 dnl #define _GNU_SOURCE
339 dnl #include <libintl.h>
340 dnl #include <locale.h>
341 dnl #include <time.h>
343 dnl char *foo = NULL;
346 dnl uselocale(LC_GLOBAL_LOCALE);
347 dnl foo = gettext("bar");
349 dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
354 dnl ok_uselocale=yes,
357 dnl ok_nls=$ok_uselocale
360 dnl if test "$ok_nls" != "no"; then
361 dnl AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
362 dnl ok_nls=$ok_xgettext
365 dnl if test "$ok_nls" != "no"; then
366 dnl AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
367 dnl ok_nls=$ok_msgmerge
370 dnl if test "$ok_nls" != "no"; then
371 dnl AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
372 dnl ok_nls=$ok_msgfmt
375 dnl if test "$ok_nls" != "no"; then
376 dnl AC_MSG_RESULT(WebCit will be built with national language support.)
377 dnl AC_DEFINE(ENABLE_NLS)
378 dnl CFLAGS="$CFLAGS -I\$(top_srcdir)/po"
379 dnl PROG_SUBDIRS="$PROG_SUBDIRS po"
380 dnl AC_CHECK_LIB(intl, gettext)
382 dnl AC_MSG_RESULT(WebCit will be built without national language support.)
384 dnl Checks for programs.
385 AM_GNU_GETTEXT_VERSION([0.14])
388 # if we have intl/...
390 AC_TRY_COMPILE([#include <locale.h>],
391 [ extern locale_t wc_locales[]],
394 AM_GNU_GETTEXT([external],[need-ngettext])
406 dnl #include <libintl.h>
407 dnl #include <locale.h>
410 dnl extern locale_t wc_locales[];
427 AC_ARG_WITH(rundir, [ --with-rundir=DIR where to find the citadel servers sockets (overridable by -h at runtime.)],
428 [ rundir=$withval ],[ rundir=/usr/local/citadel ] )
429 AC_DEFINE_UNQUOTED([RUNDIR],["$rundir"],[where should we make look for citadel sockets?])
432 AC_ARG_WITH(staticdir, [ --with-staticdir=DIR where to put datafiles],
433 [ staticdir=$withval ],[ staticdir=$prefix ] )
436 AC_ARG_WITH(staticrundir, [ --with-staticrundir=DIR where to search datafiles at runtime],
437 [ staticrundir=$withval ],[ staticrundir=$staticdir ] )
439 AC_DEFINE_UNQUOTED([DATADIR],["$staticrundir"],[where should we make our root?])
442 AC_ARG_WITH(editordir, [ --with-editordir=DIR where to search the editor at runtime],
443 [ editordir=$withval ],[ editordir=$staticrundir ] )
445 AC_DEFINE_UNQUOTED([EDITORDIR],["$editordir"],[where find the editor (tiny_mce)?])
449 AC_OUTPUT(Makefile src/Makefile po/Makefile.in)
452 echo ------------------------------------------------------------------------
453 echo 'zlib compression: ' $ok_zlib
454 echo 'Calendar support: ' $ok_libical
455 echo 'Character set conversion support:' $ok_iconv
456 echo 'National language support: ' $_nls_avail