src/crypto.c: possible fix for memory leak related
[citadel.git] / webcit / configure.in
index de39baae765c18e6d1e41f2b4d218b45df7b0d55..84fe4bec9dc375a8287fbe3336f85568164f7cd5 100644 (file)
@@ -1,32 +1,55 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl $Id$
-AC_INIT(webserver.c)
+dnl AC_CONFIG_AUX_DIR([autoconf])
+AC_INIT([webcit],[6.80],[uncensored.citadel.org])
+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)
 
-
-PACKAGE=webcit
-VERSION=6.40
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
 AC_SUBST(PROG_SUBDIRS)
-
-AC_CANONICAL_HOST
+#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,
+#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
@@ -64,14 +87,15 @@ if test "$GCC" = yes; then
        esac
 fi
 
-dnl ### missing_dir=`cd $ac_aux_dir && pwd`
-dnl ### AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+# 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_CHECK_LIB(iconv, libiconv, [LIBS="$LIBS -liconv"])   
 AC_SEARCH_LIBS(gethostbyname, nsl)
 AC_SEARCH_LIBS(connect, socket)
 
@@ -92,15 +116,18 @@ dnl AC_HEADER_TIME
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
 dnl AC_FUNC_VPRINTF
-dnl AC_CHECK_FUNCS(strerror)
+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],,
-        )])
+                 AC_CHECK_HEADERS(ical.h,
+                                    [AC_CHECK_LIB(ical, icalcomponent_new,
+                                   [ok_libical=yes],,)])
 fi
 
 if test "x$ok_libical" = xyes ; then
@@ -123,7 +150,7 @@ main() {
 }
                ], 
                [
-                       LIBS="-lical $LIBS"
+                       LIBS="$LIBS -lical"
                        AC_DEFINE(HAVE_LIBICAL)
                ]
        )
@@ -132,29 +159,29 @@ 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
+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"
-        AC_DEFINE(HAVE_ZLIB)
+        LIBS="$LIBS -lz "
 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
-
+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"
-       AC_DEFINE(HAVE_NEWT)
 fi
 
 # The big search for OpenSSL
@@ -269,7 +296,7 @@ fi
 
 dnl Here is the check for a usable iconv
 
-AC_ARG_ENABLE(iconv,
+AC_DEFINE([HAVE_ICONV],
        [  --disable-iconv         do not use iconv charset conversion],
        ok_iconv=no, ok_iconv=yes)
 
@@ -296,53 +323,135 @@ 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 <libintl.h>
+dnl                 #include <locale.h>
+dnl                 #include <time.h>
+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/... 
+IT_PROG_INTLTOOL
+AC_TRY_COMPILE([#include <locale.h>],
+                       [ extern locale_t wc_locales[]],
+                       [
+                       _nls_avail=yes
+                       AM_GNU_GETTEXT([external],[need-ngettext])
+                       ],
+                       [_nls_avail=no])
 
-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 to see if your system supports multithreaded NLS...)
-       AC_TRY_RUN([
-               #define _GNU_SOURCE
-               #include <locale.h>
-               #include <libintl.h>
-               main() {
-                       char *foo;
-                       uselocale(LC_GLOBAL_LOCALE);
-                       foo = gettext("bar");
-                       exit(0);
-               }
-       ],
-               ok_nls=yes,
-               ok_nls=no
-       )
-fi
 
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_nls, xgettext, yes, no)
-fi
+                       
 
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_nls, msgmerge, yes, no)
-fi
+dnl 
+dnl 
+dnl AC_TRY_RUN([
+dnl #include <libintl.h>
+dnl #include <locale.h>
+dnl int main(void)
+dnl {
+dnl    extern locale_t wc_locales[];
+dnl    return 1;
+dnl }
+dnl ],
+dnl                            [
+dnl                                    found_crypto=1
+dnl                                    break;
+dnl                            ], []
+dnl                    )
+dnl 
 
-if test "$ok_nls" != "no"; then
-       AC_CHECK_PROG(ok_nls, msgfmt, yes, no)
-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(CFLAGS)
 AC_SUBST(SETUP_LIBS)
 
-AC_OUTPUT(Makefile po/Makefile )
+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:       ' $_nls_avail
+echo