Commits

Anonymous committed 9e1eeac

Common: Overhaul of config.h

Comments (0)

Files changed (1)

 #ifndef LOVE_CONFIG_H
 #define LOVE_CONFIG_H
 
-// Platform stuff.
-#if defined(WIN32) || defined(_WIN32)
-#	define LOVE_WINDOWS 1
+// Platform identification
+#if defined(_WIN32)
+#	define LOVE_WIN32 1
+#	if defined(_WIN32_WCE)
+#		define LOVE_WINCE 1
+#	else
+#		define LOVE_WINDOWS 1
+#	endif
+#	define LOVE_LITTLE_ENDIAN 1
+#elif defined(__linux__)
+#	define LOVE_LINUX 1
+#	if defined(__ANDROID__)
+#		define LOVE_ANDROID 1
+#	else
+#		define LOVE_GNU_LINUX 1
+#	endif
+#	if defined(__BYTE_ORDER__)
+#		if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#			define LOVE_LITTLE_ENDIAN 1
+#		elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#			define LOVE_BIG_ENDIAN 1
+#		endif
+#	endif
+#elif defined(__APPLE__)
+#	include <TargetConditionals.h>
+#	define LOVE_APPLE 1
+#	if TARGET_OS_IPHONE
+#		define LOVE_IOS 1
+#	else
+#		define LOVE_MACOSX 1
+#	endif
+#	if TARGET_RT_LITTLE_ENDIAN
+#		define LOVE_LITTLE_ENDIAN 1
+#	elif TARGET_RT_BIG_ENDIAN
+#		define LOVE_BIG_ENDIAN 1
+#	endif
+#else
+#	error Unable to identify operating system (update src/common/config.h)
 #endif
-#if defined(linux) || defined(__linux) || defined(__linux__)
-#	define LOVE_LINUX 1
-#endif
-#if defined(__APPLE__)
-#	define LOVE_MACOSX 1
-#endif
-#if defined(macintosh)
-#	define LOVE_MACOS 1
+#if !LOVE_LITTLE_ENDIAN && !LOVE_BIG_ENDIAN
+#	error Unable to identify endianness (update src/common/config.h)
 #endif
 
-// Endianness.
-#if defined(__i386__) || defined(__i386)
-#	define LOVE_LITTLE_ENDIAN 1
-#endif
-#if defined(__ppc__) || defined(__ppc)
-#	define LOVE_BIG_ENDIAN 1
-#endif
-
-// Warnings.
-#ifndef _CRT_SECURE_NO_WARNINGS
-#	define _CRT_SECURE_NO_WARNINGS
-#endif
-
-#ifndef LOVE_BUILD
+// Build type
+#if !defined(LOVE_BUILD)
 #	define LOVE_BUILD
 #	define LOVE_BUILD_STANDALONE
 #	define LOVE_BUILD_EXE
-//#	define LOVE_BUILD_DLL
 #endif
 
-// DLL-stuff.
-#ifdef LOVE_WINDOWS
+// Compiler-specific hacks
+#if LOVE_WIN32 && LOVE_BUILD_DLL
 #	define LOVE_EXPORT __declspec(dllexport)
 #else
 #	define LOVE_EXPORT
 #endif
 
-#if defined(LOVE_WINDOWS)
+// Platform-specific hacks
+#if LOVE_WINDOWS
 #	define LOVE_LEGENDARY_UTF8_ARGV_HACK
 #	define LOVE_LEGENDARY_CONSOLE_IO_HACK
 #endif