dnl Process this file with autoconf to produce a configure script. dnl $Id$ dnl AC_CONFIG_AUX_DIR([autoconf]) AC_INIT(src/webserver.c) AC_GNU_SOURCE AM_INIT_AUTOMAKE(webcit,6.72) AM_CONFIG_HEADER(config.h) AC_PROG_LIBTOOL dnl Make sure we see all GNU and Solaris extensions. #AC_CONFIG_HEADERS(sysdep.h) #AC_VERSION(6.72) #PACKAGE=gettext #VERSION=0.14.5 #AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") #AC_DEFINE_UNQUOTED(VERSION, "$VERSION") #AC_SUBST(PACKAGE) #AC_SUBST(VERSION) #AM_INIT_AUTOMAKE(gettext, 0.14.5) AC_SUBST(PROG_SUBDIRS) #AC_CANONICAL_HOST AC_PROG_INSTALL AC_CHECK_PROG(AUTOCONF, autoconf) AC_CHECK_PROG(SED, sed, sed, no) AC_PREFIX_DEFAULT(/usr/local/webcit) #AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library]) #AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present]) #AC_ARG_WITH(with_newt, [ --with-newt use newt window library]) #AC_ARG_WITH(ssl, # [ --with-ssl=PATH Specify path to OpenSSL installation ], # [ # if test "x$withval" != "xno" ; then # tryssldir=$withval # fi # ] #) #AC_DEFINE([HAVE_ICAL], [ --with-libical use libical calendaring library]) AC_DEFINE([HAVE_OPENSSL], [ --with-ssl=PATH Specify path to OpenSSL installation ], ssl_ok=no, [ if test "x$withval" != "xno" ; then tryssldir=$withval fi ssl_ok=yes ] ) dnl Set some system-specific variables which are OK to set before compiler dnl checks: PTHREAD_DEFS=-D_REENTRANT case "$host" in dnl Tru64 Unix requires we use -pthread instead of linking the threads dnl libraries directly, and we can't build threaded programs with gcc dnl due to header file problems. alpha*-dec-osf*) test -z "$CC" && CC=cc LIBS=-pthread ;; dnl FreeBSD is similar: *-*-freebsd*) LIBS=-pthread PTHREAD_DEFS=-D_THREAD_SAFE ;; *-*-solaris*) PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS' ;; esac AC_SUBST(PTHREAD_DEFS) dnl Checks for programs. AC_PROG_CC dnl Configure compiler flags for GCC if test "$GCC" = yes; then case "$host" in *-*-solaris*) CFLAGS="$CFLAGS -Wall -Wno-char-subscripts" ;; *) CFLAGS="$CFLAGS -Wall" ;; esac fi # missing_dir=`cd $ac_aux_dir && pwd` # AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) dnl Checks for libraries. if test "$LIBS" != -pthread; then AC_CHECK_LIB(pthread, pthread_create) AC_CHECK_LIB(pthreads, pthread_create) fi AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(connect, socket) dnl Checks for header files. AC_HEADER_STDC dnl AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T dnl AC_HEADER_TIME dnl Checks for library functions. AC_TYPE_SIGNAL dnl AC_FUNC_VPRINTF AC_CHECK_FUNCS(backtrace) AC_REPLACE_FUNCS(snprintf) dnl Checks for the libical calendaring library. AC_DEFINE([HAVE_LIBICAL], [--with-libical use libical calendaring library], ok_libical=no, ok_libical=yes) if test "x$with_libical" != xno ; then AC_CHECK_HEADERS(ical.h, [AC_CHECK_LIB(ical, icalcomponent_new, [ok_libical=yes],,)]) fi if test "x$ok_libical" = xyes ; then AC_TRY_RUN( [ #include main() { int major, minor, v; sscanf(ICAL_VERSION, "%d.%d", &major, &minor); v = 100*major + minor; printf("libical version: %i\n", v); if (v >= 24) { printf("This version is ok.\n"); return(0); } printf("libical 0.24 or newer required.\n"); printf("Citadel will be built without calendar support.\n"); return(1); } ], [ LIBS="-lical $LIBS" AC_DEFINE(HAVE_LIBICAL) ] ) fi dnl Checks for the zlib compression library. AC_DEFINE([with_zlib], [ --with-zlib use zlib compression if present], [ok_zlib=no], [AC_CHECK_HEADERS(zlib.h, [AC_CHECK_LIB(z, zlibVersion, [ok_zlib=yes],, )]) ]) if test "x$ok_zlib" = xyes ; then LIBS="-lz $LIBS" fi dnl Checks for the newt window library. AC_ARG_WITH([ok_newt], [ --with-newt use newt window library],ok_newt=no, [ AC_CHECK_HEADERS(newt.h, [AC_CHECK_LIB(newt, newtInit, [ok_newt=yes],[ok_newt=no], ) ]) ] ) if test "x$ok_newt" = xyes ; then SETUP_LIBS="-lnewt $SETUP_LIBS" fi # The big search for OpenSSL if test "$with_ssl" != "no"; then saved_LIBS="$LIBS" saved_LDFLAGS="$LDFLAGS" saved_CFLAGS="$CFLAGS" if test "x$prefix" != "xNONE"; then tryssldir="$tryssldir $prefix" fi AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [ 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 CFLAGS="$saved_CFLAGS" LDFLAGS="$saved_LDFLAGS" LIBS="$saved_LIBS -lssl -lcrypto" # Skip directories if they don't exist if test ! -z "$ssldir" -a ! -d "$ssldir" ; then continue; fi if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then # Try to use $ssldir/lib if it exists, otherwise # $ssldir if test -d "$ssldir/lib" ; then LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" if test ! -z "$need_dash_r" ; then LDFLAGS="-R$ssldir/lib $LDFLAGS" fi else LDFLAGS="-L$ssldir $saved_LDFLAGS" if test ! -z "$need_dash_r" ; then LDFLAGS="-R$ssldir $LDFLAGS" fi fi # Try to use $ssldir/include if it exists, otherwise # $ssldir if test -d "$ssldir/include" ; then CFLAGS="-I$ssldir/include $saved_CFLAGS" else CFLAGS="-I$ssldir $saved_CFLAGS" fi fi # Basic test to check for compatible version and correct linking # *does not* test for RSA - that comes later. AC_TRY_RUN( [ #include #include int main(void) { char a[2048]; memset(a, 0, sizeof(a)); RAND_add(a, sizeof(a), sizeof(a)); return(RAND_status() <= 0); } ], [ found_crypto=1 break; ], [] ) if test ! -z "$found_crypto" ; then break; fi done if test -z "$ssldir" ; then ssldir="(system)" fi if test ! -z "$found_crypto" ; then ac_cv_openssldir=$ssldir else ac_cv_openssldir="no" fi ]) LIBS="$saved_LIBS" LDFLAGS="$saved_LDFLAGS" CFLAGS="$saved_CFLAGS" if test "x$ac_cv_openssldir" != "xno" ; then AC_DEFINE(HAVE_OPENSSL) LIBS="-lssl -lcrypto $LIBS" dnl Need to recover ssldir - test above runs in subshell ssldir=$ac_cv_openssldir if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then # Try to use $ssldir/lib if it exists, otherwise # $ssldir if test -d "$ssldir/lib" ; then LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" if test ! -z "$need_dash_r" ; then LDFLAGS="-R$ssldir/lib $LDFLAGS" fi else LDFLAGS="-L$ssldir $saved_LDFLAGS" if test ! -z "$need_dash_r" ; then LDFLAGS="-R$ssldir $LDFLAGS" fi fi # Try to use $ssldir/include if it exists, otherwise # $ssldir if test -d "$ssldir/include" ; then CFLAGS="-I$ssldir/include $saved_CFLAGS" else CFLAGS="-I$ssldir $saved_CFLAGS" fi fi fi fi dnl Here is the check for a usable iconv AC_DEFINE([HAVE_ICONV], [ --disable-iconv do not use iconv charset conversion], ok_iconv=no, ok_iconv=yes) if test "$ok_nls" != "no"; then AC_MSG_RESULT(Checking to see if your system supports iconv...) AC_TRY_RUN([ #include main() { iconv_t ic = (iconv_t)(-1) ; ic = iconv_open("UTF-8", "us-ascii"); iconv_close(ic); exit(0); } ], ok_iconv=yes, ok_iconv=no ) fi if test "$ok_iconv" != "no"; then AC_MSG_RESULT(WebCit will be built with character set conversion.) AC_DEFINE(HAVE_ICONV) else AC_MSG_RESULT(WebCit will be built without character set conversion.) fi AC_DEFINE_UNQUOTED([PREFIX],["$prefix"],where should we make our root?) dnl AC_SUBST(PREFIX) dnl dnl Here is the check for libintl etc. dnl dnl AC_DEFINE([ENABLE_NLS], dnl [ --disable-nls do not use Native Language Support], dnl ok_nls=no, ok_nls=yes) dnl dnl if test "$ok_nls" != "no"; then dnl AC_MSG_RESULT(Checking for per-thread NLS support...) dnl AC_TRY_RUN([ dnl #define _GNU_SOURCE dnl #include dnl #include dnl #include dnl main() { dnl char *foo = NULL; dnl char baz[32]; dnl struct tm *tm; dnl uselocale(LC_GLOBAL_LOCALE); dnl foo = gettext("bar"); dnl if (0) { dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE); dnl } dnl exit(0); dnl } dnl ], dnl ok_uselocale=yes, dnl ok_uselocale=no dnl ) dnl ok_nls=$ok_uselocale dnl fi dnl dnl if test "$ok_nls" != "no"; then dnl AC_CHECK_PROG(ok_xgettext, xgettext, yes, no) dnl ok_nls=$ok_xgettext dnl fi dnl dnl if test "$ok_nls" != "no"; then dnl AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no) dnl ok_nls=$ok_msgmerge dnl fi dnl dnl if test "$ok_nls" != "no"; then dnl AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no) dnl ok_nls=$ok_msgfmt dnl fi dnl dnl if test "$ok_nls" != "no"; then dnl AC_MSG_RESULT(WebCit will be built with national language support.) dnl AC_DEFINE(ENABLE_NLS) dnl CFLAGS="$CFLAGS -I\$(top_srcdir)/po" dnl PROG_SUBDIRS="$PROG_SUBDIRS po" dnl AC_CHECK_LIB(intl, gettext) dnl else dnl AC_MSG_RESULT(WebCit will be built without national language support.) dnl fi dnl Checks for programs. AM_GNU_GETTEXT_VERSION([0.14]) #AM_GNU_GETTEXT # if we have intl/... AM_GNU_GETTEXT([external]) IT_PROG_INTLTOOL AC_SUBST(CFLAGS) AC_SUBST(SETUP_LIBS) AC_ARG_WITH(rundir, [ --with-rundir=DIR where to find the citadel servers sockets (overridable by -h at runtime.)], [ rundir=$withval ],[ rundir=/usr/local/citadel ] ) AC_DEFINE_UNQUOTED([RUNDIR],["$rundir"],where should we make look for citadel sockets??) AC_ARG_WITH(staticdir, [ --with-staticdir=DIR where to put datafiles], [ staticdir=$withval ],[ staticdir=$prefix ] ) AC_SUBST(staticdir) AC_ARG_WITH(staticrundir, [ --with-staticrundir=DIR where to search datafiles at runtime], [ staticrundir=$withval ],[ staticrundir=$staticdir ] ) AC_DEFINE_UNQUOTED([DATADIR],["$staticrundir"],where should we make our root?) AC_ARG_WITH(editordir, [ --with-editordir=DIR where to search the editor at runtime], [ editordir=$withval ],[ editordir=$staticrundir ] ) AC_SUBST(editordir) AC_DEFINE_UNQUOTED([EDITORDIR],["$editordir"],where find the editor (tiny_mce)?) AC_OUTPUT(Makefile src/Makefile po/Makefile.in ) echo ------------------------------------------------------------------------ echo 'zlib compression: ' $ok_zlib echo 'Calendar support: ' $ok_libical echo 'Character set conversion support:' $ok_iconv echo 'National language support: ' $ok_nls echo