From 4a390372f0b21fd0b1753f63bf27fd1e37257f46 Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 7 Oct 2011 21:11:11 +0000 Subject: [PATCH] support clang as CC compiler git-svn-id: https://svn.dealii.org/trunk@24558 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 53 +++++++++++++++++++++++++++++----------------- deal.II/configure | 32 ++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 7fd9c6d0c1..998e746664 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -1382,26 +1382,33 @@ AC_DEFUN(DEAL_II_DETERMINE_CC_BRAND, dnl CC_VERSION=borland_bcc else - dnl KAI C? It seems as if the documented options - dnl -V and --version are not always supported, so give - dnl the whole thing a second try by looking for /KCC/ - dnl somewhere in the paths that are output by -v. This - dnl is risky business, since this combination of - dnl characters might appear on other installations - dnl of other compilers as well, so put this test to - dnl the very end of the detection chain for the - dnl various compilers - is_kai_cc="`($CC --version 2>&1) | grep 'KAI C'`" - is_kai_cc="$is_kai_cc`($CC -v 2>&1) | grep /KCC/`" - if test "x$is_kai_cc" != "x" ; then - AC_MSG_RESULT(C compiler is KAI C) - CC_VERSION=kai_cc - else - - dnl Aw, nothing suitable found... - AC_MSG_RESULT([Unrecognized compiler -- still trying]) - CC_VERSION=unknown_cc - fi + is_clang="`($CC --version 2>&1) | grep clang`" + if test "x$is_clang" != x ; then + AC_MSG_RESULT(C compiler is clang) + CC_VERSION=clang + else + + dnl KAI C? It seems as if the documented options + dnl -V and --version are not always supported, so give + dnl the whole thing a second try by looking for /KCC/ + dnl somewhere in the paths that are output by -v. This + dnl is risky business, since this combination of + dnl characters might appear on other installations + dnl of other compilers as well, so put this test to + dnl the very end of the detection chain for the + dnl various compilers + is_kai_cc="`($CC --version 2>&1) | grep 'KAI C'`" + is_kai_cc="$is_kai_cc`($CC -v 2>&1) | grep /KCC/`" + if test "x$is_kai_cc" != "x" ; then + AC_MSG_RESULT(C compiler is KAI C) + CC_VERSION=kai_cc + else + + dnl Aw, nothing suitable found... + AC_MSG_RESULT([Unrecognized compiler -- still trying]) + CC_VERSION=unknown_cc + fi + fi fi fi fi @@ -1540,6 +1547,12 @@ AC_DEFUN(DEAL_II_SET_CC_FLAGS, dnl ;; + clang) + CFLAGS="$CFLAGS -g" + CFLAGSO="$CFLAGS -fast -O2" + CFLAGSPIC="-fPIC" + ;; + sun_cc*) CFLAGS="$CFLAGS -g" CFLAGSO="$CFLAGS -fast -O2" diff --git a/deal.II/configure b/deal.II/configure index 8c792b8eba..9b603ebcdd 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -5175,18 +5175,26 @@ $as_echo "C compiler is Borland C" >&6; } CC_VERSION=borland_bcc else - is_kai_cc="`($CC --version 2>&1) | grep 'KAI C'`" - is_kai_cc="$is_kai_cc`($CC -v 2>&1) | grep /KCC/`" - if test "x$is_kai_cc" != "x" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: C compiler is KAI C" >&5 + is_clang="`($CC --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; } + CC_VERSION=clang + else + + is_kai_cc="`($CC --version 2>&1) | grep 'KAI C'`" + is_kai_cc="$is_kai_cc`($CC -v 2>&1) | grep /KCC/`" + if test "x$is_kai_cc" != "x" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: C compiler is KAI C" >&5 $as_echo "C compiler is KAI C" >&6; } - CC_VERSION=kai_cc - else + CC_VERSION=kai_cc + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unrecognized compiler -- still trying" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unrecognized compiler -- still trying" >&5 $as_echo "Unrecognized compiler -- still trying" >&6; } - CC_VERSION=unknown_cc - fi + CC_VERSION=unknown_cc + fi + fi fi fi fi @@ -5322,6 +5330,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; + clang) + CFLAGS="$CFLAGS -g" + CFLAGSO="$CFLAGS -fast -O2" + CFLAGSPIC="-fPIC" + ;; + sun_cc*) CFLAGS="$CFLAGS -g" CFLAGSO="$CFLAGS -fast -O2" -- 2.39.5