From e3c4e3d446b3e646b79be737b1563b9169afcf0c Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 20 Apr 2008 20:06:36 +0000 Subject: Fix Autoconf syntax error when probing for libkrb5support. Thanks, Mike Garrison. Also update to the latest version of all of the Kerberos Autoconf probes. --- m4/krb5.m4 | 96 ++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 22 deletions(-) (limited to 'm4/krb5.m4') diff --git a/m4/krb5.m4 b/m4/krb5.m4 index 2474b47..c7aa5bf 100644 --- a/m4/krb5.m4 +++ b/m4/krb5.m4 @@ -7,6 +7,10 @@ dnl KRB5_LIBS. Provides the --with-krb5 configure option to specify a dnl non-standard path to the Kerberos libraries. Uses krb5-config where dnl available unless reduced dependencies is requested. dnl +dnl Sets an Automake conditional saying whether we use com_err, since if we're +dnl also linking with AFS libraries, we may have to change library ordering in +dnl that case. +dnl dnl Provides the macro RRA_LIB_KRB5 and sets the substitution variables dnl KRB5_CPPFLAGS, KRB5_LDFLAGS, and KRB5_LIBS. Also provides dnl RRA_LIB_KRB5_SET to set CPPFLAGS, LDFLAGS, and LIBS to include the @@ -14,9 +18,16 @@ dnl Kerberos libraries; RRA_LIB_KRB5_SWITCH to do the same but save the dnl current values first; and RRA_LIB_KRB5_RESTORE to restore those settings dnl to before the last RRA_LIB_KRB5_SWITCH. dnl +dnl Also provides the RRA_LIB_KRB5_OPTIONAL macro, which should be used if +dnl Kerberos support is optional. This macro will still always set the +dnl substitution variables, but they'll be empty unless --with-krb5 is used. +dnl Also, HAVE_KERBEROS will be defined if --with-krb5 is given and +dnl $rra_use_kerberos will be set to "true". +dnl dnl Written by Russ Allbery dnl Copyright 2005, 2006, 2007, 2008 dnl Board of Trustees, Leland Stanford Jr. University +dnl dnl See LICENSE for licensing terms. dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the Kerberos v5 @@ -50,11 +61,13 @@ AC_DEFUN([_RRA_LIB_KRB5_PATHS], KRB5_LDFLAGS="-L${rra_krb5_root}/lib"])]) dnl Does the appropriate library checks for reduced-dependency Kerberos v5 -dnl linkage. +dnl linkage. The single argument, if true, says to fail if Kerberos could not +dnl be found. AC_DEFUN([_RRA_LIB_KRB5_REDUCED], [RRA_LIB_KRB5_SWITCH AC_CHECK_LIB([krb5], [krb5_init_context], [KRB5_LIBS="-lkrb5"], - [AC_MSG_ERROR([cannot find usable Kerberos v5 library])]) + [AS_IF([test x"$1" = xtrue], + [AC_MSG_ERROR([cannot find usable Kerberos v5 library])])]) LIBS="$KRB5_LIBS $LIBS" AC_CHECK_FUNCS([krb5_get_error_message], [AC_CHECK_FUNCS([krb5_free_error_message])], @@ -70,7 +83,8 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED], RRA_LIB_KRB5_RESTORE]) dnl Does the appropriate library checks for Kerberos v5 linkage when we don't -dnl have krb5-config or reduced dependencies. +dnl have krb5-config or reduced dependencies. The single argument, if true, +dnl says to fail if Kerberos could not be found. AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [RRA_LIB_KRB5_SWITCH rra_krb5_extra= @@ -94,7 +108,7 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [rra_krb5_pthread="-lpthread"])]) AC_CHECK_LIB([krb5support], [krb5int_setspecific], [rra_krb5_extra="-lkrb5support $rra_krb5_extra $rra_krb5_pthread"], - [$rra_krb5_pthread])]) + , [$rra_krb5_pthread])]) AC_CHECK_LIB([com_err], [error_message], [rra_krb5_extra="-lcom_err $rra_krb5_extra"]) AC_CHECK_LIB([ksvc], [krb5_svc_get_msg], @@ -105,7 +119,8 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [rra_krb5_extra="-lk5profile $rra_krb5_extra"]) AC_CHECK_LIB([krb5], [krb5_cc_default], [KRB5_LIBS="-lkrb5 $rra_krb5_extra"], - [AC_MSG_ERROR([cannot find usable Kerberos v5 library])], + [AS_IF([test x"$1" = xtrue], + [AC_MSG_ERROR([cannot find usable Kerberos v5 library])])], [$rra_krb5_extra])], [-lasn1 -lroken -lcrypto -lcom_err $rra_krb5_extra]) LIBS="$KRB5_LIBS $LIBS" @@ -117,24 +132,14 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [AC_CHECK_HEADERS([et/com_err.h])])])]) RRA_LIB_KRB5_RESTORE]) -dnl The main macro. -AC_DEFUN([RRA_LIB_KRB5], +dnl The core of the library checking, shared between RRA_LIB_KRB5 and +dnl RRA_LIB_KRB5_OPTIONAL. The single argument, if "true", says to fail if +dnl Kerberos could not be found. +AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], [AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) -rra_krb5_root= -KRB5_CPPFLAGS= -KRB5_LDFLAGS= -KRB5_LIBS= -AC_SUBST([KRB5_CPPFLAGS]) -AC_SUBST([KRB5_LDFLAGS]) -AC_SUBST([KRB5_LIBS]) -AC_ARG_WITH([krb5], - [AC_HELP_STRING([--with-krb5=DIR], - [Location of Kerberos v5 headers and libraries])], - [AS_IF([test x"$withval" != xyes && test x"$withval" != xno], - [rra_krb5_root="$withval"])]) -AS_IF([test x"$rra_reduced_depends" = xtrue], + AS_IF([test x"$rra_reduced_depends" = xtrue], [_RRA_LIB_KRB5_PATHS - _RRA_LIB_KRB5_REDUCED], + _RRA_LIB_KRB5_REDUCED([$1])], [AC_ARG_VAR([KRB5_CONFIG], [Path to krb5-config]) AS_IF([test x"$rra_krb5_root" != x], [AS_IF([test -x "${rra_krb5_root}/bin/krb5-config"], @@ -161,4 +166,51 @@ AS_IF([test x"$rra_reduced_depends" = xtrue], [AC_CHECK_HEADERS([et/com_err.h])])])]) RRA_LIB_KRB5_RESTORE], [_RRA_LIB_KRB5_PATHS - _RRA_LIB_KRB5_MANUAL])])]) + _RRA_LIB_KRB5_MANUAL([$1])])]) + rra_krb5_uses_com_err=false + case "$LIBS" in + *-lcom_err*) + rra_krb5_uses_com_err=true + ;; + esac + AM_CONDITIONAL([KRB5_USES_COM_ERR], [test x"$rra_krb5_uses_com_err" = xtrue])]) + +dnl The main macro for packages with mandatory Kerberos support. +AC_DEFUN([RRA_LIB_KRB5], +[rra_krb5_root= + KRB5_CPPFLAGS= + KRB5_LDFLAGS= + KRB5_LIBS= + AC_SUBST([KRB5_CPPFLAGS]) + AC_SUBST([KRB5_LDFLAGS]) + AC_SUBST([KRB5_LIBS]) + AC_ARG_WITH([krb5], + [AC_HELP_STRING([--with-krb5=DIR], + [Location of Kerberos v5 headers and libraries])], + [AS_IF([test x"$withval" != xyes && test x"$withval" != xno], + [rra_krb5_root="$withval"])]) + _RRA_LIB_KRB5_INTERNAL]) + +dnl The main macro for packages with optional Kerberos support. +AC_DEFUN([RRA_LIB_KRB5_OPTIONAL], +[rra_krb5_root= + rra_use_kerberos= + KRB5_CPPFLAGS= + KRB5_LDFLAGS= + KRB5_LIBS= + AC_SUBST([KRB5_CPPFLAGS]) + AC_SUBST([KRB5_LDFLAGS]) + AC_SUBST([KRB5_LIBS]) + AC_ARG_WITH([krb5], + [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], + [Location of Kerberos v5 headers and libraries])], + [AS_IF([test x"$withval" = xno], + [rra_use_kerberos=false], + [AS_IF([test x"$withval" != xyes], [rra_krb5_root="$withval"]) + rra_use_kerberos=true])]) + AS_IF([test x"$rra_use_kerberos" != xfalse], + [AS_IF([test x"$rra_use_kerberos" = xtrue], + [_RRA_LIB_KRB5_INTERNAL([true])], + [_RRA_LIB_KRB5_INTERNAL([false])])]) + AS_IF([test x"$KRB5_LIBS" != x], + [AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])]) -- cgit v1.2.3