Don't just add "-lresolv" to KRB5_LIBS if it's missing - on some

platforms, it's missing because it's not needed, which is good because
it's not even *present* on those platforms (the resolver functions are
built into libc).  If there really are platforms where krb5-config is
broken to the extent that it doesn't list -lresolv when it's required,
the way to fix that is to try building a program with Heimdal and just
the krb5-config libraries and, if that fails, try building with those
libraries and -lresolv - if that works, add -lresolv to the list of
libraries.

Don't just replace -lcrypto with SSL_LIBS in KRB5_LIBS, as SSL_LIBS
might not contain any libraries - replace it only if SSL_LIBS is defined
as something.

svn path=/trunk/; revision=12099
This commit is contained in:
Guy Harris 2004-09-25 09:33:53 +00:00
parent 477eef9312
commit d0842822ad
1 changed files with 20 additions and 10 deletions

View File

@ -1009,18 +1009,28 @@ AC_DEFUN([AC_ETHEREAL_KRB5_CHECK],
KRB5_FLAGS=`"$KRB5_CONFIG" --cflags`
CFLAGS="$CFLAGS $KRB5_FLAGS"
CPPFLAGS="$CPPFLAGS $KRB5_FLAGS"
KRB5_LIBS=`"$KRB5_CONFIG" --libs | sed 's/-lcrypto//'`
KRB5_LIBS="$KRB5_LIBS $SSL_LIBS"
# Looks like krb5-config is lacking -lresolv on some systems
AC_MSG_CHECKING(whether library list looks OK)
if echo "$KRB5_LIBS" | grep resolv >/dev/null
#
# If we've set SSL_LIBS, use that instead of -lcrypto
# in KRB5_LIBS.
#
if test ! -z "$SSL_LIBS"
then
AC_MSG_RESULT(yes)
else
KRB5_LIBS="$KRB5_LIBS -lresolv"
AC_MSG_RESULT(Adding -lresolv to libs)
KRB5_LIBS=`"$KRB5_CONFIG" --libs | sed 's/-lcrypto//'`
KRB5_LIBS="$KRB5_LIBS $SSL_LIBS"
fi
#
# Looks like krb5-config is lacking -lresolv on some systems.
# At least on some of those systems (such as FreeBSD 4.6),
# this is because it is not required and, in fact, is not
# even present! This means that just adding -lresolv
# if it's missing is the wrong thing to do.
#
# If there are systems where it's not present, but is
# required, we'd have to add a test that tries to link
# a program using Heimdal with just KRB5_LIBS and, if
# that fails, adds -lresolv to KRB5_LIBS and tries that.
#
#
#LIBS="$LIBS $KRB5_LIBS"
ac_krb5_version=`"$KRB5_CONFIG" --version | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
fi