Detection of libidn and krb5.

This commit is contained in:
Mats Erik Andersson
2013-04-23 23:55:56 +02:00
parent ac310a022c
commit d3afcfa566
4 changed files with 110 additions and 43 deletions

View File

@@ -21,17 +21,21 @@ dnl along with this program. If not, see `http://www.gnu.org/licenses/'.
dnl Written by Miles Bader.
dnl IU_CHECK_KRB5(VERSION,PREFIX)
dnl Search for a Kerberos implementation in the standard locations plus PREFIX,
dnl if it is set and not "yes".
dnl VERSION should be either 4 or 5
dnl Search for a Kerberos implementation in the standard locations
dnl plus PREFIX, if it is set and is not "yes".
dnl VERSION should be either 4 or 5.
dnl
dnl Defines KRB5_CFLAGS and KRB5_LIBS if found.
dnl Defines KRB_IMPL to "Heimdal", "MIT", or "OldMIT", or "none" if not found
dnl Defines KRB5_IMPL to "krb5-config", "Heimdal", "MIT",
dnl "OpenBSD-Heimdal", or "OldMIT", if found, and to "none"
dnl otherwise.
AC_DEFUN([IU_CHECK_KRB5],
[
if test "x$iu_cv_lib_krb5_libs" = x; then
cache=""
## Make sure we have res_query
AC_CHECK_LIB(resolv, res_query)
AC_SEARCH_LIBS([res_query], [resolv])
KRB5_PREFIX=[$2]
KRB5_IMPL="none"
# First try krb5-config
@@ -44,7 +48,7 @@ AC_DEFUN([IU_CHECK_KRB5],
if test "$KRB5CFGPATH" != "none"; then
KRB5_CFLAGS="$CPPFLAGS `$KRB5CFGPATH --cflags krb$1`"
KRB5_LIBS="$LDFLAGS `$KRB5CFGPATH --libs krb$1`"
KRB5_IMPL="Heimdal"
KRB5_IMPL="krb5-config"
else
## OK, try the old code
saved_CPPFLAGS="$CPPFLAGS"
@@ -53,23 +57,26 @@ AC_DEFUN([IU_CHECK_KRB5],
if test "$KRB5_PREFIX" != "yes"; then
KRB5_CFLAGS="-I$KRB5_PREFIX/include"
KRB5_LDFLAGS="-L$KRB5_PREFIX/lib"
CPPFLAGS="$CPPFLAGS $KRB5_CFLAGS"
LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
else
## A very common location in recent times.
KRB5_CFLAGS="-I/usr/include/krb5"
fi
CPPFLAGS="$CPPFLAGS $KRB5_CFLAGS"
KRB4_LIBS="-lkrb4 -ldes425"
## Check for new MIT kerberos V support
LIBS="$saved_LIBS -lkrb5 -lk5crypto -lcom_err"
AC_TRY_LINK([], [return krb5_init_context((void *) 0); ],
[KRB5_IMPL="MIT"
KRB5_LIBS="$KRB5_LDFLAGS $KRB4_LIBS -lkrb5 -lk5crypto -lcom_err"], )
KRB5_LIBS="$KRB5_LDFLAGS -lkrb5 -lk5crypto -lcom_err"], )
## Heimdal kerberos V support
if test "$KRB5_IMPL" = "none"; then
LIBS="$saved_LIBS -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err"
AC_TRY_LINK([], [return krb5_init_context((void *) 0); ],
[KRB5_IMPL="Heimdal"
KRB5_LIBS="$KRB5_LDFLAGS $KRB4_LIBS -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err"]
KRB5_LIBS="$KRB5_LDFLAGS -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err"]
, )
fi

72
am/libidn.m4 Normal file
View File

@@ -0,0 +1,72 @@
# libidn.m4 serial 1
dnl Copyright (C) 2013 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Inetutils.
dnl
dnl GNU Inetutils is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or (at
dnl your option) any later version.
dnl
dnl GNU Inetutils is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see `http://www.gnu.org/licenses/'.
dnl Written by Mats Erik Andersson.
dnl IU_CHECK_LIBIDN([PREFIX],[HEADERLOC])
dnl Search for libidn in standard location and in PREFIX,
dnl if the latter is set and is neither "yes", nor "no".
dnl
dnl First check: $with_idn != no
AC_DEFUN([IU_CHECK_LIBIDN],
[
if test x"$with_idn" != xno \
&& test "$ac_cv_header_locale_h" = yes \
&& test "$ac_cv_func_setlocale" = yes
then
if test -n "$1" \
&& test x"$1" != xno \
&& test x"$1" != xyes
then
INCIDN=-I$1/include
LIBIDN=-L$1/lib
fi
if test -n "$2" \
&& test x"$2" != xyes
then
INCIDN=-I$2
fi
AC_CHECK_LIB([idn], [idna_to_ascii_lz],
[LIBIDN="$LIBIDN -lidn"], [INCIDN= LIBIDN=],
[$LIBIDN])
# Some systems are known to install <idna.h> below
# '/usr/include/idn'. The caching performed by
# AC_CHECK_HEADERS prevents detection of this using
# repeated call of the macro. Functional alternative?
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $INCIDN"
AC_CHECK_HEADERS([idna.h])
AC_MSG_CHECKING([if GNU libidn is available])
if test "$ac_cv_lib_idn_idna_to_ascii_lz" = yes \
&& test "$ac_cv_header_idna_h" = yes; then
AC_DEFINE(HAVE_IDN, 1, [Define to 1 for use of GNU Libidn.])
AC_MSG_RESULT($ac_cv_lib_idn_idna_to_ascii_lz)
else
AC_MSG_RESULT([no])
INCIDN= LIBIDN=
fi
CPPFLAGS=$save_CPPFLAGS
fi
AC_SUBST([LIBIDN])
AC_SUBST([INCIDN])
])# IU_CHECK_LIBIDN