summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-04-28 05:23:36 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-04-28 05:23:36 -0500
commitc8f58ea6860b1ce2d4f0d8d039fd3a58727743a5 (patch)
tree1bb073ee58788a2f292d7364ae9cf438659fb5b0 /tools
parent1a45d745438b4571d23c19a0c3fe97f68bccd4f0 (diff)
downloadfork-ledger-c8f58ea6860b1ce2d4f0d8d039fd3a58727743a5.tar.gz
fork-ledger-c8f58ea6860b1ce2d4f0d8d039fd3a58727743a5.tar.bz2
fork-ledger-c8f58ea6860b1ce2d4f0d8d039fd3a58727743a5.zip
Added support for building with Clang and libc++ in C++11
Diffstat (limited to 'tools')
-rw-r--r--tools/configure.ac28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/configure.ac b/tools/configure.ac
index f7623f62..99eb7df5 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -527,6 +527,34 @@ AC_CACHE_CHECK(
AM_CONDITIONAL(HAVE_BOOST_TEST, test x$boost_test_avail_cv_ = xtrue)
+# check for C++11 and libc++
+AC_CACHE_CHECK(
+ [if C++11 and libc++ are available],
+ [cpp11_avail_cv_],
+ [cpp11_save_cxxflags=$CXXFLAGS
+ cpp11_save_ldflags=$LDFLAGS
+ CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS"
+ LDFLAGS="-stdlib=libc++ $LDFLAGS"
+ AC_LANG_PUSH(C++)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <boost/regex.hpp>
+ #include <iostream>]],
+ [[boost::regex foo_regexp("Hello, world!");
+ for (auto i : "Hello, world")
+ std::cout << i << std::endl;]])],
+ [cpp11_avail_cv_=true],
+ [cpp11_avail_cv_=false])
+ AC_LANG_POP
+ CXXFLAGS="$cpp11_save_cxxflags"
+ LDFLAGS="$cpp11_save_ldflags"])
+
+if [test x$cpp11_avail_cv_ = xtrue]; then
+ AC_DEFINE([HAVE_CPP11], [1], [Whether C++11 and libc++ are available])
+ CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS"
+ LDFLAGS="-stdlib=libc++ $LDFLAGS"
+fi
+
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_STAT