about summary refs log tree commit diff
path: root/pm_config.in.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-09-13 16:03:04 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-09-13 16:03:04 +0000
commitbcb6ea74cf81123b3543bdc697f084ba8f955598 (patch)
treed20624ea3c553379942d20e053f409e97d6199f8 /pm_config.in.h
parent0d1dd9118a846ba1e2ee2f46eee7133776d2e3c0 (diff)
downloadnetpbm-mirror-bcb6ea74cf81123b3543bdc697f084ba8f955598.tar.gz
netpbm-mirror-bcb6ea74cf81123b3543bdc697f084ba8f955598.tar.xz
netpbm-mirror-bcb6ea74cf81123b3543bdc697f084ba8f955598.zip
Better handling of CLANG: assume it isn't GCC at all, ever
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1732 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'pm_config.in.h')
-rw-r--r--pm_config.in.h38
1 files changed, 16 insertions, 22 deletions
diff --git a/pm_config.in.h b/pm_config.in.h
index c8b3df05..f0d83e1e 100644
--- a/pm_config.in.h
+++ b/pm_config.in.h
@@ -224,7 +224,22 @@
    don't want SSE code, set NO_GCC_BUILTINS to 1.
 */
 
-#if defined(__GNUC__) && !defined(NO_GCC_BUILTINS)
+/*
+  If the compiler is Clang, ignore reported __GNUC__ , __GNUC_MINOR__
+  values.  Treat it as a generic c compiler.  Clang normally reports itself
+  as GCC, but does not necessarily offer all the features of GCC.  For
+  example, we know that Apple Mac OSX 10.8 ships with 
+
+   > cc --version
+     Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
+
+   which masquerades as GCC 4.2.1, but it does not have SSE2 function
+   __builtin_ia32_pcmpeqb128 .
+
+  See below on compilers other than GCC that set __GNUC__:
+  http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
+*/
+#if defined(__GNUC__) && !defined(__clang__) && !defined(NO_GCC_BUILTINS)
   #define GCCVERSION __GNUC__*100 + __GNUC_MINOR__
 #else
   #define GCCVERSION 0
@@ -242,28 +257,7 @@
    and up.
 */
 #if GCCVERSION >=402 && defined(__SSE__) && defined(__SSE2__)
-
-/* Apple, in Mac OSX 10.8, ships:
-
-   > cc --version
-     Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
-
-   which masquerades as GCC 4.2.1, but it fails on pamflip_sse.c:
-
-     pamflip_sse.c:136:39: error: use of unknown builtin
-     '__builtin_ia32_pcmpeqb128' [-Wimplicit-function-declaration]
-     register v16qi const compare =__builtin_ia32_pcmpeqb128(vReg,zero128);
-
-   so we disable SSE2 for Apple cc.  The gcc compiler Apple ships is
-   llvm-based and also defines APPLE_CC, and it works fine, so we disable
-   SSE2 only on Clang compilers.
-*/
-#if defined(__APPLE_CC__) && defined(__clang__)
-  #define HAVE_GCC_SSE2 0
-#else
   #define HAVE_GCC_SSE2 1
-#endif
-
 #else
   #define HAVE_GCC_SSE2 0
 #endif