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 <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453561
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Darek Stojaczyk 2019-05-07 15:33:48 +02:00 committed by Jim Harris
parent 788c16773b
commit c4a3b31278

4
configure vendored
View File

@ -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 <libpmem.h>\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