summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico M. Crisostomo <enrico.m.crisostomo@gmail.com>2014-02-24 16:31:42 +0100
committerPeter Simons <simons@cryp.to>2014-02-24 16:32:42 +0100
commitfbcd388c05e92dea3d779d243fa2f93463b7abcf (patch)
tree6d9af20e428523f064997b89e45eb003edc12c37
parent3d1e2b6f21df708eb564d1714cd15a1a835d2016 (diff)
downloadautoconf-archive-fbcd388c05e92dea3d779d243fa2f93463b7abcf.tar.gz
AX_CXX_HAVE_HASH: initial version
-rw-r--r--m4/ax_cxx_have_hash.m454
1 files changed, 54 insertions, 0 deletions
diff --git a/m4/ax_cxx_have_hash.m4 b/m4/ax_cxx_have_hash.m4
new file mode 100644
index 0000000..ee5255b
--- /dev/null
+++ b/m4/ax_cxx_have_hash.m4
@@ -0,0 +1,54 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cxx_have_hash.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_HAVE_HASH()
+#
+# DESCRIPTION
+#
+# This macros checks if std::hash, added in C++11, is defined in the
+# <functional> header.
+#
+# If it is, define the ax_cv_cxx_have_hash environment variable to "yes"
+# and define HAVE_CXX_HASH.
+#
+# NOTE: This macros depends on AX_CXX_NAMESPACES.
+#
+# LICENSE
+#
+# Copyright (c) 2014 Enrico M. Crisostomo <enrico.m.crisostomo@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_HAVE_HASH],
+ [AC_CACHE_CHECK(
+ [for std::hash in functional],
+ ax_cv_cxx_have_hash,
+ [AC_REQUIRE([AX_CXX_NAMESPACES])
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [
+ [#include <functional>
+ #include <string>]
+ [using std::hash;]
+ ],
+ []
+ )],
+ [ax_cv_cxx_have_hash=yes],
+ [ax_cv_cxx_have_hash=no]
+ )
+ AC_LANG_POP([C++])])
+ if test x"$ax_cv_cxx_have_hash" = "xyes"
+ then
+ AC_DEFINE(HAVE_CXX_HASH,
+ 1,
+ [Define if functional defines the std::hash class.])
+ fi
+ ])