1 dnl Copyright (c) 2013-2014 The Bitcoin Core developers
2 dnl Distributed under the MIT software license, see the accompanying
3 dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE])
6 dnl SUBDIRECTORY-NAME must end with a path separator
7 AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[
8 if test "x$2" = "x"; then
9 AC_MSG_RESULT([default])
11 echo "#include <$2$3.h>" >conftest.cpp
12 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`]
13 AC_MSG_RESULT([${newinclpath}])
14 if test "x${newinclpath}" != "x"; then
15 eval "$1=\"\$$1\"' -I${newinclpath}'"