aboutsummaryrefslogtreecommitdiff
path: root/src/m4/bitcoin_subdir_to_include.m4
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2013-09-10 17:51:05 -0700
committerGregory Maxwell <greg@xiph.org>2013-09-10 17:51:05 -0700
commit11a79680b174ec39d462925ea565a23aa8c147ad (patch)
tree6b38ba89eb3110af8a9c93a49ed141da2eeaef63 /src/m4/bitcoin_subdir_to_include.m4
parent85311c1ef8b438a93ecf04c100e877fb49634a90 (diff)
parent1e9d3b1392b604fafc6802e4d43469f519d14424 (diff)
Merge pull request #2979 from luke-jr/autoconf
Autoconf fixes
Diffstat (limited to 'src/m4/bitcoin_subdir_to_include.m4')
-rw-r--r--src/m4/bitcoin_subdir_to_include.m412
1 files changed, 12 insertions, 0 deletions
diff --git a/src/m4/bitcoin_subdir_to_include.m4 b/src/m4/bitcoin_subdir_to_include.m4
new file mode 100644
index 0000000000..9b37a75ef0
--- /dev/null
+++ b/src/m4/bitcoin_subdir_to_include.m4
@@ -0,0 +1,12 @@
+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} -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}'"
+ fi
+])