While in a powerpc LE environment, the #ifdeffery around USE_BIG_ENDIAN
(lcms) and CMS_USE_BIG_ENDIAN (lcms2) needs some adjustment to avoid
setting the BIG_ENDIAN flag.

I've attached a pair of patches for consideration.  The first against
lcms 1.19 , the second against lcms2 2.5.

Thanks, 
-Will

Signed-off-by: Will Schmidt <will_schm...@vnet.ibm.com>

diff --git a/include/lcms.h b/include/lcms.h
index 2c6f764..6d88491 100644
--- a/include/lcms.h
+++ b/include/lcms.h
@@ -139,12 +139,20 @@ typedef    pthread_rwlock_t      LCMS_RWLOCK_T;
 #   define USE_BIG_ENDIAN      1
 #endif
 
-#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc) || defined(__ppc__) || defined(__s390__) || defined(__s390x__)
+#if defined(__sgi__) || defined(__sgi) || defined(sparc) || defined(__s390__) || defined(__s390x__)
 #   define USE_BIG_ENDIAN      1
 #endif
 
-#if TARGET_CPU_PPC
-#   define USE_BIG_ENDIAN   1
+#if defined (__GNUC__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+// Dont set USE_BIG_ENDIAN if we are in PowerPC little endian mode.
+#else
+#  if defined(__powerpc__) || defined(__ppc__) 
+#     define USE_BIG_ENDIAN      1
+#  endif
+
+#  if TARGET_CPU_PPC
+#     define USE_BIG_ENDIAN   1
+#  endif
 #endif
 
 #if macintosh
diff --git a/include/lcms2.h b/include/lcms2.h
index 89cd37a..ae7af47 100644
--- a/include/lcms2.h
+++ b/include/lcms2.h
@@ -177,18 +177,26 @@ typedef int                  cmsBool;
 #   define CMS_USE_BIG_ENDIAN      1
 #endif
 
-#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc)
+#if defined(__sgi__) || defined(__sgi) || defined(sparc)
 #   define CMS_USE_BIG_ENDIAN      1
 #endif
 
-#if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
+#if defined(__s390__) || defined(__s390x__)
 #   define CMS_USE_BIG_ENDIAN   1
 #endif
 
-#ifdef TARGET_CPU_PPC
-# if TARGET_CPU_PPC
-#   define CMS_USE_BIG_ENDIAN   1
-# endif
+#if defined (__GNUC__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#// Don't set USE_BIG_ENDIAN if we are in PowerPC little endian mode.
+#else
+#  if defined(__powerpc__) || defined(__ppc__)
+#     define CMS_USE_BIG_ENDIAN   1
+#  endif
+
+#  ifdef TARGET_CPU_PPC
+#    if TARGET_CPU_PPC
+#      define CMS_USE_BIG_ENDIAN   1
+#    endif
+#  endif
 #endif
 
 #ifdef macintosh
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to