From c4a3b31278e0d52292c76f9fbf6f3c24fb1b2157 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Tue, 7 May 2019 15:33:48 +0200 Subject: [PATCH] configure: don't assume /usr/include/ is the header location It doesn't have to be. In order to check if the system header is available we'll now to try to compile a C program that includes it. Change-Id: Ie46c20dab5e96da746650bba1d5dbd0fc32ecec9 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453561 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6ecb338fa..e19971156 100755 --- a/configure +++ b/configure @@ -95,6 +95,7 @@ declare -A CONFIG source CONFIG.sh rm CONFIG.sh +BUILD_CMD="${CC:-cc} -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS" function check_dir() { arg="$1" @@ -471,7 +472,8 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then fi if [[ "${CONFIG[REDUCE]}" = "y" ]]; then - if [ ! -f /usr/include/libpmem.h ]; then + if ! echo -e '#include \nint main(void) { return 0; }\n' \ + | $BUILD_CMD -lpmem - 2>/dev/null; then echo --with-reduce requires libpmem. echo Please install then re-run this script. exit 1