configure: BITCOIN_SUBDIR_TO_INCLUDE: Improve compatibility with paths including space and multiline cpp output

This commit is contained in:
Luke Dashjr 2015-03-09 18:35:15 +00:00
parent c006ab29ce
commit f93e7c0e10

View File

@ -9,7 +9,7 @@ AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[
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`]
newinclpath=$(${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | sed [-E -e ':a' -e '/\\$/!b b' -e N -e 's/\\\n/ /' -e 't a' -e ':b' -e 's/^[^:]*:[[:space:]]*(([^[:space:]\]|\\.)*[[:space:]])*(([^[:space:]\]|\\.)*)]$3\.h[([[:space:]].*)?$/\3/' -e 't' -e d])
AC_MSG_RESULT([${newinclpath}])
if test "${newinclpath}" != ""; then
eval "$1=\"\$$1\"' -I${newinclpath}'"