lbrycrd/src/m4/bitcoin_subdir_to_include.m4
Cory Fields c546dc05bb autotools: fix subdir m4 check, never let it return -I
If BDB_CPPFLAGS returns only "-I", the next argument sent to the preprocessor
is treated as a path. There are 2 fixes here:

1. Check in CPPFLAGS, as a user might have manually passed a path to check.
2. Ensure the value is not empty before setting BDB_CPPFLAGS to "-I value"
2013-09-18 17:11:41 -04:00

15 lines
602 B
Plaintext

dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE])
dnl SUBDIRECTORY-NAME must end with a path separator
AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[
if test "x$2" = "x"; then
AC_MSG_RESULT([default])
else
echo "#include <$2$3.h>" >conftest.cpp
newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`]
AC_MSG_RESULT([${newinclpath}])
if test "x${newinclpath}" != "x"; then
eval "$1=\"\$$1\"' -I${newinclpath}'"
fi
fi
])