Submitted upstream as:

	https://sourceforge.net/p/openil/bugs/212/

--- lib/Makefile.am.orig	2009-03-08 20:45:36 UTC
+++ lib/Makefile.am
@@ -41,5 +41,5 @@ endif #BUILD_ILUT
 
 libIL_la_CPPFLAGS = -I $(il_include) -I $(all_include)
 libIL_la_CFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
-libIL_la_CXXFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
+libIL_la_CXXFLAGS = $(filter-out -std=% -fgnu89-inline,$(AM_CFLAGS)) @IL_CFLAGS@
 
--- src-IL/include/il_internal.h	2009-03-08 03:10:08.000000000 -0400
+++ src-IL/include/il_internal.h	2014-12-20 01:11:39.000000000 -0500
@@ -228,5 +228,5 @@
 ILboolean ilLoadBlpF(ILHANDLE File);
 ILboolean ilLoadBlpL(const void *Lump, ILuint Size);
-ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
+ILboolean ilIsValidBmp(ILconst_string FileName);
 ILboolean ilIsValidBmpF(ILHANDLE File);
 ILboolean ilIsValidBmpL(const void *Lump, ILuint Size);
--- src-IL/src/il_exr.cpp	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_exr.cpp	2014-12-20 01:15:55.000000000 -0500
@@ -11,5 +11,5 @@
 //-----------------------------------------------------------------------------
 
-
+#include <machine/endian.h>
 #include "il_internal.h"
 #ifndef IL_NO_EXR
@@ -246,5 +246,5 @@
 		in.readPixels (dataWindow.min.y, dataWindow.max.y);
     }
-    catch (const exception &e)
+    catch (const exception)
     {
 	// If some of the pixels in the file cannot be read,
@@ -252,5 +252,4 @@
 	// to the caller.
 		ilSetError(IL_LIB_EXR_ERROR);  // Could I use something a bit more descriptive based on e?
-		e;  // Prevent the compiler from yelling at us about this being unused.
 		return IL_FALSE;
     }
--- src-IL/include/il_endian.h	2009-03-08 03:10:08.000000000 -0400
+++ src-IL/include/il_endian.h	2014-12-20 01:28:47.000000000 -0500
@@ -15,14 +15,7 @@
 
 #include "il_internal.h"
+#include <machine/endian.h>
 
-#ifdef WORDS_BIGENDIAN  // This is defined by ./configure.
-	#ifndef __BIG_ENDIAN__
-	#define __BIG_ENDIAN__ 1
-	#endif
-#endif
-
-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
-  || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
- 	#undef __LITTLE_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	#define Short(s) iSwapShort(s)
 	#define UShort(s) iSwapUShort(s)
@@ -39,7 +32,4 @@
 	#define BigDouble(d)  
 #else
-	#undef __BIG_ENDIAN__
-	#undef __LITTLE_ENDIAN__  // Not sure if it's defined by any compiler...
-	#define __LITTLE_ENDIAN__
 	#define Short(s)  
 	#define UShort(s)  
@@ -168,5 +158,5 @@
 	ILushort s;
 	iread(&s, sizeof(ILushort), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapUShort(&s);
 #endif
@@ -177,5 +167,5 @@
 	ILshort s;
 	iread(&s, sizeof(ILshort), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapShort(&s);
 #endif
@@ -186,5 +176,5 @@
 	ILuint i;
 	iread(&i, sizeof(ILuint), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapUInt(&i);
 #endif
@@ -195,5 +185,5 @@
 	ILint i;
 	iread(&i, sizeof(ILint), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapInt(&i);
 #endif
@@ -204,5 +194,5 @@
 	ILfloat f;
 	iread(&f, sizeof(ILfloat), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapFloat(&f);
 #endif
@@ -213,5 +203,5 @@
 	ILdouble d;
 	iread(&d, sizeof(ILdouble), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapDouble(&d);
 #endif
@@ -223,5 +213,5 @@
 	ILushort s;
 	iread(&s, sizeof(ILushort), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapUShort(&s);
 #endif
@@ -233,5 +223,5 @@
 	ILshort s;
 	iread(&s, sizeof(ILshort), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapShort(&s);
 #endif
@@ -243,5 +233,5 @@
 	ILuint i;
 	iread(&i, sizeof(ILuint), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapUInt(&i);
 #endif
@@ -253,5 +243,5 @@
 	ILint i;
 	iread(&i, sizeof(ILint), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapInt(&i);
 #endif
@@ -263,5 +253,5 @@
 	ILfloat f;
 	iread(&f, sizeof(ILfloat), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapFloat(&f);
 #endif
@@ -273,5 +263,5 @@
 	ILdouble d;
 	iread(&d, sizeof(ILdouble), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapDouble(&d);
 #endif
@@ -280,5 +270,5 @@
 
 INLINE ILubyte SaveLittleUShort(ILushort s) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapUShort(&s);
 #endif
@@ -287,5 +277,5 @@
 
 INLINE ILubyte SaveLittleShort(ILshort s) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapShort(&s);
 #endif
@@ -295,5 +285,5 @@
 
 INLINE ILubyte SaveLittleUInt(ILuint i) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapUInt(&i);
 #endif
@@ -303,5 +293,5 @@
 
 INLINE ILubyte SaveLittleInt(ILint i) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapInt(&i);
 #endif
@@ -310,5 +300,5 @@
 
 INLINE ILubyte SaveLittleFloat(ILfloat f) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapFloat(&f);
 #endif
@@ -318,5 +308,5 @@
 
 INLINE ILubyte SaveLittleDouble(ILdouble d) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	iSwapDouble(&d);
 #endif
@@ -326,5 +316,5 @@
 
 INLINE ILubyte SaveBigUShort(ILushort s) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapUShort(&s);
 #endif
@@ -334,5 +324,5 @@
 
 INLINE ILubyte SaveBigShort(ILshort s) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapShort(&s);
 #endif
@@ -342,5 +332,5 @@
 
 INLINE ILubyte SaveBigUInt(ILuint i) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapUInt(&i);
 #endif
@@ -350,5 +340,5 @@
 
 INLINE ILubyte SaveBigInt(ILint i) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapInt(&i);
 #endif
@@ -358,5 +348,5 @@
 
 INLINE ILubyte SaveBigFloat(ILfloat f) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapFloat(&f);
 #endif
@@ -366,5 +356,5 @@
 
 INLINE ILubyte SaveBigDouble(ILdouble d) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	iSwapDouble(&d);
 #endif
--- src-IL/src/il_convert.c	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_convert.c	2014-12-20 01:36:37.000000000 -0500
@@ -1018,5 +1018,5 @@
 	}
 /*	Swap Colors on Big Endian !!!!!
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	// Swap endian
 	EndianSwapData(iCurImage);
--- src-IL/src/il_dicom.c	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_dicom.c	2014-12-20 01:36:37.000000000 -0500
@@ -536,5 +536,5 @@
 
 	// We may have to swap the order of the data.
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 			if (!Header.BigEndian) {
 				if (Header.Format == IL_RGB)
--- src-IL/src/il_icon.c	2009-03-08 08:10:09.000000000 +0100
+++ src-IL/src/il_icon.c	2014-12-20 01:36:37.000000000 -0500
@@ -555,5 +555,5 @@
 
 	//fix endianess
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	if (bit_depth == 16)
 		png_set_swap(ico_png_ptr);
--- src-IL/src/il_png.c	2009-03-08 08:10:09.000000000 +0100
+++ src-IL/src/il_png.c	2014-12-20 01:36:37.000000000 -0500
@@ -308,5 +308,5 @@
 
 	//fix endianess
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	if (bit_depth == 16)
 		png_set_swap(png_ptr);
--- src-IL/src/il_psd.c	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_psd.c	2014-12-20 01:36:37.000000000 -0500
@@ -542,5 +542,5 @@
 		return NULL;
 	}
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	for (i = 0; i < Head->Height * ChannelNum; i++) {
 		iSwapUShort(&RleTable[i]);
--- src-IL/src/il_tiff.c	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_tiff.c	2014-12-20 01:36:37.000000000 -0500
@@ -611,5 +611,5 @@
 			Image->Origin = IL_ORIGIN_LOWER_LEFT;  // eiu...dunno if this is right
 
-#ifdef __BIG_ENDIAN__ //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
+#if BYTE_ORDER == BIG_ENDIAN //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
 			EndianSwapData(Image);
 #endif
@@ -636,5 +636,5 @@
 				case 3:
 					//TODO: why the ifdef??
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 					ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
 #endif			
@@ -647,5 +647,5 @@
 					/*			
 					//invert alpha
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 					pImageData += 3;
 #endif			
--- src-ILUT/src/ilut_sdlsurface.c	2009-03-08 03:10:11.000000000 -0400
+++ src-ILUT/src/ilut_sdlsurface.c	2014-12-20 01:36:37.000000000 -0500
@@ -28,5 +28,5 @@
 {
 //#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
 	isBigEndian = 1;
     rmask = 0xFF000000;
@@ -81,5 +81,5 @@
 	}
 	else if (Image->Format != IL_COLOR_INDEX) {  // We have to convert the image.
-		#ifdef __BIG_ENDIAN__
+		#if BYTE_ORDER == BIG_ENDIAN
 		Image = iConvertImage(Image, IL_RGBA, IL_UNSIGNED_BYTE);
 		#else
--- src-IL/src/il_ilbm.c	2009-03-08 04:30:11.000000000 -0400
+++ src-IL/src/il_ilbm.c	2014-12-20 01:38:51.000000000 -0500
@@ -620,5 +620,5 @@
                             finalcolor = pixelcolor;
                         }
-#if defined( __LITTLE_ENDIAN__ )
+#if BYTE_ORDER == LITTLE_ENDIAN
                         {
                             *ptr++ = (Uint8)(finalcolor>>16);
--- src-IL/src/il_sgi.c	2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_sgi.c	2014-12-20 01:40:37.000000000 -0500
@@ -213,5 +213,5 @@
 ILboolean iReadRleSgi(iSgiHeader *Head)
 {
-	#ifdef __LITTLE_ENDIAN__
+	#if BYTE_ORDER == LITTLE_ENDIAN
 	ILuint ixTable;
 	#endif
@@ -234,5 +234,5 @@
 		goto cleanup_error;
 
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 	// Fix the offset/len table (it's big endian format)
 	for (ixTable = 0; ixTable < TableSize; ixTable++) {
@@ -290,5 +290,5 @@
 	}
 
-	#ifdef __LITTLE_ENDIAN__
+	#if BYTE_ORDER == LITTLE_ENDIAN
 	if (Head->Bpc == 2)
 		sgiSwitchData(iCurImage->Data, iCurImage->SizeOfData);
@@ -331,5 +331,5 @@
 			return -1;
 		
-#ifndef __LITTLE_ENDIAN__
+#if BYTE_ORDER != LITTLE_ENDIAN
 		iSwapUShort(&Pixel);
 #endif
@@ -347,5 +347,5 @@
 			if (iread(&Pixel, Head->Bpc, 1) != 1)
 				return -1;
-#ifndef __LITTLE_ENDIAN__
+#if BYTE_ORDER != LITTLE_ENDIAN
 			iSwapUShort(&Pixel);
 #endif
@@ -742,5 +742,5 @@
 		StartTable[y] = DataOff;
 		DataOff += LenTable[y];
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
 		iSwapUInt(&StartTable[y]);
  		iSwapUInt(&LenTable[y]);
