From 421368c04fdfdd3506b03deeca52071d9959ffe9 Mon Sep 17 00:00:00 2001 From: Greg Inozemtsev Date: Wed, 29 Jun 2022 20:20:48 +0000 Subject: [PATCH] configure: Fix vfio-user dependency check Use the same method for checking for vfio-user dependencies as the rest of the script (compiler invocation). Do not depend on headers being present in a specific location as long as they are usable. Change-Id: Iad14a72de7fd89f2cff2838e94bcbaad6b3f329d Signed-off-by: Greg Inozemtsev Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13493 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- configure | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index cac81ba76..c896da912 100755 --- a/configure +++ b/configure @@ -665,13 +665,14 @@ fi BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib) if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then - - if [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then + if ! echo -e '#include ' \ + | "${BUILD_CMD[@]}" -E - 2> /dev/null; then echo "ERROR: --with-vfio-user requires json-c-devel" echo "Please install then re-run this script" exit 1 fi - if [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then + if ! echo -e '#include ' \ + | "${BUILD_CMD[@]}" -E - 2> /dev/null; then echo "ERROR: --with-vfio-user requires libcmocka-devel" echo "Please install then re-run this script" exit 1