2016-10-21 21:09:53 +00:00
|
|
|
dnl The gnutls libgnutls.so library
|
|
|
|
dnl
|
|
|
|
dnl Copyright (C) 2016 Red Hat, Inc.
|
|
|
|
dnl
|
|
|
|
dnl This library is free software; you can redistribute it and/or
|
|
|
|
dnl modify it under the terms of the GNU Lesser General Public
|
|
|
|
dnl License as published by the Free Software Foundation; either
|
|
|
|
dnl version 2.1 of the License, or (at your option) any later version.
|
|
|
|
dnl
|
|
|
|
dnl This library is distributed in the hope that it will be useful,
|
|
|
|
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
dnl Lesser General Public License for more details.
|
|
|
|
dnl
|
|
|
|
dnl You should have received a copy of the GNU Lesser General Public
|
|
|
|
dnl License along with this library. If not, see
|
|
|
|
dnl <http://www.gnu.org/licenses/>.
|
|
|
|
dnl
|
|
|
|
|
2016-12-12 17:11:51 +00:00
|
|
|
AC_DEFUN([LIBVIRT_ARG_GNUTLS],[
|
2016-12-22 11:49:51 +00:00
|
|
|
LIBVIRT_ARG_WITH_FEATURE([GNUTLS], [gnutls], [check], [2.2.0])
|
2016-12-12 17:11:51 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([LIBVIRT_CHECK_GNUTLS],[
|
2016-10-21 21:09:53 +00:00
|
|
|
LIBVIRT_CHECK_PKG([GNUTLS], [gnutls], [2.2.0])
|
|
|
|
|
2016-11-03 14:38:09 +00:00
|
|
|
if test "$with_gnutls" = "yes" ; then
|
|
|
|
dnl Double probe: gnutls >= 2.12 had a configure option for gcrypt and
|
|
|
|
dnl gnutls >= 3.0 uses only nettle. Our goal is to avoid gcrypt if we
|
|
|
|
dnl can prove gnutls uses nettle, but it is a safe fallback to use gcrypt
|
|
|
|
dnl if we can't prove anything.
|
2016-10-21 21:09:53 +00:00
|
|
|
|
2016-11-03 14:38:09 +00:00
|
|
|
GNUTLS_GCRYPT=
|
|
|
|
if $PKG_CONFIG --exists 'gnutls >= 3.0'; then
|
|
|
|
GNUTLS_GCRYPT="no"
|
|
|
|
else
|
|
|
|
GNUTLS_GCRYPT="probe"
|
|
|
|
fi
|
2016-10-21 21:09:53 +00:00
|
|
|
|
2016-11-03 14:38:09 +00:00
|
|
|
if test "$GNUTLS_GCRYPT" = "probe"; then
|
|
|
|
case $($PKG_CONFIG --libs --static gnutls) in
|
|
|
|
*gcrypt*) GNUTLS_GCRYPT=yes ;;
|
|
|
|
*nettle*) GNUTLS_GCRYPT=no ;;
|
|
|
|
*) GNUTLS_GCRYPT=unknown ;;
|
|
|
|
esac
|
|
|
|
fi
|
2016-10-21 21:09:53 +00:00
|
|
|
|
2016-11-03 14:38:09 +00:00
|
|
|
if test "$GNUTLS_GCRYPT" = "yes" || test "$GNUTLS_GCRYPT" = "unknown"; then
|
|
|
|
GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
|
|
|
|
dnl We're not using gcrypt deprecated features so define
|
|
|
|
dnl GCRYPT_NO_DEPRECATED to avoid deprecated warnings
|
|
|
|
GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
|
|
|
|
AC_DEFINE_UNQUOTED([WITH_GNUTLS_GCRYPT], 1,
|
|
|
|
[set to 1 if it is known or assumed that GNUTLS uses gcrypt])
|
|
|
|
fi
|
2016-10-21 21:09:53 +00:00
|
|
|
|
2016-12-22 13:09:43 +00:00
|
|
|
OLD_CFLAGS="$CFLAGS"
|
|
|
|
OLD_LIBS="$LIBS"
|
|
|
|
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
|
|
|
|
LIBS="$LIBS $GNUTLS_LIBS"
|
2016-11-03 14:38:09 +00:00
|
|
|
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
|
|
|
|
#include <gnutls/gnutls.h>
|
|
|
|
]])
|
|
|
|
|
2016-12-22 09:13:25 +00:00
|
|
|
AC_CHECK_FUNCS([gnutls_rnd])
|
|
|
|
AC_CHECK_FUNCS([gnutls_cipher_encrypt])
|
2016-12-22 13:09:43 +00:00
|
|
|
CFLAGS="$OLD_CFLAGS"
|
|
|
|
LIBS="$OLD_LIBS"
|
2016-11-03 14:38:09 +00:00
|
|
|
fi
|
2016-10-21 21:09:53 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([LIBVIRT_RESULT_GNUTLS],[
|
|
|
|
LIBVIRT_RESULT_LIB([GNUTLS])
|
|
|
|
])
|