build-sys: use pkg-config variable to check libtpms cryptolib

We also have to move the Travis tests to xenail since PKG_CHECK_VAR
was not available in trusty (14.04).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Marc-André Lureau 2018-08-03 11:56:15 +02:00 committed by Stefan Berger
parent 26320a82b2
commit 7318ae5125
2 changed files with 3 additions and 35 deletions

View File

@ -3,7 +3,7 @@ env:
- secure: mcAXlw5k/1yOP2RMKWEtvU2SnsuHo5Idoi5zZ+hLj2CzdvT77Wh8HWQ7NRsiamL+3dMPxzzy60IYNZQ8F29y3rvN7gASVsYn31G5UkmfvpPLiucuPADM1rNm8FYNlia0GFW4keP+LwMrBo6KDK9k0T8w4lquXBwMmNzhvCYVwkBIM5YwhXW5nk1dOJtf6zAb6gDH/VNEYTXXRKjA5Jvln7+EVHY61pEx6rJGa2GU0A49ms5UMJVzv85FraiHwlCPnNhQWGJ6sStqxsd5i6VBTCrkwMqnnA+ZBosqIJkBXp4OkudfPWE9vsn7TtuYdbheOkUIv6GRPFJNG3Vm3Wh/IwvSOILS5xAmsB3MxyK3BlILOYcsywiSzV5J4+s5Vnih4FaRQ3xx46Fq2ldatuk7npIxfdd3Co5V1KZh1pq3ckAdKlY2PEsQc0Kh72Lxf2N0XVw4s0H7gzrFk4/ghIvoCmAWBRSrN+R7wleEcmxDRgUZHP6Qc2ZNP+kljhBLqzinW2jyxPAqQS17g5Tb01+WfqkG/T5jboyIIe/OEQ5XbQp3/d8rUA8STpJxD25lwKKqlIqU3ZFWYfRT+pA0x83AdiTm53CJSQqFyCLtZCqK0XSZbLfmFzjZJ7I8FQxZoF2o03DDkL1Xs0z0sj87i3UnsYzxGdSrcU2JDK7qRIn39sM=
sudo: required
language: c
dist: trusty
dist: xenial
before_install:
- sudo apt-get -y install pep8
- pep8 $(find . -type f | grep -E "\.py$")

View File

@ -343,40 +343,8 @@ CFLAGS="$CFLAGS -Wreturn-type -Wsign-compare -Wswitch-enum"
CFLAGS="$CFLAGS -Wmissing-prototypes -Wall -Werror"
CFLAGS="$CFLAGS -Wformat -Wformat-security"
dnl We have to make sure libtpms is using the same crypto library
dnl to avoid problems
AC_MSG_CHECKING([the crypto library libtpms is using])
dirs=$($CC $CFLAGS -Xlinker --verbose 2>/dev/null | \
sed -n '/SEARCH_DIR/p' | \
sed 's/SEARCH_DIR("\(@<:@^"@:>@*\)"); */\1 /g' | \
sed 's|=/|/|g')
for dir in $dirs $LIBRARY_PATH; do
if test -r $dir/libtpms.so; then
if test -n "`ldd $dir/libtpms.so | grep libcrypto.so`"; then
libtpms_cryptolib="openssl"
break
fi
if test -n "`ldd $dir/libtpms.so | grep libnss3.so`"; then
libtpms_cryptolib="freebl"
break
fi
fi
case $host_os in
cygwin|openbsd*)
if test -r $dir/libtpms.a; then
if test -n "$(nm $dir/libtpms.a | grep "U AES_encrypt")"; then
libtpms_cryptolib="openssl"
fi
fi
;;
esac
done
if test -z "$libtpms_cryptolib"; then
AC_MSG_ERROR([Could not determine libtpms crypto library.])
fi
AC_MSG_RESULT([$libtpms_cryptolib])
PKG_CHECK_VAR([libtpms_cryptolib], [libtpms], [cryptolib],
[], AC_MSG_ERROR([Could not determine libtpms crypto library.]))
if test "$libtpms_cryptolib" != "$cryptolib"; then
echo "libtpms is using $libtpms_cryptolib; we have to use the same"