Updated the autoconf script and makefile so that
authorArt Cancro <ajc@citadel.org>
Fri, 5 Jan 2007 03:41:05 +0000 (03:41 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 5 Jan 2007 03:41:05 +0000 (03:41 +0000)
we don't get those occasional script errors when it wants to
automatically reconfigure.  I probably broke three other things because
I am not very good with autoconf.  :(

webcit/Makefile.in
webcit/acinclude.m4 [new file with mode: 0644]
webcit/aclocal.m4 [new file with mode: 0644]
webcit/bootstrap
webcit/configure.ac [new file with mode: 0644]
webcit/configure.in [deleted file]

index 2eac9b2b20e20662c0a5be3acf171cb24a1d68e3..a40e3fd3981a9fd929dfe4d74c749e704985e285 100644 (file)
@@ -71,14 +71,17 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.o \
        $(CC) $(CFLAGS) $(DEFS) -c $(PTHREAD_DEFS) -DWEBCITDIR=\"$(prefix)\" -DLOCALEDIR=\"$(LOCALEDIR)\" $<
 
 Makefile: $(srcdir)/Makefile.in config.status
-       CONFIG_FILES="Makefile" CONFIG_HEADERS= $(SHELL) ./config.status
+       CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
 
 config.status: $(srcdir)/configure
        $(SHELL) ./config.status --recheck
 
-$(srcdir)/configure: $(srcdir)/configure.in
+$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4
        cd $(srcdir) && $(AUTOCONF)
 
+$(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4
+       cd $(srcdir) && $(ACLOCAL)
+
 install:
        test -d $(DESTDIR)$(prefix) || mkdir $(DESTDIR)$(prefix)
        test -d $(DESTDIR)$(prefix)/static || mkdir $(DESTDIR)$(prefix)/static
diff --git a/webcit/acinclude.m4 b/webcit/acinclude.m4
new file mode 100644 (file)
index 0000000..0941acf
--- /dev/null
@@ -0,0 +1,50 @@
+# CIT_STRUCT_TM
+# ------------------
+# Figure out how to get the current GMT offset.  If `struct tm' has a
+# `tm_gmtoff' member, define `HAVE_STRUCT_TM_TM_GMTOFF'.  Otherwise, if the
+# external variable `timezone' is found, define `HAVE_TIMEZONE'.
+AC_DEFUN([CIT_STRUCT_TM],
+[AC_REQUIRE([AC_STRUCT_TM])dnl
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+])
+if test "$ac_cv_member_struct_tm_tm_gmtoff" != yes; then
+  AC_CACHE_CHECK(for timezone, ac_cv_var_timezone,
+[AC_TRY_LINK(
+[#include <time.h>],
+[printf("%ld", (long)timezone);], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
+  if test $ac_cv_var_timezone = yes; then
+    AC_DEFINE(HAVE_TIMEZONE, 1,
+              [Define if you don't have `tm_gmtoff' but do have the external
+               variable `timezone'.])
+  fi
+fi
+])# CIT_STRUCT_TM
+
+AC_DEFUN([AC_CHECK_DB],[
+for lib in $1
+do
+   AS_VAR_PUSHDEF([ac_tr_db], [ac_cv_db_lib_${lib}])dnl
+   bogo_saved_LIBS="$LIBS"
+   LIBS="$LIBS -l$lib"
+   AC_CACHE_CHECK([for db_create in -l${lib}], ac_tr_db,
+      [AC_TRY_LINK([#include <db.h>], [int foo=db_create((void *)0, (void *) 0, 
+0 )],
+                   [AS_VAR_SET(ac_tr_db, yes)],
+                   [AS_VAR_SET(ac_tr_db, no)])
+      ])
+   AS_IF([test AS_VAR_GET(ac_tr_db) = yes],
+         [$2
+         LIBS="$bogo_saved_LIBS"
+         SERVER_LIBS="$SERVER_LIBS -l$lib"
+          db=yes],
+         [LIBS="$bogo_saved_LIBS"
+          db=no])
+   AS_VAR_POPDEF([ac_tr_db])dnl
+test "$db" = "yes" && break
+done
+if test "$db" = "no"; then
+$3
+fi
+])# AC_CHECK_DB
+
diff --git a/webcit/aclocal.m4 b/webcit/aclocal.m4
new file mode 100644 (file)
index 0000000..6af4bc7
--- /dev/null
@@ -0,0 +1,102 @@
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+m4_include([acinclude.m4])
index bf42772201682557bbb9daea93e8c96af256f5c8..767549d89b26087aa59aa1a778a0e987701d6082 100755 (executable)
@@ -1,3 +1,57 @@
 #!/bin/sh
+#
+# run me after checking WebCit out of svn.
+#
+# $Id: bootstrap 3850 2005-09-13 14:00:24Z ajc $
+#
 
-autoconf
+# Remove any vestiges of pre-6.05 build environments
+rm -f .libs modules *.so *.lo *.la
+
+# Goofy red hat 7.3 stuff
+if grep 7.3 /etc/redhat-release >/dev/null 2>&1 ; then
+       redhat73=true
+else
+       redhat73=false
+fi
+if [ "$redhat73" = "true" ]; then
+       aclocal=/usr/bin/aclocal-1.5
+       autoconf=/usr/bin/autoconf-2.53
+       autoheader=/usr/bin/autoheader-2.53
+
+       if test -z $aclocal ; then
+               echo "Please install the automake15 RPM package"
+               redhat73=missing
+       fi
+       if test -z $autoconf || test -z $autoheader ; then
+               echo "Please install the autoconf253 RPM package"
+               redhat73=missing
+       fi
+       if test "$redhat73" = "missing" ; then
+               exit 1
+       fi
+else
+       aclocal=aclocal
+       autoconf=autoconf
+       autoheader=autoheader
+fi
+
+echo ... running aclocal ...
+$aclocal
+echo ... running autoconf ...
+$autoconf
+# If your autoconf version changes, the autom4te.cache stuff will mess you up.
+# Get rid of it.
+echo ... removing autoheader cache files ...
+rm -rf autom4te*.cache
+echo ... running autoheader ...
+$autoheader
+
+echo
+echo This script has been tested with autoconf 2.53 and
+echo automake 1.5. Other versions may work, but I recommend the latest
+echo compatible versions of these.
+echo
+echo Also note that autoconf and automake should be configured
+echo with the same prefix.
+echo
diff --git a/webcit/configure.ac b/webcit/configure.ac
new file mode 100644 (file)
index 0000000..b5eed7a
--- /dev/null
@@ -0,0 +1,353 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl $Id: configure.in 4798 2006-12-28 16:34:20Z ajc $
+AC_INIT(webserver.c)
+
+
+PACKAGE=webcit
+VERSION=7.02
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+
+AC_SUBST(PROG_SUBDIRS)
+AC_CANONICAL_HOST
+AC_PROG_INSTALL
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+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(ssl,
+       [  --with-ssl=PATH         Specify path to OpenSSL installation ],
+       [
+               if test "x$withval" != "xno" ; then
+                       tryssldir=$withval
+               fi
+       ]
+)
+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 <ical.h>
+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.
+if test "x$with_zlib" != xno ; then
+        AC_CHECK_HEADERS(zlib.h,
+                [AC_CHECK_LIB(z, zlibVersion,
+                        [ok_zlib=yes],,
+        )])
+fi
+
+if test "x$ok_zlib" = xyes ; then
+        LIBS="-lz $LIBS"
+        AC_DEFINE(HAVE_ZLIB)
+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 <string.h>
+       #include <openssl/rand.h>
+       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_ARG_ENABLE(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 <iconv.h>
+               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
+
+
+
+dnl Here is the check for libintl etc.
+
+AC_ARG_ENABLE(nls,
+       [  --disable-nls           do not use Native Language Support],
+       ok_nls=no, ok_nls=yes)
+
+if test "$ok_nls" != "no"; then
+       AC_MSG_RESULT(Checking for per-thread NLS support...)
+       AC_TRY_RUN([
+                #define _GNU_SOURCE
+                #include <libintl.h>
+                #include <locale.h>
+                #include <time.h>
+                main() {
+                        char *foo = NULL;
+                        char baz[32];
+                       struct tm *tm;
+                        uselocale(LC_GLOBAL_LOCALE);
+                        foo = gettext("bar");
+                       if (0) {
+                               strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
+                       }
+                        exit(0);
+               }
+       ],
+               ok_uselocale=yes,
+               ok_uselocale=no
+       )
+       ok_nls=$ok_uselocale
+fi
+
+if test "$ok_nls" != "no"; then
+       AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
+       ok_nls=$ok_xgettext
+fi
+
+if test "$ok_nls" != "no"; then
+       AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
+       ok_nls=$ok_msgmerge
+fi
+
+if test "$ok_nls" != "no"; then
+       AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
+       ok_nls=$ok_msgfmt
+fi
+
+if test "$ok_nls" != "no"; then
+       AC_MSG_RESULT(WebCit will be built with national language support.)
+       AC_DEFINE(ENABLE_NLS)
+       PROG_SUBDIRS="$PROG_SUBDIRS po"
+else
+       AC_MSG_RESULT(WebCit will be built without national language support.)
+fi
+
+AC_SUBST(SETUP_LIBS)
+
+AC_OUTPUT(Makefile po/Makefile )
+
+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 
diff --git a/webcit/configure.in b/webcit/configure.in
deleted file mode 100644 (file)
index b1d9170..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-dnl $Id$
-AC_INIT(webserver.c)
-
-
-PACKAGE=webcit
-VERSION=7.02
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
-
-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(ssl,
-       [  --with-ssl=PATH         Specify path to OpenSSL installation ],
-       [
-               if test "x$withval" != "xno" ; then
-                       tryssldir=$withval
-               fi
-       ]
-)
-
-
-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 <ical.h>
-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.
-if test "x$with_zlib" != xno ; then
-        AC_CHECK_HEADERS(zlib.h,
-                [AC_CHECK_LIB(z, zlibVersion,
-                        [ok_zlib=yes],,
-        )])
-fi
-
-if test "x$ok_zlib" = xyes ; then
-        LIBS="-lz $LIBS"
-        AC_DEFINE(HAVE_ZLIB)
-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 <string.h>
-       #include <openssl/rand.h>
-       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_ARG_ENABLE(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 <iconv.h>
-               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
-
-
-
-dnl Here is the check for libintl etc.
-
-AC_ARG_ENABLE(nls,
-       [  --disable-nls           do not use Native Language Support],
-       ok_nls=no, ok_nls=yes)
-
-if test "$ok_nls" != "no"; then
-       AC_MSG_RESULT(Checking for per-thread NLS support...)
-       AC_TRY_RUN([
-                #define _GNU_SOURCE
-                #include <libintl.h>
-                #include <locale.h>
-                #include <time.h>
-                main() {
-                        char *foo = NULL;
-                        char baz[32];
-                       struct tm *tm;
-                        uselocale(LC_GLOBAL_LOCALE);
-                        foo = gettext("bar");
-                       if (0) {
-                               strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
-                       }
-                        exit(0);
-               }
-       ],
-               ok_uselocale=yes,
-               ok_uselocale=no
-       )
-       ok_nls=$ok_uselocale
-fi
-
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
-       ok_nls=$ok_xgettext
-fi
-
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
-       ok_nls=$ok_msgmerge
-fi
-
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
-       ok_nls=$ok_msgfmt
-fi
-
-if test "$ok_nls" != "no"; then
-       AC_MSG_RESULT(WebCit will be built with national language support.)
-       AC_DEFINE(ENABLE_NLS)
-       PROG_SUBDIRS="$PROG_SUBDIRS po"
-else
-       AC_MSG_RESULT(WebCit will be built without national language support.)
-fi
-
-AC_SUBST(SETUP_LIBS)
-
-dnl where to make webcit search its mo's?
-if test "$prefix" = "NONE"; then
-       LOCALEDIR="$ac_default_prefix/locale/"
-else
-       LOCALEDIR="$prefix/locale/"
-fi
-AC_ARG_WITH(localedir, 
-                   [  --with-locale          directory where to find our mo's],
-                       [ if test "x$withval" != "xno" ; then
-                               LOCALEDIR="$withval/"
-                         fi
-                       ]
-)
-AC_SUBST(LOCALEDIR)
-
-AC_OUTPUT(Makefile po/Makefile )
-
-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