summaryrefslogtreecommitdiff
path: root/m4/ax_cxx_rvalue_references.m4
diff options
context:
space:
mode:
authorTudor Bosman <tudorb@gmail.com>2012-09-07 10:45:21 +0200
committerPeter Simons <simons@cryp.to>2012-09-07 10:46:00 +0200
commit8d4fb7842889783f527e5be233c2bb0cdb3dbce3 (patch)
tree9c40288d7686258762cbbe535a455a32bfb02811 /m4/ax_cxx_rvalue_references.m4
parentc78c8c763254ad0086bc8bd5c714cba0425080b2 (diff)
downloadautoconf-archive-8d4fb7842889783f527e5be233c2bb0cdb3dbce3.tar.gz
AX_CXX_RVALUE_REFERENCES: initial version
See <http://savannah.gnu.org/patch/?7833> for further details.
Diffstat (limited to 'm4/ax_cxx_rvalue_references.m4')
-rw-r--r--m4/ax_cxx_rvalue_references.m450
1 files changed, 50 insertions, 0 deletions
diff --git a/m4/ax_cxx_rvalue_references.m4 b/m4/ax_cxx_rvalue_references.m4
new file mode 100644
index 0000000..2720e71
--- /dev/null
+++ b/m4/ax_cxx_rvalue_references.m4
@@ -0,0 +1,50 @@
+# ============================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cxx_rvalue_references.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_RVALUE_REFERENCES
+#
+# DESCRIPTION
+#
+# Check whether C++11 rvalue references are supported. If they are, the
+# macro HAVE_RVALUE_REFERENCES is defined.
+#
+# Does not ensure that the compiler is in C++11 mode.
+#
+# LICENSE
+#
+# Copyright (c) 2012 Tudor Bosman <tudorb@gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_CXX_RVALUE_REFERENCES], [dnl
+ AC_LANG_ASSERT([C++])
+ # This compilation should succeed...
+ AC_CACHE_CHECK(whether $CXX supports rvalue references,
+ ax_cv_cxx_rvalue_references_supported, [
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #include <utility>
+ struct foo {
+ foo(foo&& other) { }
+ foo& operator=(foo&& other) {
+ if (&other == this) return *this;
+ std::move(other); // make sure this compiles
+ return *this;
+ }
+ };
+ ]])],
+ [ax_cv_cxx_rvalue_references_supported=yes],
+ [ax_cv_cxx_rvalue_references_supported=no])])
+ if test $ax_cv_cxx_rvalue_references_supported = yes
+ then
+ AC_DEFINE([HAVE_RVALUE_REFERENCES], [],
+ [define if the compiler supports rvalue references])
+ fi
+])