about summary refs log tree commit diff homepage
path: root/autoconf
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac35
1 files changed, 33 insertions, 2 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 18822396..97bd5eb6 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -32,8 +32,9 @@ AH_TOP([#ifndef KLEE_CONFIG_CONFIG_H
 #define KLEE_CONFIG_CONFIG_H])
 AH_BOTTOM([#endif])
 
-dnl FIXME: Make out of tree builds work.
-
+dnl We need to check for the compiler up here to avoid anything else
+dnl starting with a different one.
+AC_PROG_CXX(g++ clang++ )
 AC_LANG([C++])
 
 dnl **************************************************************************
@@ -154,6 +155,36 @@ else
 fi
 AC_SUBST(REQUIRES_RTTI,$requires_rtti)
 
+dnl Provide option to use C++11
+AC_ARG_ENABLE([cxx11],[  --enable-cxx11          Build using C++11], [klee_use_cxx11=1], [klee_use_cxx11=0])
+
+dnl LLVM >= 3.5 requires C++11
+AC_MSG_CHECKING([if LLVM needs C++11])
+if test '(' $llvm_version_major -eq 3 -a $llvm_version_minor -ge 5 ')' -o '(' $llvm_version_major -gt 3 ')' ; then
+  klee_use_cxx11=1
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+fi
+
+dnl Check if the compiler supports C++11 (this check is taken from LLVM's configure.ac).
+if test X${klee_use_cxx11} = X1; then
+  klee_old_cxxflags="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++11"
+  AC_LINK_IFELSE([AC_LANG_SOURCE([[
+#include <atomic>
+std::atomic<float> x(0.0f);
+int main() { return (float)x; }
+]])],
+            [AC_MSG_RESULT([yes])],
+            [AC_MSG_RESULT([no])
+             AC_MSG_ERROR([C++11 not supported])])
+  CXXFLAGS="$klee_old_cxxflags"
+fi
+
+AC_SUBST(KLEE_USE_CXX11,$klee_use_cxx11)
+
+
 AC_ARG_WITH(llvm-build-mode,
   AS_HELP_STRING([--with-llvm-build-mode],
     [LLVM build mode (e.g. Debug or Release, default autodetect)]),,[with_llvm_build_mode=check])