dnl Process this file with autoconf to produce a configure script. dnl $Id$ AC_INIT(webserver.c) AC_CANONICAL_HOST AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library]) AC_ARG_WITH(with_newt, [ --with-newt use newt window library]) 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 dnl AC_CHECK_FUNCS(strerror) AC_REPLACE_FUNCS(snprintf) dnl Checks for the libical calendaring library. 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() { float v; int i; sscanf(ICAL_VERSION, "%f", &v); printf("libical version: %0.2f\n", v); v = v * 100.0; i = (int) v; if (i >= 24) { printf("This version is ok.\n"); printf("WebCit will be built with calendar support.\n"); return(0); } printf("libical 0.24 or newer is required.\n"); printf("WebCit will be built without calendar support.\n"); return(1); } ], [ LIBS="-lical $LIBS" AC_DEFINE(HAVE_LIBICAL) ] ) fi dnl Checks for the newt window library. if test "x$with_newt" != xno ; then AC_CHECK_HEADERS(newt.h, [AC_CHECK_LIB(newt, newtInit, [ok_newt=yes],, )]) fi if test "x$ok_newt" = xyes ; then SETUP_LIBS="-lnewt $SETUP_LIBS" AC_DEFINE(HAVE_NEWT) fi AC_SUBST(SETUP_LIBS) AC_OUTPUT(Makefile)