aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in226
1 files changed, 120 insertions, 106 deletions
diff --git a/configure.in b/configure.in
index 1935b397..235d4e24 100644
--- a/configure.in
+++ b/configure.in
@@ -15,11 +15,6 @@ PACKAGE=`sed -n '/PACKAGE *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
VERSION=`sed -n '/VERSION *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
AM_INIT_AUTOMAKE("$PACKAGE", "$VERSION")
-dnl Map autoconf, autoheader and aclocal to missing.sh if they are
-dnl not available in the system, so as not to cause problems in
-dnl Makefile.in. Be sure to fix this hack if we start supporting
-dnl automake (Makefile.am).
-
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_INSTALL
@@ -371,128 +366,147 @@ AC_ARG_ENABLE(netsec,
[with_netsec=no])
test "$with_netsec" = "yes" && AC_DEFINE(NET_SECURITY)
-### use option --with-kerberos5=DIR to point at a Kerberos 5 directory
+# This version of the Kerberos 4 and 5 options addresses the follwing issues:
+#
+# * Build correctly under Heimdal kerberos if it is compiled with db2 and
+# OpenSSL support (Debian's is)
+# * Build the kerberos.c stuff (KPOP) only for kerberosIV, to avoid breakage.
+# I don't know if this is 100% correct, but now at least IMAP and POP3
+# behave the same way regarding kerberosV.
+# * Build without any fuss for both kerberosIV and V at the same time.
+# * Move all the kerberos header mess to kerberos.h, and #include that
+# in driver.c and kerberos.c.
+#
+# Tested using the Heimdal Kerberos V libs, Kungliga Tekniska Högskolan (the
+# Royal Institute of Technology in Stockholm, Sweden)'s kerberos IV libs, and
+# the MIT reference implementation of KerberosV (all as packaged in Debian).
+
+### 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=$withval)
-
-# The "then" arm (nonempty $with_kerberos5) is kind of a crock. It works for
-# configuring the BSD/OS Kerberos V support, though.
-if test -n "$with_kerberos5" -a "$with_kerberos5" != "no"
+ [ --with-kerberos5=DIR point fetchmail compilation at a Kerberos 5
+directory],
+[
+if test "$with_kerberos5" != "no"
then
- # Path given
- echo "Configuring kerberosV for `uname`"
- AC_DEFINE(KERBEROS_V5)
- CEFLAGS="$CEFLAGS -I$with_kerberos5/include"
- LDEFLAGS="$LDEFLAGS -L$with_kerberos5/lib"
- AC_CHECK_LIB(crypto,
- krb5_des_string_to_key,
- libk5crypto=-lcrypto,
- AC_CHECK_LIB(k5crypto,
- krb5_des_string_to_key,
- libk5crypto=-lk5crypto,
- AC_ERROR(Kerberos 5 libraries not found),
- ${LDEFLAGS} -lcom_err),
- ${LDEFLAGS} -lcom_err)
- if test -f "$with_kerberos5/include/roken.h"
- then
- AC_DEFINE(HEIMDAL)
- LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -lcom_err"
- else
- LIBS="$LIBS -lkrb5 ${libk5crypto} -lcom_err"
- fi
-elif test "$with_kerberos" != "no" -a "$with_kerberos5" != "no" ; then
- for dir in /usr/kerberos /usr/local/krb5 /usr/athena
- do
- if test -f "$dir/include/krb5.h"
- then
- AC_DEFINE(KERBEROS_V5)
- CEFLAGS="$CEFLAGS -I$dir/include"
- LDEFLAGS="$LDEFLAGS -L$dir/lib"
- if test -f "$dir/include/roken.h"
- then
+ if test "$with_kerberos5" != "yes" ; then
+ searchdirs="$with_kerberos5"
+ else
+ searchdirs="/usr/kerberos /usr/local/krb5 /usr/athena /usr"
+ fi
+ with_kerberos5=
+ for dir in $searchdirs
+ do AC_MSG_CHECKING([for Kerberos V in $dir])
+ if test -f "$dir/include/krb5.h"
+ then
+ ac_krblibs=
+ if test -f "$dir/include/roken.h"
+ then
+ ac_krblibs="-lasn1 -lroken -lcom_err"
+ AC_MSG_RESULT([Heimdal found])
+ dnl Attempt to detect if we need to -ldb2 to link Heimdal
+ dnl we assume we do if it is available
+ AC_CHECK_LIB(db2, db_open, ac_krblibs="$ac_krblibs -ldb2", [],
+ ${LDEFLAGS})
+ AC_CHECK_LIB(des, des_string_to_key, libk5crypto=-ldes,
+ AC_CHECK_LIB(ssl, MD5_Init, [],
+ AC_ERROR([DES libraries not found. Try adding --with-ssl to enable OpenSSL support]),
+ ${LDEFLAGS} ${ac_krblibs}),
+ ${LDEFLAGS} ${ac_krblibs})
AC_DEFINE(HEIMDAL)
- LIBS="$LIBS -lkrb5 -lasn1 -ldes -lcom_err"
else
- AC_CHECK_LIB(crypto,
- krb5_des_string_to_key,
- libk5crypto=-lcrypto,
- AC_CHECK_LIB(k5crypto,
- krb5_des_string_to_key,
- libk5crypto=-lk5crypto,
- AC_ERROR(Kerberos 5 libraries not found),
- ${LDEFLAGS} -lcom_err),
- ${LDEFLAGS} -lcom_err)
- LIBS="$LIBS -lkrb5 ${libk5crypto} -lcom_err"
+ AC_MSG_RESULT([found])
+ ac_krblibs="-lcom_err"
+ AC_CHECK_LIB(crypto,
+ krb5_des_string_to_key,
+ libk5crypto=-lcrypto,
+ AC_CHECK_LIB(k5crypto,
+ krb5_des_string_to_key,
+ libk5crypto=-lk5crypto,
+ AC_ERROR([Kerberos 5 DES libraries not found]),
+ ${LDEFLAGS} ${ac_krblibs}),
+ ${LDEFLAGS} ${ac_krblibs})
fi
+ AC_CHECK_LIB(krb5, krb5_init_context,[],
+ continue,
+ ${LDEFLAGS} ${ac_krblibs})
+ AC_DEFINE(KERBEROS_V5)
+ test "$dir" != "/usr" && CEFLAGS="$CEFLAGS -I$dir/include"
+ LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ LIBS="$LIBS $ac_krblibs $libk5crypto"
with_kerberos5=$dir
break
- fi
- done
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ done
+ if test -z "$with_kerberos5" ; then
+ AC_ERROR([Kerberos 5 libraries not found])
+ fi
fi
+]) dnl --with-kerberos5=DIR
-### use option --with-kerberos=DIR to point at a Kerberos 4 directory
+### use option --with-kerberos=DIR to point at a Kerberos 4 directory
AC_ARG_WITH(kerberos,
- [ --with-kerberos=DIR point fetchmail compilation at a Kerberos 4 directory])
-
-# The "elif" arm (nonempty $with_kerberos) is kind of a crock. It works for
-# configuring the BSD/OS Kerberos IV support, though.
-
+ [ --with-kerberos=DIR point fetchmail compilation at a Kerberos 4
+directory],
+[
+if test "$with_kerberos" != "no"
+then
# Check for a NetBSD/OpenBSD special case
-if test "$with_kerberos" = "yes" && test `uname` = "NetBSD" -o `uname` = "OpenBSD"
+if test "$with_kerberos" = "yes" && ( test `uname` = "NetBSD" || test `uname`= "OpenBSD" )
then
- # Path given
- echo "Configuring kerberosIV for `uname`"
+ AC_CHECKING([kerberosIV for `uname`])
AC_DEFINE(KERBEROS_V4)
CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV"
LIBS="$LIBS -lkrb -ldes"
-elif test -n "$with_kerberos" -a -n "$with_kerberos5" -a "$with_kerberos" != "no" -a "$with_kerberos5" != "no"
-then
- AC_DEFINE(KERBEROS_V4)
- CEFLAGS="$CEFLAGS -I$with_kerberos/include"
- LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
- if test -f "$with_kerberos5/roken.h"
- then
- AC_DEFINE(HEIMDAL)
- LIBS="-lkrb4 -l45 $LIBS"
+else
+ #we need to detect when we're building under a kerberosV compatibility
+ #layer, btw...
+ if test "$with_kerberos" != "yes" ; then
+ searchdirs="$with_kerberos"
else
- LIBS="-lkrb4 -ldes425 $LIBS"
+ searchdirs="$with_kerberos5 /usr/kerberos /usr/kerberosIV /usr/athena/usr"
fi
-elif test -n "$with_kerberos5" -a "$with_kerberos" != "no" -a "$with_kerberos5" != "no"
-then
- for dir in /usr/kerberos /usr/kerberosIV /usr/athena
+ with_kerberos=
+ ac_saveLDFLAGS="$LDFLAGS"
+ for dir in $searchdirs
do
- if test -f "$dir/include/kerberosIV/krb.h"
- then
- AC_DEFINE(KERBEROS_V4)
- CEFLAGS="$CEFLAGS -I$dir/include"
- LDEFLAGS="$LDEFLAGS -L$dir/lib"
- LIBS="-lkrb4 -ldes425 $LIBS"
- break
- fi
+ AC_MSG_CHECKING([for Kerberos IV in $dir])
+ if test -f "$dir/include/krb.h" || test -f "$dir/include/krb4.h" \
+ || test -f "$dir/include/kerberosIV/krb.h"
+ then
+ AC_MSG_RESULT([found])
+ else
+ AC_MSG_RESULT([not found])
+ continue
+ fi
+ #Find libs
+ if test -f "$with_kerberos5/roken.h" ; then
+ AC_CHECK_LIB(45, krb_mk_req)
+ fi
+ LDFLAGS="-L$dir/lib $ac_saveLDFLAGS"
+ AC_SEARCH_LIBS(des_string_to_key, [des425 des], [], continue)
+ AC_SEARCH_LIBS(krb_realmofhost, [krb4 krb], [], continue)
+ with_kerberos="$dir"
+ if test -f "$dir/include/kerberosIV/krb.h" ; then
+ dir="$dir/include/kerberosIV"
+ else
+ dir="$dir/include"
+ fi
+ AC_DEFINE(KERBEROS_V4)
+ test -f "$with_kerberos5/roken.h" && AC_DEFINE(HEIMDAL)
+ test "$dir" != "/usr/include" && CEFLAGS="$CEFLAGS -I$dir"
+ LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
+ break
done
-elif test -n "$with_kerberos" -a "$with_kerberos" != "no"
-then
- AC_DEFINE(KERBEROS_V4)
- CEFLAGS="$CEFLAGS -I$with_kerberos/include"
- LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
- LIBS="$LIBS -lkrb -ldes"
-else
- if test "$with_kerberos" != "no"
- then
- for dir in /usr/kerberos /usr/kerberosIV /usr/athena
- do
- if test -f "$dir/include/krb.h"
- then
- AC_DEFINE(KERBEROS_V4)
- CEFLAGS="$CEFLAGS -I$dir/include"
- LDEFLAGS="$LDEFLAGS -L$dir/lib"
- LIBS="$LIBS -lkrb -ldes"
- break
- fi
- done
+ if test -z "$with_kerberos" ; then
+ AC_ERROR([Kerberos 4 libraries not found])
fi
+ LDFLAGS="$ac_saveLDFLAGS"
+fi
fi
+]) dnl --with-kerberos=DIR
### use option --with-ssl to compile in the SSL support
AC_ARG_WITH(ssl,