]> Pileus Git - ~andy/fetchmail/blobdiff - configure.ac
Release 6.3.5.
[~andy/fetchmail] / configure.ac
index 3cef2f11a1936941cfd885e0eeecba254a9aa167..44aea1e078c25900be7342b3765d600135d143d1 100644 (file)
@@ -5,19 +5,27 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_INIT([fetchmail],[6.2.9-rc7])
+AC_INIT([fetchmail],[6.3.5],[fetchmail-users@lists.berlios.de])
 AC_CONFIG_SRCDIR([fetchmail.h])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_LIBOBJ_DIR([.])
 
 AC_CANONICAL_TARGET
 
-dnl we may need a newer automake version - the oldest tested is 1.7
+dnl automake options are in Makefile.am
 AC_PREREQ(2.59)
-AM_INIT_AUTOMAKE(1.5 foreign no-installinfo)
+AM_INIT_AUTOMAKE
 
-dnl the : states that python is optional
-AM_PATH_PYTHON(2.0,,:)
+dnl autobuild support, see <http://josefsson.org/autobuild/>
+(
+  TZ=GMT
+  export TZ
+  AB_INIT
+)
+
+dnl python is optional
+AM_PATH_PYTHON(2.0,,AC_MSG_WARN([Disabling fetchmailconf: python 2.0 or greater not found]))
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
 
 AC_PROG_AWK
 AC_PROG_CC
@@ -83,7 +91,7 @@ esac
 
 dnl i18n
 AM_GNU_GETTEXT([external], [need-ngettext])
-AM_GNU_GETTEXT_VERSION(0.14.1)
+AM_GNU_GETTEXT_VERSION(0.14.3)
 dnl end i18n
 
 # Under sysV68, socket and friends are provided by the C library.
@@ -129,18 +137,63 @@ AC_FUNC_VPRINTF
 AC_SUBST(EXTRAOBJ)
 
 AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid dnl
-  res_search strerror syslog snprintf vprintf vsnprintf vsyslog dnl
-  atexit inet_aton strftime setrlimit socketpair sigprocmask dnl
+  strerror syslog snprintf vprintf vsnprintf vsyslog dnl
+  atexit inet_aton strftime setrlimit socketpair dnl
   sigaction strdup setlocale)
 
+AC_CHECK_DECLS(strerror)
+dnl INET6 is used by KAME/getnameinfo
+AC_CACHE_CHECK(for AF_INET6/PF_INET6,ac_cv_inet6,
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM([[
+    #ifdef HAVE_SYS_TYPES_H
+    #include <sys/types.h>
+    #endif
+    #ifdef HAVE_SYS_SOCKET_H
+    #include <sys/socket.h>
+    #endif
+  ]],[[
+    int foo = AF_INET6;
+    int bar = PF_INET6;
+  ]])],
+  ac_cv_inet6=yes , ac_cv_inet6=no
+))
+if test "x$ac_cv_inet6" = xyes
+then
+    AC_DEFINE(INET6,1,Define to 1 if your system defines AF_INET6 and PF_INET6.)
+fi
+
 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
 # library.  So don't add -lresolv to the link list unless it's necessary
 # (It will be necessary when using GNU libc6).
-AC_CHECK_FUNC(res_search,
-    AC_MSG_RESULT(using libc's resolver functions),
-    AC_CHECK_LIB(resolv,res_search, 
-       [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
+old_LIBS="$LIBS"
+for lib in '' -lresolv; do
+    if test -z "$lib"; then
+       AC_MSG_CHECKING([for res_search in libc])
+    else
+       AC_MSG_CHECKING([for res_search in $lib])
+    fi
+    LIBS="$old_LIBS $lib"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#ifdef HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+extern int res_search();
+]], [[res_search(0, 0, 0, 0, 0);]])],
+    [AC_MSG_RESULT([found])
+     AC_DEFINE(HAVE_RES_SEARCH, [1],
+              [Define to 1 if you have the 'res_search' function.])
+     break], [AC_MSG_RESULT([not found])])
+     LIBS=$old_LIBS
+done
 
 dnl Check for libcrypt -- it may live in libc or libcrypt, as on IRIX
 AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt,crypt))
@@ -253,30 +306,30 @@ case "$enable_fallback" in
                                #not reached
                        fi
                        AC_DEFINE_UNQUOTED(FALLBACK_MDA, "$sendmail -i %T", Fallback MTA to use if defined)
-                       echo "Will use $sendmail as fallback MDA."
+                       AC_MSG_NOTICE(Will use $sendmail as fallback MDA.)
                        ;;
        procmail)       if test -z "$procmail" ; then
                                AC_MSG_ERROR([procmail selected as fallback, but not found])
                                #not reached
                        fi
                        AC_DEFINE_UNQUOTED(FALLBACK_MDA, "$procmail -d %T")
-                       echo "Will use $procmail as fallback MDA."
+                       AC_MSG_NOTICE(Will use $procmail as fallback MDA.)
                        ;;
        maildrop)       if test -z "$maildrop" ; then
                                AC_MSG_ERROR([maildrop selected as fallback, but not found])
                                #not reached
                        fi
                        AC_DEFINE_UNQUOTED(FALLBACK_MDA, "$maildrop -d %T")
-                       echo "Will use $maildrop as fallback MDA."
+                       AC_MSG_NOTICE(Will use $maildrop as fallback MDA.)
                        ;;
-       no|unset)       echo "Will not use a fallback MDA"
+       no|unset)       AC_MSG_NOTICE(Will not use a fallback MDA.)
                        ;;
        auto|yes|set)   if test -n "$sendmail" ; then
                                AC_DEFINE_UNQUOTED(FALLBACK_MDA,"$sendmail -i %T")
-                               echo "Will use $sendmail as fallback MDA."
+                               AC_MSG_NOTICE(Will use $sendmail as fallback MDA.)
                        else
-                               echo "No fallback MDA available. procmail and maildrop are not eligible"
-                               echo "for automatic fallback MDA configuration for reliability reasons."
+                               AC_MSG_WARN(No fallback MDA available.  procmail and maildrop are not eligible)
+                               AC_MSG_WARN(for automatic fallback MDA configuration for reliability reasons.)
                        fi
                        ;;
        *)              AC_MSG_ERROR([unkown value for --enable-fallback given: $enable_fallback])
@@ -294,6 +347,7 @@ AC_ARG_ENABLE(POP2,
        [with_POP2=$enableval],
        [with_POP2=no])
 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE,1,Define if you want POP2 support compiled in)
+AM_CONDITIONAL(POP2_ENABLE, test "$with_POP2" = yes)
 
 ###    use option --disable-POP3 to omit the POP3 support
 AC_ARG_ENABLE(POP3,
@@ -301,13 +355,15 @@ AC_ARG_ENABLE(POP3,
        [with_POP3=$enableval],
        [with_POP3=yes])
 test "$with_POP3" = "yes" && AC_DEFINE(POP3_ENABLE,1,Define if you want POP3 support compiled in)
+AM_CONDITIONAL(POP3_ENABLE, test "$with_POP3" = yes)
 
 ###    use option --disable-IMAP to omit the IMAP support
 AC_ARG_ENABLE(IMAP,
        [  --disable-IMAP          don't compile in IMAP protocol support],
        [with_IMAP=$enableval],
        [with_IMAP=yes])
-test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE,1,"Define if you want IMAP support compiled in")
+test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE,1,Define if you want IMAP support compiled in)
+AM_CONDITIONAL(IMAP_ENABLE, test "$with_IMAP" = yes)
 
 ###    use option --disable-ETRN to omit the ETRN support
 AC_ARG_ENABLE(ETRN,
@@ -315,6 +371,7 @@ AC_ARG_ENABLE(ETRN,
        [with_ETRN=$enableval],
        [with_ETRN=yes])
 test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE,1,Define if you want ETRN support compiled in.)
+AM_CONDITIONAL(ETRN_ENABLE, test "$with_ETRN" = yes)
 
 ###    use option --disable-ODMR to omit the ODMR support
 AC_ARG_ENABLE(ODMR,
@@ -322,6 +379,7 @@ AC_ARG_ENABLE(ODMR,
        [with_ODMR=$enableval],
        [with_ODMR=yes])
 test "$with_ODMR" = "yes" && AC_DEFINE(ODMR_ENABLE,1,Define if you want ODMR support compiled in)
+AM_CONDITIONAL(ODMR_ENABLE, test "$with_ODMR" = yes)
 
 ###    use option --enable-RPA to compile in the RPA support
 AC_ARG_ENABLE(RPA,
@@ -329,6 +387,7 @@ AC_ARG_ENABLE(RPA,
        [with_RPA=$enableval],
        [with_RPA=no])
 test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE,1,Define if you want RPA support compiled in)
+AM_CONDITIONAL(RPA_ENABLE, test "$with_RPA" = yes)
 
 ###    use option --enable-NTLM to compile in the NTLM support
 AC_ARG_ENABLE(NTLM,
@@ -342,19 +401,48 @@ AC_ARG_ENABLE(SDPS,
        [  --enable-SDPS           compile in SDPS protocol support],
        [with_SDPS=$enableval],
        [with_SDPS=no])
-test "$with_SDPS" = "yes" && AC_DEFINE(SDPS_ENABLE,1,Define if you want SDPS support compiled in)
+if test "$with_SDPS" = yes ; then
+   if test "$with_POP3" != yes ; then
+       AC_MSG_WARN([SDPS cannot be enabled with POP3 disabled. Disabling SDPS.])
+       with_SDPS=no
+   else
+       AC_DEFINE(SDPS_ENABLE,1,Define if you want SDPS support compiled in)
+   fi
+fi
+if test "$with_POP3" != yes && test "$with_POP2" != yes \
+    && test "$with_IMAP"  != yes ; then
+    AC_MSG_ERROR([You must enable at least one of POP2, POP3 and IMAP.])
+fi
 
 ###    use option --enable-opie to compile in the OPIE support
 AC_ARG_ENABLE(opie,
        [  --enable-opie           support OTP through the OPIE library],
-       [ AC_CHECK_HEADER(opie.h,, [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1])
-          AC_CHECK_LIB(opie,opiegenerator,, [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1])
+       [ AC_CHECK_HEADER(opie.h,, [AC_MSG_ERROR(cannot find <opie.h>, which is required for OPIE support.)])
+          AC_CHECK_LIB(opie,opiegenerator,, [AC_MSG_ERROR(cannot find libopie, which is required for OPIE support.)])
           with_opie=$enableval],
        [with_opie=no])
 test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE,1,Define if you want OPIE support compiled in)
 
 AC_SEARCH_LIBS(getaddrinfo, inet6, [AC_DEFINE(HAVE_GETADDRINFO,1,[define to 1 if you have the getaddrinfo function])])
-AC_CHECK_FUNCS(getnameinfo)
+AC_CHECK_FUNCS(getnameinfo inet_ntop)
+AM_CONDITIONAL(NEED_GETADDRINFO, test "$ac_cv_search_getaddrinfo" != "none required")
+AM_CONDITIONAL(NEED_GETNAMEINFO, test "$ac_cv_func_getnameinfo"   != yes)
+
+dnl Check if getaddrinfo is async-signal-safe - most implementations aren't
+if test "$ac_cv_search_getaddrinfo" = "none required" ; then
+    AC_MSG_CHECKING(if your getaddrinfo is async-signal-safe)
+    gai_ts=no
+    dnl we have getaddrinfo() - check if the OS is known to have a async-signal-safe implementation
+    case $target_os in
+       linux*)                                 gai_ts=yes ;;
+       freebsd5.5|freebsd6*|freebsd7*)         gai_ts=yes ;;
+       solaris2.8|solaris2.9|solaris2.10)      gai_ts=yes ;;
+    esac
+    AC_MSG_RESULT($gai_ts)
+    if test $gai_ts = yes ; then
+       AC_DEFINE(GETADDRINFO_ASYNCSAFE, 1, [define to 1 if you know your getaddrinfo function is async-signal-safe])
+    fi
+fi
 
 # This version of the Kerberos 4 and 5 options addresses the follwing issues:
 # 
@@ -374,8 +462,7 @@ AC_CHECK_FUNCS(getnameinfo)
 ###    use option --with-kerberos5=DIR to point at a Kerberos 5 directory
 ### make sure --with-ssl is run before --with-kerberos* !
 AC_ARG_WITH(kerberos5,
-       [  --with-kerberos5=DIR    point fetchmail compilation at a Kerberos 5
-directory],
+       [  --with-kerberos5=DIR    point fetchmail compilation at a Kerberos 5 directory],
 [
 if test "$with_kerberos5" != "no"
 then
@@ -409,10 +496,11 @@ else
   with_kerberos5=
   for dir in $searchdirs
   do AC_MSG_CHECKING([for Kerberos V in $dir])
-     if test -f "$dir/include/krb5.h"
+     if test -f "$dir/include/krb5.h" || test -f "$dir/include/krb5/krb5.h"
      then
+       if test -d "$dir/include/krb5" ; then CPFLAGS="$CPFLAGS -I$dir/include/krb5" ; fi
         ac_krblibs=
-        if test -f "$dir/include/roken.h"
+        if test -f "$dir/include/roken.h" || test -f "$dir/include/krb5/roken.h"
         then
            ac_krblibs="-lasn1 -lroken -lcom_err"
            AC_MSG_RESULT([Heimdal found])
@@ -460,26 +548,30 @@ fi
 ]) dnl --with-kerberos5=DIR
 
 ###    use option --with-kerberos=DIR to point at a Kerberos 4 directory
+KERBEROS_V4=0
 AC_ARG_WITH(kerberos,
-       [  --with-kerberos=DIR     point fetchmail compilation at a Kerberos 4
-directory],
+       [  --with-kerberos=DIR     point fetchmail compilation at a Kerberos 4 directory],
 [
 if test "$with_kerberos" != "no"
 then
+    AC_MSG_WARN([Kerberos IV support is obsolete. Use --with-kerberos5 if possible.])
 # Check for a NetBSD/OpenBSD special case
 if test "$with_kerberos" = "yes" && ( test `uname` = "NetBSD" || test `uname` = "OpenBSD" )
 then
   AS_MESSAGE(checking kerberosIV for `uname`...)
-  AC_DEFINE(KERBEROS_V4,1,Define if you have Kerberos V4)
+  KERBEROS_V4=1
   CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV"
-  LIBS="$LIBS -lkrb -ldes"
+  case `uname` in
+      NetBSD)  LIBS="$LIBS -lkrb -ldes -lroken -lcom_err" ;;
+      OpenBSD) LIBS="$LIBS -lkrb -ldes" ;;
+  esac
 elif krb4-config 2> /dev/null >/dev/null ; then
   krb4_prefix=`krb4-config --prefix`
   AC_MSG_RESULT([krb4-config points to kerberosIV under $krb4_prefix])
   unset krb4_prefix
   CEFLAGS="$CEFLAGS `krb4-config --cflags`"
   LIBS="$LIBS `krb4-config --libs`"
-  AC_DEFINE(KERBEROS_V4)
+  KERBEROS_V4=1
 elif krb5-config 2> /dev/null >/dev/null ; then
   krb4_prefix=`krb5-config --prefix krb4`
   AC_MSG_RESULT([krb5-config points to kerberosIV under $krb4_prefix])
@@ -489,7 +581,7 @@ elif krb5-config 2> /dev/null >/dev/null ; then
   unset krb4_prefix
   CEFLAGS="$CEFLAGS `krb5-config --cflags krb4`"
   LIBS="$LIBS `krb5-config --libs krb4`"
-  AC_DEFINE(KERBEROS_V4)
+  KERBEROS_V4=1
 else
   #we need to detect when we're building under a kerberosV compatibility
   #layer, btw...
@@ -528,7 +620,7 @@ else
      else
        dir="$dir/include"
      fi
-     AC_DEFINE(KERBEROS_V4)
+     KERBEROS_V4=1
      test -f "$with_kerberos5/roken.h" && AC_DEFINE(HEIMDAL)
      test "$dir" != "/usr/include" && CEFLAGS="$CEFLAGS -I$dir"
      LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
@@ -541,6 +633,10 @@ else
 fi
 fi
 ]) dnl --with-kerberos=DIR
+if test "$KERBEROS_V4" = 1 ; then
+    AC_DEFINE(KERBEROS_V4,1,Define if you have Kerberos V4)
+fi
+AM_CONDITIONAL(KERBEROS_V4_ENABLE, test "$KERBEROS_V4" = 1)
 
 ###    use option --with-ssl to compile in the SSL support
 AC_ARG_WITH(ssl,
@@ -551,7 +647,7 @@ test "$with_ssl" != "no" && AC_DEFINE(SSL_ENABLE,1,Define if you want SSL suppor
 
 if test "$with_ssl" = "yes"
 then
-    #  He didn't specify an SSL location.  Let's look at some common
+    #  User didn't specify an SSL location.  Let's look at some common
     #  directories where SSL has been found in the past and try and auto
     #  configure for SSL.  OpenSSL determination will be made later.
     #  This will screw up if an OpenSSL install is located in a later
@@ -589,7 +685,7 @@ then
   if test -r $with_ssl/include/openssl/ssl.h
   then
     ###        ssl.h found under openssl.  Use openssl configuration preferentially,
-    echo "Enabling OpenSSL support in $with_ssl"
+    AC_MSG_NOTICE(Enabling OpenSSL support in $with_ssl.)
     test "$with_ssl" != "/usr" && CEFLAGS="$CEFLAGS -I$with_ssl/include"
     ### In Red Hat 9, this file includes a reference to <krb5.h>, so we
     ### force the Kerberos direcory onto the include path so it will build.
@@ -618,7 +714,7 @@ then
   dnl XXX FIXME: use pkg-config if available!
   AC_DEFINE(SSL_ENABLE)
 else
-  echo 'Disabling SSL support...'
+  AC_MSG_NOTICE(Disabling SSL support.)
 fi
 
 ###    use option --with-socks=DIR to point at SOCKS library
@@ -674,29 +770,45 @@ then
   then
     with_gssapi=$with_kerberos5
   fi
+
   if test "$with_gssapi" != "yes" -a -n "$with_gssapi"
   then
     CFLAGS="$CFLAGS -I$with_gssapi/include"
     LDFLAGS="$LDFLAGS -L$with_gssapi/lib"
   fi
 
-  AC_CHECK_LIB(gss, gss_check_version, LIBS="$LIBS -lgss", nogss=t)
-  if test -n "$nogss"
-  then
-  if test -f "$with_gssapi/include/roken.h"
-  then
-     LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -ldb -ldl"
-     AC_CHECK_LIB(gssapi, gss_init_sec_context,LIBS="$LIBS -lgssapi",
-                  AC_MSG_ERROR([could not find libgssapi which is needed for GSSAPI support]), )
-     AC_DEFINE(HEIMDAL)
+  dnl obtain gssapi default libs
+  if krb5-config --libs gssapi 2>/dev/null >/dev/null ; then
+      LIBS="$LIBS `krb5-config --libs gssapi`"
   else
-     AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,LIBS="$LIBS -lgssapi_krb5",
-                  AC_MSG_ERROR([could not find libgssapi_krb5 which is needed for GSSAPI support]), -lkrb5)
-  fi
+    AC_CHECK_LIB(gss, gss_check_version, LIBS="$LIBS -lgss", nogss=t)
+    if test -n "$nogss"
+    then
+      # -lgss not found
+      if test "$with_gssapi" = yes ; then
+         with_gssapi=/usr
+      fi
+      if test -f "$with_gssapi/include/roken.h" -o -f "$with_gssapi/include/krb5/roken.h"
+      then
+         # have roken.h, assume Heimdal
+        case `uname` in
+            NetBSD) LIBS="$LIBS -lkrb5" ;;
+            *)      LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -ldb -ldl" ;;
+        esac
+         AC_CHECK_LIB(gssapi, gss_init_sec_context,LIBS="$LIBS -lgssapi",
+                      AC_MSG_ERROR([could not find libgssapi which is needed for GSSAPI support]), )
+         AC_DEFINE(HEIMDAL)
+      else
+         # no roken.h, assume MIT
+         AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,LIBS="$LIBS -lgssapi_krb5",
+                      AC_MSG_ERROR([could not find libgssapi_krb5 which is needed for GSSAPI support]), -lkrb5)
+      fi
+    fi
   fi
   AC_DEFINE(GSSAPI,1,Define if you want GSSAPI authentication)
-  save_CPPFLAGS=$CPPFLAGS
-  CPPFLAGS="-I$with_gssapi/include"
+  if test "$with_gssapi" != yes ; then
+    CPPFLAGS="-I$with_gssapi/include"
+  fi
   AC_CHECK_HEADERS(gss.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
   if test "$ac_cv_header_gssapi_h" = "yes"; then
     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,1,Define if you have MIT kerberos))
@@ -761,7 +873,7 @@ if test "$needtrio" = 1 ; then
 fi
 dnl ----------------------------------------------------------------'
 
-AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in])
+AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in genlsm.sh])
 AC_OUTPUT
 
 dnl Local Variables: