Updated version numbers.
[citadel.git] / citadel / configure.ac
index 4880fd3064c86a272bd86a9ffb844b259ad1a1e1..5c39ef79d966a8ca92471193bce751d968f20983 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl $Id$
 AC_PREREQ(2.52)
-AC_INIT([Citadel], [7.24], [http://www.citadel.org/])
+AC_INIT([Citadel], [7.36], [http://www.citadel.org/])
 AC_REVISION([$Revision: 5108 $])
 AC_CONFIG_SRCDIR([citserver.c])
 AC_PREFIX_DEFAULT(/usr/local/citadel)
@@ -13,7 +13,6 @@ else
        ssl_dir="$prefix/keys"
 fi
 
-
 dnl Make sure we see all GNU and Solaris extensions.
 AC_GNU_SOURCE
 
@@ -130,6 +129,65 @@ AC_ARG_WITH(docdir,
 )
 
 
+dnl Here is the check for a libc integrated iconv
+AC_ARG_ENABLE(iconv,
+       [  --disable-iconv         do not use iconv charset conversion],
+       ok_iconv=no, ok_iconv=yes)
+
+AC_MSG_CHECKING(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
+                 AC_MSG_RESULT([yes])
+               ],
+               [ 
+                 ok_iconv=no
+                 AC_MSG_RESULT([no])
+               ]
+)
+
+dnl Check for iconv in external libiconv
+if test "$ok_iconv" = no; then
+       AC_MSG_CHECKING(Checking for an external libiconv)
+       OLD_LDFLAGS="$LDFLAGS"
+       LDFLAGS="$LDFLAGS -liconv"
+       AC_TRY_RUN([
+                       #include <iconv.h>
+                       main() {
+                               iconv_t ic = (iconv_t)(-1) ;
+                               ic = iconv_open("UTF-8", "us-ascii");
+                               iconv_close(ic);
+                       }
+               ],
+                       [
+                         ok_iconv=yes
+                         AC_MSG_RESULT([yes])
+                       ],
+                       [ 
+                         ok_iconv=no
+                         LDFLAGS="$OLD_LDFLAGS"
+                         AC_MSG_RESULT([no])
+                       ]
+               )
+fi     
+if test "$ok_iconv" != "no"; then
+       AC_MSG_RESULT(WebCit will be built with character set conversion.)
+       AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
+else
+       AC_MSG_RESULT(WebCit will be built without character set conversion.)
+fi
+
+AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
+
+
 
 AC_ARG_ENABLE(threaded-client, [  --disable-threaded-client
                          disable multithreaded client])
@@ -151,10 +209,7 @@ AC_ARG_WITH(ncurses, [  --without-ncurses       don't use ncurses])
 
 AC_ARG_WITH(with_zlib, [  --with-zlib             use zlib compression if present])
 AC_ARG_WITH(with_ldap, [  --with-ldap             use OpenLDAP client library])
-AC_ARG_WITH(with_libical, [  --with-libical          use libical calendaring library])
-AC_ARG_WITH(with_libsieve, [  --with-libsieve         use libsieve mail sorting library])
 AC_ARG_WITH(with_libdspam, [  --with-libdspam         use libdspam mail spam scanning library])
-AC_ARG_WITH(with_expat, [  --with-expat            use Expat XML parser])
 
 if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then
        db_dir="$with_db"
@@ -308,7 +363,7 @@ dnl Checks for libraries.
 dnl We want to test for the following in libc before checking for their
 dnl respective libraries, because some systems (like Irix) have both, and the
 dnl non-libc versions may be broken.
-AC_CHECK_FUNCS(crypt gethostbyname connect flock)
+AC_CHECK_FUNCS(crypt gethostbyname connect flock getpwnam_r getpwuid_r)
 
 
 dnl disable backtrace if we don't want it.
@@ -381,14 +436,6 @@ dnl (Linux shadow passwords)
                fi
        fi
 
-test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
-AC_CHECK_LIB(resolv, res_query,
-       RESOLV="$RESOLV -lresolv",
-       [
-               AC_MSG_ERROR(libresolv was not found.  Citadel requires the resolver library.)
-       ]
-)
-
 if test "x$with_ncurses" != "xno"; then
        AC_SEARCH_LIBS(tgetent, [ncurses curses termcap])
        AC_SEARCH_LIBS(scrollok, [ncurses curses])
@@ -413,7 +460,6 @@ dnl Check for libcitadel
 AC_CHECK_HEADER(libcitadel.h,
        [AC_CHECK_LIB(citadel, libcitadel_version_string,
                [
-                       AC_MSG_RESULT(OK)
                        LIBS="-lcitadel $LIBS"
                ],
                [
@@ -428,6 +474,7 @@ AC_CHECK_HEADER(libcitadel.h,
 
 
 
+
 # The big search for OpenSSL
 if test "$with_ssl" != "no"; then
        saved_LIBS="$LIBS"
@@ -597,20 +644,6 @@ fi
 
 
 
-dnl Checks for the libsieve mailbox sorting library.
-if test "x$with_libsieve" != xno ; then
-       AC_CHECK_HEADERS(sieve2.h,
-               [AC_CHECK_LIB(sieve, sieve2_license,
-                       [ok_libsieve=yes],,
-       )])
-fi
-
-if test "x$ok_libsieve" = xyes ; then
-       SERVER_LIBS="-lsieve $SERVER_LIBS"
-       AC_DEFINE(HAVE_LIBSIEVE, [], [define this if you have the libsieve mailbox filtering library available])
-fi
-
-
 dnl Checks for the libdspam mail spam scanning library.
 if test "x$with_libdspam" != xno ; then
        AC_CHECK_HEADERS(dspam/libdspam.h,
@@ -626,56 +659,82 @@ fi
 
 
 
-
 dnl Checks for the Expat XML parser.
-if test "x$with_expat" != xno ; then
-       AC_CHECK_HEADERS(expat.h,
-               [AC_CHECK_LIB(expat, XML_ParserCreateNS,
-                       [ok_expat=yes],,
-       )])
-fi
+AC_CHECK_HEADER(expat.h,
+       [AC_CHECK_LIB(expat, XML_ParserCreateNS,
+               [
+                       SERVER_LIBS="-lexpat $SERVER_LIBS"
+               ],
+               [
+                       AC_MSG_ERROR(The Expat XML parser was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+               ]
+       ,
+       )],
+       [
+               AC_MSG_ERROR(expat.h was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+       ]
+)
 
-if test "x$ok_expat" = xyes ; then
-       SERVER_LIBS="-lexpat $SERVER_LIBS"
-       AC_DEFINE(HAVE_EXPAT, [], [define this if you have the Expat XML parser available])
-fi
 
 
 
 
-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(
+dnl Checks for libcurl.
+AC_CHECK_HEADER(curl/curl.h,
+       [AC_CHECK_LIB(curl, curl_version,
                [
-#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);
-}
-               ], 
+                       SERVER_LIBS="-lcurl $SERVER_LIBS"
+               ],
+               [
+                       AC_MSG_ERROR(libcurl was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+               ]
+       ,
+       )],
+       [
+               AC_MSG_ERROR(curl/curl.h was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+       ]
+)
+
+
+
+
+
+
+
+dnl Checks for the libical iCalendar library.
+AC_CHECK_HEADER(ical.h,
+       [AC_CHECK_LIB(ical, icalcomponent_new,
                [
                        SERVER_LIBS="-lical $SERVER_LIBS"
-                       AC_DEFINE(HAVE_LIBICAL, [], [define this if you have the libical calendaring library available])
+               ],
+               [
+                       AC_MSG_ERROR(libical was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
                ]
-       )
-fi
+       ,
+       )],
+       [
+               AC_MSG_ERROR(ical.h was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+       ]
+)
+
+
+dnl Checks for the libsieve mailbox sorting library.
+AC_CHECK_HEADER(sieve2.h,
+       [AC_CHECK_LIB(sieve, sieve2_license,
+               [
+                       SERVER_LIBS="-lsieve $SERVER_LIBS"
+               ],
+               [
+                       AC_MSG_ERROR(libsieve was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+               ]
+       ,
+       )],
+       [
+               AC_MSG_ERROR(sieve2.h was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
+       ]
+)
 
 
 
@@ -755,26 +814,38 @@ else
        AC_DEFINE(F_XPID_T, "%x",  [whats the matching format string for xpid_t?])
 fi
 
-dnl AC_CHECK_FUNCS(res_query)
-AC_CACHE_CHECK([for the resolver calls], 
-              ac_cv_resquery_ok, 
-[AC_TRY_COMPILE([#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>], 
-               [
-                       char *domain="www.google.com";
-                       u_char *answer;
-                       int len;
-                       len = res_query( domain, C_IN, T_A, answer, PACKETSZ );
-               ],
-                ac_cv_resquery_ok=yes,
-               ac_cv_resquery_ok=no)
-])
-echo "resquery: $ac_cv_resquery_ok"
 
-dnl if test "$ac_cv_resquery_ok" = "no" ; then
-dnl    AC_DEFINE(RES_QUERY_GONE, "#error resquery not here. can't continue.")
-dnl fi
+dnl Our own happy little check for the resolver library.
+
+case "`uname -a`" in 
+ OpenBSD*)
+       echo "we don't need to check for resolv on openbsd"  
+       ;;
+ FreeBSD*)
+       echo "we don't need to check for resolv on freeBSD"  
+       ;;
+ *)
+       test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
+       AC_CHECK_LIB(resolv, res_query,
+               RESOLV="$RESOLV -lresolv",
+               [dnl Have to include resolv.h as res_query is sometimes defined as a macro
+                       AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
+                       saved_libs="$LIBS"
+                       LIBS="-lresolv $LIBS"
+                       AC_TRY_LINK([
+                               #ifdef HAVE_RESOLV_H
+                               #include <resolv.h>
+                               #endif],
+                               [res_query(0,0,0,0,0)],
+                               [AC_MSG_RESULT(yes)
+                                               have_res_query=yes],
+                               [AC_MSG_RESULT(no)
+                                       AC_MSG_ERROR(libresolv was not found.  Citadel requires the resolver library.)
+                               ])
+         ]
+       )
+       ;;
+esac
 
 
 
@@ -884,20 +955,20 @@ AC_SUBST(SERVER_LDFLAGS)
 AC_SUBST(SERVER_LIBS)
 AC_SUBST(SETUP_LIBS)
 AC_CONFIG_HEADER(sysdep.h)
+./mk_module_init.sh
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT(database_cleanup.sh)
 
+
 if test -z "$DATABASE"; then
        AC_MSG_WARN([No database driver was found. Please install Berkeley DB.])
 fi
 
 echo ------------------------------------------------------------------------
 echo 'zlib compression:                ' $ok_zlib
-echo 'Calendar support:                ' $ok_libical
 echo 'LDAP support:                    ' $ok_ldap
-echo 'Sieve mailbox filtering support: ' $ok_libsieve
+echo 'Character set conversion support:' $ok_iconv
 echo 'DSpam Scanning support:          ' $ok_libdspam
-echo 'Expat XML parser present:        ' $ok_expat
 echo 
 echo 'Note: if you are not using Linux, make sure you are using GNU make'
 echo '(gmake) to compile Citadel.'