From 1f8962065da8a00d47a2ddeed57727b0e4f7f67a Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 21 Aug 2011 04:10:39 +0000 Subject: [PATCH] Detect and configure the clang C++ frontend for LLVM. git-svn-id: https://svn.dealii.org/trunk@24153 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 34 +++++++++++++++++++++++++++++----- deal.II/configure | 32 +++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index d1e416eae2..83423fbb88 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -300,11 +300,21 @@ AC_DEFUN(DEAL_II_DETERMINE_CXX_BRAND, dnl GXX_VERSION=pathscale_cc GXX_VERSION_DETAILED="$GXX_VERSION" else - dnl Aw, nothing suitable found... - AC_MSG_RESULT(Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org) - GXX_BRAND=Unknown - GXX_VERSION=unknown_cc - GXX_VERSION_DETAILED="$GXX_VERSION" + + is_clang="`($CXX --version 2>&1) | grep clang`" + if test "x$is_clang" != x ; then + AC_MSG_RESULT(C++ compiler is clang) + GXX_BRAND=clang + GXX_VERSION=clang + GXX_VERSION_DETAILED="$GXX_VERSION" + else + + dnl Aw, nothing suitable found... + AC_MSG_RESULT(Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org) + GXX_BRAND=Unknown + GXX_VERSION=unknown_cc + GXX_VERSION_DETAILED="$GXX_VERSION" + fi fi fi fi @@ -621,6 +631,16 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lm) ;; + clang*) + dnl Like many other compilers, clang produces warnings for array + dnl accesses out of bounds, even if they are in code that's dead + dnl for this dimension. suppress this + CXXFLAGSG="$CXXFLAGS -DDEBUG -g -Wall -Wno-array-bounds -Wno-parentheses -Wno-delete-non-virtual-dtor -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-variable" + CXXFLAGSO="$CXXFLAGS -O2" + CXXFLAGSPIC="-fPIC" + LDFLAGSPIC="-fPIC" + ;; + intel_icc*) dnl Earlier icc versions used -Kxxx for flags. Later versions use dnl the gcc convention -fxxx. Also, at least since icc11, the @@ -2044,6 +2064,10 @@ AC_DEFUN(DEAL_II_CHECK_MULTITHREADING, dnl LDFLAGS="$LDFLAGS -lpthread" ;; + clang*) + LDFLAGS="$LDFLAGS -lpthread" + ;; + pgCC*) LDFLAGS="$LDFLAGS -lpthread" ;; diff --git a/deal.II/configure b/deal.II/configure index 45b3b6b20d..e9bec39294 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 23754 . +# From configure.in Revision: 24112 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for deal.II 7.1.pre. # @@ -3998,11 +3998,22 @@ $as_echo "C++ compiler is PathScale C++" >&6; } GXX_VERSION=pathscale_cc GXX_VERSION_DETAILED="$GXX_VERSION" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org" >&5 + + is_clang="`($CXX --version 2>&1) | grep clang`" + if test "x$is_clang" != x ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: C++ compiler is clang" >&5 +$as_echo "C++ compiler is clang" >&6; } + GXX_BRAND=clang + GXX_VERSION=clang + GXX_VERSION_DETAILED="$GXX_VERSION" + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org" >&5 $as_echo "Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org" >&6; } - GXX_BRAND=Unknown - GXX_VERSION=unknown_cc - GXX_VERSION_DETAILED="$GXX_VERSION" + GXX_BRAND=Unknown + GXX_VERSION=unknown_cc + GXX_VERSION_DETAILED="$GXX_VERSION" + fi fi fi fi @@ -4663,6 +4674,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; + clang*) + CXXFLAGSG="$CXXFLAGS -DDEBUG -g -Wall -Wno-array-bounds" + CXXFLAGSO="$CXXFLAGS -O2" + CXXFLAGSPIC="-fPIC" + LDFLAGSPIC="-fPIC" + ;; + intel_icc*) case "$GXX_VERSION" in intel_icc5 | intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) @@ -5435,6 +5453,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext LDFLAGS="$LDFLAGS -lpthread" ;; + clang*) + LDFLAGS="$LDFLAGS -lpthread" + ;; + pgCC*) LDFLAGS="$LDFLAGS -lpthread" ;; -- 2.39.5