aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-02-28 12:38:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-02-28 12:38:15 +0200
commit3012187847b2783c49153db3f5486b84074cb2b0 (patch)
tree8d3b63fbea88f2cb530dc6f8121577856b4f37b8 /m4
parent3c13e8cd7a1b0bf7490b172b48424a91b126c650 (diff)
Build infrastructure for C++11 support
Diffstat (limited to 'm4')
-rw-r--r--m4/cxx11.m438
1 files changed, 38 insertions, 0 deletions
diff --git a/m4/cxx11.m4 b/m4/cxx11.m4
new file mode 100644
index 0000000..774f20d
--- /dev/null
+++ b/m4/cxx11.m4
@@ -0,0 +1,38 @@
+dnl file : m4/cxx11.m4
+dnl copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
+dnl license : GNU GPL v2; see accompanying LICENSE file
+dnl
+dnl CXX11(MACRO, DESCRIPTION)
+dnl
+dnl Check if we are compiling in the C++11 mode. If we are, define MACRO as
+dnl both a macro and conditional as well as set the cxx11 variable to 'yes'.
+dnl
+AC_DEFUN([CXX11],
+[
+cxx11=no
+
+AC_MSG_CHECKING([whether we are in C++11 mode])
+
+CXX_LIBTOOL_LINK_IFELSE(
+AC_LANG_SOURCE([[
+#include <memory>
+
+int
+main ()
+{
+ std::shared_ptr<int> p (new int (10));
+ *p = 11;
+}
+]]),
+[cxx11=yes])
+
+if test x"$cxx11" = xyes; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([$1], [1], [$2])
+else
+ AC_MSG_RESULT([no])
+fi
+
+AM_CONDITIONAL([$1], [test x$cxx11 = xyes])
+
+])dnl