[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mesa3d-dev
Subject:    Re: [Mesa-dev] [PATCHES] clang compatibility
From:       nobled <nobled () dreamwidth ! org>
Date:       2010-08-30 0:03:37
Message-ID: AANLkTimHvTxxWT8gLJ5=NpOggwQ3zYPMxqirq=wtv46u () mail ! gmail ! com
[Download RAW message or body]

Eric Anholt <eric@anholt.net> wrote:
> On Sun, 22 Aug 2010 05:35:19 -0400, nobled <nobled@dreamwidth.org> wrote:
> > The first three attached patches make it possible to compile Mesa with
> > LLVM/Clang:
> > 1. Add -lstdc++ when linking glsl_compiler and glcpp
> > 2. Move -lstdc++ from the Gallium-specific Makefile.dri to
> > DRI_LIB_DEPS in configure (fixes linking classic Mesa drivers)
> > 3. Since autoconf gives GCC=yes even when using clang (since it just
> > tests for the __GNUC__ macro), don't check for a minimum version of
> > 3.3 if $(CC) points to a clang executable. (unfortunately I'm not sure
> > how to properly detect clang, short of test-compiling a file that
> > contains #ifdef __clang__. I.e. if $(CC) = 'cc', and 'cc' is an
> > alternatives symlink to llvm-clang, this doesn't detect that case.)
> 
> From #llvm:
> 
> <anholt> is it intended that when linking a c++ app with clang that -lstdc++ has to \
> be explicitly specified? <aKor> anholt: link via clang++
> <aKor> :)
> <nicholas> yes, same as with gcc. try linking with clang++ instead.
> <anholt> ah, my 2.7 clang packages don't come with a clang++ binary
> <dgregor> anholt: don't use 2.7 for C++. For c++, you'll need to use
> clang from Subversion
> <dgregor> anholt: adding -lstdc++ is the wrong solution. clang++ is just
> a symlink to clang, by the way. you can add it yourself
> 

Point. So scratch the first two patches. And #4 is obsolete now. But
Mesa *does* need a version of #3 to work (much better version
attached).

And can
> 5. program: Fix struct/class confusion
> 6. dr/radeon: Fix printf format
> 7. llvmpipe: Fix memory leak
go in?


["0010-Make-configure-work-with-clang.patch" (text/x-patch)]

From 13f04a33091ea742692870f924d16bba689bc4df Mon Sep 17 00:00:00 2001
From: nobled <nobled@dreamwidth.org>
Date: Sun, 29 Aug 2010 19:12:11 +0000
Subject: [PATCH] Make configure work with clang

It was mistaking clang for gcc and deciding its version
was too low.
---
 configure.ac |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7cc0cd5..d6683bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,9 +48,23 @@ solaris*)
     ;;
 esac
 
+dnl clang is mostly GCC-compatible, but its version is much lower,
+dnl so we have to check for it.
+AC_MSG_CHECKING([if compiling with clang])
+
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([], [[
+#ifndef __clang__
+       not clang
+#endif
+]])],
+[CLANG=yes], [CLANG=no])
+
+AC_MSG_RESULT([$CLANG])
+
 dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
 dnl versions are explictly not supported.
-if test "x$GCC" = xyes; then
+if test "x$GCC" = xyes -a "x$CLANG" = xno; then
     AC_MSG_CHECKING([whether gcc version is sufficient])
     major=0
     minor=0
-- 
1.5.4.3



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic