diff --git a/src/m4/bitcoin_subdir_to_include.m4 b/src/m4/bitcoin_subdir_to_include.m4 index 9b37a75ef0..66f106c7d4 100644 --- a/src/m4/bitcoin_subdir_to_include.m4 +++ b/src/m4/bitcoin_subdir_to_include.m4 @@ -5,8 +5,10 @@ AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[ AC_MSG_RESULT([default]) else echo "#include <$2$3.h>" >conftest.cpp - newinclpath=`${CXXCPP} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] + 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}]) - eval "$1=\"\$$1\"' -I${newinclpath}'" + if test "x${newinclpath}" != "x"; then + eval "$1=\"\$$1\"' -I${newinclpath}'" + fi fi ])