AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
-dnl User may specify Heimdal Kerberos is needed from a non-standard location
-AC_ARG_WITH(heimdal-krb5,
- AS_HELP_STRING([--without-heimdal-krb5],
- [Compile without Heimdal Kerberos support.]), [
-case "$with_heimdal_krb5" in
- yes|no)
- : # Nothing special to do here
- ;;
- *)
- if test ! -d "$withval" ; then
- AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
- fi
- if test -d "$with_heimdal_krb5/lib64" ; then
- LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
- else
- LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
- fi
- CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
- krb5confpath="$with_heimdal_krb5/bin"
- with_heimdal_krb5=yes
-esac
-])
-AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
-
-
-
-dnl User may specify GNU gss is needed from a non-standard location
-AC_ARG_WITH(gnugss,
- AS_HELP_STRING([--without-gnugss],
- [Compile without the GNU gss libraries.]), [
-case "$with_gnugss" in
- yes|no)
- : # Nothing special to do here
- ;;
- *)
- if test ! -d "$withval" ; then
- AC_MSG_ERROR([--with-gnugss path does not point to a directory])
- fi
- if test ! -d "$with_gnugss/lib64" ; then
- LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
- else
- LIB_KRB5_PATH="-L$with_gnugss/lib"
- fi
- CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
- krb5confpath=
- with_gnugss=yes
-esac
-])
-AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
-
-# determine krb5 conflicts
-ac_with_krb5_count=0
-if test "x$with_mit_krb5" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
-fi
-if test "x$with_heimdal_krb5" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
-fi
-if test "x$with_gnugss" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
-fi
-
-if test $ac_with_krb5_count -gt 1 ; then
- AC_MSG_ERROR([Please choose only one Kerberos library.])
-elif test $ac_with_krb5_count -eq 0 ; then
+## find out if pkg-config or krb5-config will work
+if test "x$with_mit_krb5" != "xno"; then
# find installed libs via pkg-config or krb5-config
- PKG_CHECK_EXISTS(gssapi-krb5 krb5, [with_mit_krb5=yes])
- PKG_CHECK_EXISTS(heimdal-gssapi, [with_heimdal_krb5=yes])
- PKG_CHECK_EXISTS(gss, [with_gnugss=yes])
- if test "x$with_mit_krb5" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
- fi
- if test "x$with_heimdal_krb5" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
- fi
- if test "x$with_gnugss" = "xyes"; then
- ac_with_krb5_count=`expr $ac_with_krb5_count + 1`
- fi
- if test $ac_with_krb5_count -gt 1 ; then
- AC_MSG_ERROR([pkg-config found multiple Kerberos library. Please select one with --with-<kerberos package>])
- elif test $ac_with_krb5_count -eq 0 -a "$cross_compiling" = "no"; then
+ squid_pc_krb5_name=
+ PKG_CHECK_EXISTS(mit-krb5, [squid_pc_krb5_name="mit-krb5"])
+ PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
+ if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
# Look for krb5-config (unless cross-compiling)
AC_PATH_PROG(krb5_config,krb5-config,no)
if test "x$ac_cv_path_krb5_config" != "xno" ; then
ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
- if test $ac_heimdal -gt 0 ; then
- with_heimdal_krb5=yes
- ac_with_krb5_count=1
- fi
if test $ac_solaris -gt 0 ; then
with_solaris_krb5=yes
- ac_with_krb5_count=1
- fi
- if test $ac_apple -gt 0 ; then
+ elif test $ac_apple -gt 0 ; then
with_apple_krb5=yes
- ac_with_krb5_count=1
- fi
- if test $ac_heimdal -eq 0 && test $ac_solaris -eq 0 && test $ac_apple -eq 0; then
- with_mit_krb5=yes
- ac_with_krb5_count=1
+ elif test $ac_heimdal -gt 0; then
+ with_mit_krb5=no
+ if test "x$with_mit_krb5" = "xyes"; then
+ AC_MSG_ERROR([Could not find pkg-config or krb5-config for MIT Kerberos])
+ fi
fi
else
- AC_MSG_WARN([Could not find krb5-config in path])
+ if test "x$with_mit_krb5" = "xyes"; then
+ AC_MSG_ERROR([Could not find krb5-config in path])
+ else
+ with_mit_krb5=no
+ fi
fi
fi
fi
-if test "x$with_mit_krb5" = "xyes" || test "x$with_apple_krb5" = "xyes" ; then
+# detect MIT Kerberos or Apple Kerberos dependencies
+if test "x$with_mit_krb5" != "xno" || test "x$with_apple_krb5" = "xyes" ; then
SQUID_STATE_SAVE([squid_krb5_save])
LIBS="$LIBS $LIB_KRB5_PATH"
# auto-detect using pkg-config
- PKG_CHECK_MODULES([LIB_KRB5],[gssapi-krb5 krb5],,[
+ PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
# look for krb5-config (unless cross-compiling)
if test "$cross_compiling" = "no"; then
if test "x$krb5confpath" = "x" ; then
])
SQUID_STATE_ROLLBACK([squid_mit_save])
fi
-
])
if test "x$LIB_KRB5_LIBS" != "x"; then
AC_CHECK_HEADERS(profile.h)
SQUID_CHECK_KRB5_FUNCS
-
fi
- if test "x$KRB5LIBS" = "x"; then
+ if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
AC_MSG_ERROR([Required Kerberos library not found])
- ac_with_krb5_count=0
+ elif test "x$KRB5LIBS" = "x"; then
+ with_mit_krb5=no
+ with_apple_krb5=no
fi
-
SQUID_STATE_ROLLBACK([squid_krb5_save])
fi
-if test "x$with_solaris_krb5" = "xyes"; then
+# detect Solaris Kerberos dependencies
+if test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
SQUID_STATE_SAVE([squid_krb5_save])
LIBS="$LIBS $LIB_KRB5_PATH"
AC_MSG_WARN([If you need Kerberos support you will have to patch])
AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
fi
-
SQUID_CHECK_KRB5_FUNCS
-
fi
- if test "x$KRB5LIBS" = "x"; then
+ if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
+ # Error only if Solaris flavour was detected while looking for required MIT Kerberos
AC_MSG_ERROR([Required Kerberos library not found])
- ac_with_krb5_count=0
+ elif test "x$KRB5LIBS" = "x"; then
+ with_solaris_krb5=no
+ with_mit_krb5=no
fi
-
SQUID_STATE_ROLLBACK([squid_krb5_save])
fi
-if test "x$with_heimdal_krb5" = "xyes"; then
+dnl User may specify Heimdal Kerberos is needed from a non-standard location
+AC_ARG_WITH(heimdal-krb5,
+ AS_HELP_STRING([--without-heimdal-krb5],
+ [Compile without Heimdal Kerberos support.]), [
+case "$with_heimdal_krb5" in
+ yes|no)
+ : # Nothing special to do here
+ ;;
+ *)
+ if test ! -d "$withval" ; then
+ AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
+ fi
+ if test -d "$with_heimdal_krb5/lib64" ; then
+ LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
+ else
+ LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
+ fi
+ CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
+ krb5confpath="$with_heimdal_krb5/bin"
+ with_heimdal_krb5=yes
+esac
+])
+AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
+if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
+ # find installed libs via pkg-config or krb5-config
+ PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
+ if test "x$squid_pc_krb5_name" = "x"; then
+ PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
+ fi
+ if test "x$squid_pc_krb5_name" != "x" -a "$cross_compiling" = "no"; then
+ # Look for krb5-config (unless cross-compiling)
+ AC_PATH_PROG(krb5_config,krb5-config,no)
+ if test "x$ac_cv_path_krb5_config" != "xno" ; then
+ krb5confpath="`dirname $ac_cv_path_krb5_config`"
+ ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
+ if test "x$with_heimdal_krb5" = "xyes"; then
+ AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
+ fi
+ else
+ if test "x$with_heimdal_krb5" = "xyes"; then
+ AC_MSG_ERROR([Could not find krb5-config in path])
+ else
+ AC_MSG_WARN([Could not find krb5-config in path])
+ with_heimdal_krb5=no
+ fi
+ fi
+ fi
+fi
+if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
SQUID_STATE_SAVE([squid_krb5_save])
LIBS="$LIBS $LIB_KRB5_PATH"
# auto-detect using pkg-config
- PKG_CHECK_MODULES([LIB_KRB5],[heimdal-gssapi],,[
+ PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
# look for krb5-config (unless cross-compiling)
if test "$cross_compiling" = "no"; then
if test "x$krb5confpath" = "x" ; then
ac_krb5_config="$krb5confpath/krb5-config"
fi
fi
- if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
+ if test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"; then
# Get libs, etc
AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
fi
-
SQUID_CHECK_KRB5_FUNCS
-
fi
if test "x$KRB5LIBS" = "x"; then
- AC_MSG_ERROR([Required Kerberos library not found])
- ac_with_krb5_count=0
+ if test test "x$with_heimdal_krb5" = "xyes"; then
+ AC_MSG_ERROR([Required Heimdal Kerberos library not found])
+ else
+ AC_MSG_WARN([Heimdal Kerberos library not found])
+ fi
fi
-
SQUID_STATE_ROLLBACK([squid_krb5_save])
fi
-if test "x$with_gnugss" = "xyes"; then
+
+
+dnl User may specify GNU gss is needed from a non-standard location
+AC_ARG_WITH(gnugss,
+ AS_HELP_STRING([--without-gnugss],
+ [Compile without the GNU gss libraries.]), [
+case "$with_gnugss" in
+ yes|no)
+ : # Nothing special to do here
+ ;;
+ *)
+ if test ! -d "$withval" ; then
+ AC_MSG_ERROR([--with-gnugss path does not point to a directory])
+ fi
+ if test ! -d "$with_gnugss/lib64" ; then
+ LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
+ else
+ LIB_KRB5_PATH="-L$with_gnugss/lib"
+ fi
+ CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
+ krb5confpath=
+ with_gnugss=yes
+esac
+])
+AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
+if test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"; then
SQUID_STATE_SAVE([squid_krb5_save])
LIBS="$LIBS $LIB_KRB5_PATH"
AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
- AC_MSG_ERROR([library 'com_err' is required for GNU Kerberos])
+ AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
])
-
])
if test "x$LIB_KRB5_LIBS" != "x"; then
SQUID_CHECK_WORKING_KRB5
SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
-
fi
if test "x$KRB5LIBS" = "x"; then
- AC_MSG_ERROR([Required Kerberos library not found])
- ac_with_krb5_count=0
+ if test test "x$with_gnugss" = "xyes"; then
+ AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
+ else
+ AC_MSG_WARN([GNU GSS Kerberos library not found])
+ fi
fi
-
SQUID_STATE_ROLLBACK([squid_krb5_save])
fi
-if test $ac_with_krb5_count -gt 0 ; then
+
+if test "x$KRB5LIBS" != "x"; then
with_krb5=yes
fi
AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])