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>2014-06-29 19:32:13 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2014-06-29 19:32:13 +0000
commit51eb5e0d2722f0cf1033ac158d2fdbcd82b6e800 (patch)
tree3b763ebf105fc1136ebcac13b7d4dafca114be68 /pm_config.in.h
parent1610a1f6aa54ad1d97926c1d8605720933059df7 (diff)
downloadnetpbm-mirror-51eb5e0d2722f0cf1033ac158d2fdbcd82b6e800.tar.gz
netpbm-mirror-51eb5e0d2722f0cf1033ac158d2fdbcd82b6e800.tar.xz
netpbm-mirror-51eb5e0d2722f0cf1033ac158d2fdbcd82b6e800.zip
Reverse messed up commit
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2222 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'pm_config.in.h')
-rw-r--r--pm_config.in.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/pm_config.in.h b/pm_config.in.h
index 758f0612..fd651e3a 100644
--- a/pm_config.in.h
+++ b/pm_config.in.h
@@ -197,12 +197,56 @@
    config.mk.
 */
 
-#if defined(__GNUC__) && !defined(NO_GCC_UNIQUE)
+/*
+  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 operator
+   __builtin_ia32_pcmpeqb128 .
+
+  On the other hand, research by Prophet of the Way in September 2012
+  indicated that Clang 2.6-3.0 have the above function (and all Netpbm 
+  compiled successfully with SSE exploitation), but 3.1 does not.  He did
+  not find any mention in documentation of that change.
+
+  At least some versions of Clang that do not have __builtin_ia32_pcmpeqb128
+  nonetheless have other GCC SSE2 operators, such as __builtin_ia32_pcmpgtb128.
+  We did not detect a pattern.
+
+  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_UNIQUE)
   #define GCCVERSION __GNUC__*100 + __GNUC_MINOR__
 #else
   #define GCCVERSION 0
 #endif
 
+/* HAVE_GCC_SSE2 means the compiler has all of the GCC-specific builtins to
+   directly access SSE/SSE2 features.  This is different from whether the
+   compiler generates code that uses these features at all.  It is also
+   different from whether the compiler has the more standard operators defined
+   in <emmintrins.h>.
+*/
+
+#ifndef HAVE_GCC_SSE2
+/* GCC 4.1 ostensibly has the feature, but experiments with 4.1.2 and
+   4.1.2 in May 2010 exposed an obscure compiler bug and the compiler got
+   stuck with pamflip_sse.c.  So we say the feature exists only on 4.2
+   and up.
+*/
+#if GCCVERSION >=402 && defined(__SSE__) && defined(__SSE2__)
+  #define HAVE_GCC_SSE2 1
+#else
+  #define HAVE_GCC_SSE2 0
+#endif
+#endif
+
 #ifndef HAVE_GCC_BITCOUNT
 #if GCCVERSION >=304
   #define HAVE_GCC_BITCOUNT 1