2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2011-04-13 18:22:10 +00:00
|
|
|
#ifndef BASE_DETECT_H
|
|
|
|
#define BASE_DETECT_H
|
2007-08-22 07:52:33 +00:00
|
|
|
|
|
|
|
/*
|
2011-04-13 18:37:12 +00:00
|
|
|
this file detected the family, platform and architecture
|
|
|
|
to compile for.
|
2007-08-22 07:52:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* platforms */
|
|
|
|
|
|
|
|
/* windows Family */
|
|
|
|
#if defined(WIN64) || defined(_WIN64)
|
2020-09-26 19:41:58 +00:00
|
|
|
/* Hmm, is this IA64 or x86-64? */
|
|
|
|
#define CONF_FAMILY_WINDOWS 1
|
|
|
|
#define CONF_FAMILY_STRING "windows"
|
|
|
|
#define CONF_PLATFORM_WIN64 1
|
|
|
|
#define PLATFORM_STRING "win64"
|
2007-08-22 07:52:33 +00:00
|
|
|
#elif defined(WIN32) || defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_WINDOWS 1
|
|
|
|
#define CONF_FAMILY_STRING "windows"
|
|
|
|
#define CONF_PLATFORM_WIN32 1
|
|
|
|
#define PLATFORM_STRING "win32"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* unix family */
|
2011-06-06 09:29:08 +00:00
|
|
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_FREEBSD 1
|
|
|
|
#define PLATFORM_STRING "freebsd"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2013-11-16 23:52:31 +00:00
|
|
|
#if defined(__NetBSD__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_NETBSD 1
|
|
|
|
#define PLATFORM_STRING "netbsd"
|
2013-11-16 23:52:31 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
#if defined(__OpenBSD__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_OPENBSD 1
|
|
|
|
#define PLATFORM_STRING "openbsd"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-24 10:18:20 +00:00
|
|
|
#if(defined(__LINUX__) || defined(__linux__)) && !defined(__ANDROID__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_LINUX 1
|
|
|
|
#define PLATFORM_STRING "linux"
|
2021-05-01 00:39:06 +00:00
|
|
|
#define CONF_BACKEND_OPENGL_ES3 1
|
2021-08-24 10:18:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__ANDROID__)
|
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_ANDROID 1
|
|
|
|
#define PLATFORM_STRING "android"
|
|
|
|
#define CONF_BACKEND_OPENGL_ES 1
|
|
|
|
#define CONF_BACKEND_OPENGL_ES3 1
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-06 09:25:58 +00:00
|
|
|
#if defined(__GNU__) || defined(__gnu__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_HURD 1
|
|
|
|
#define PLATFORM_STRING "gnu"
|
2011-06-06 09:25:58 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
#if defined(MACOSX) || defined(__APPLE__) || defined(__DARWIN__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
2021-02-12 12:40:29 +00:00
|
|
|
#define CONF_PLATFORM_MACOS 1
|
|
|
|
#define PLATFORM_STRING "macos"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__sun)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_SOLARIS 1
|
|
|
|
#define PLATFORM_STRING "solaris"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* beos family */
|
|
|
|
#if defined(__BeOS) || defined(__BEOS__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_FAMILY_BEOS 1
|
|
|
|
#define CONF_FAMILY_STRING "beos"
|
|
|
|
#define CONF_PLATFORM_BEOS 1
|
|
|
|
#define PLATFORM_STRING "beos"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2021-04-17 15:49:41 +00:00
|
|
|
#if defined(__HAIKU__)
|
|
|
|
#define CONF_FAMILY_UNIX 1
|
|
|
|
#define CONF_FAMILY_STRING "unix"
|
|
|
|
#define CONF_PLATFORM_HAIKU 1
|
2021-09-13 18:12:21 +00:00
|
|
|
#define PLATFORM_STRING "haiku"
|
2021-04-17 15:49:41 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-06 09:33:26 +00:00
|
|
|
/* use gcc endianness definitions when available */
|
2011-09-08 23:41:53 +00:00
|
|
|
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__MINGW32__) && !defined(__sun)
|
2020-09-26 19:41:58 +00:00
|
|
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
|
|
|
#include <sys/endian.h>
|
|
|
|
#else
|
|
|
|
#include <endian.h>
|
2011-06-06 09:33:26 +00:00
|
|
|
#endif
|
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
#define CONF_ARCH_ENDIAN_LITTLE 1
|
|
|
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
#define CONF_ARCH_ENDIAN_BIG 1
|
|
|
|
#endif
|
|
|
|
#endif
|
2011-06-06 09:33:26 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
/* architectures */
|
|
|
|
#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(CONF_PLATFORM_WIN32)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_IA32 1
|
|
|
|
#define CONF_ARCH_STRING "ia32"
|
|
|
|
#if !defined(CONF_ARCH_ENDIAN_LITTLE) && !defined(CONF_ARCH_ENDIAN_BIG)
|
|
|
|
#define CONF_ARCH_ENDIAN_LITTLE 1
|
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2011-12-04 21:28:58 +00:00
|
|
|
#if defined(__ia64__) || defined(_M_IA64)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_IA64 1
|
|
|
|
#define CONF_ARCH_STRING "ia64"
|
|
|
|
#if !defined(CONF_ARCH_ENDIAN_LITTLE) && !defined(CONF_ARCH_ENDIAN_BIG)
|
|
|
|
#define CONF_ARCH_ENDIAN_LITTLE 1
|
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2011-12-04 21:28:58 +00:00
|
|
|
#if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_AMD64 1
|
|
|
|
#define CONF_ARCH_STRING "amd64"
|
|
|
|
#if !defined(CONF_ARCH_ENDIAN_LITTLE) && !defined(CONF_ARCH_ENDIAN_BIG)
|
|
|
|
#define CONF_ARCH_ENDIAN_LITTLE 1
|
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__powerpc__) || defined(__ppc__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_PPC 1
|
|
|
|
#define CONF_ARCH_STRING "ppc"
|
|
|
|
#if !defined(CONF_ARCH_ENDIAN_LITTLE) && !defined(CONF_ARCH_ENDIAN_BIG)
|
|
|
|
#define CONF_ARCH_ENDIAN_BIG 1
|
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__sparc__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_SPARC 1
|
|
|
|
#define CONF_ARCH_STRING "sparc"
|
|
|
|
#if !defined(CONF_ARCH_ENDIAN_LITTLE) && !defined(CONF_ARCH_ENDIAN_BIG)
|
|
|
|
#define CONF_ARCH_ENDIAN_BIG 1
|
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-16 11:29:18 +00:00
|
|
|
#if defined(__ARMEB__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_ARM 1
|
|
|
|
#define CONF_ARCH_STRING "arm"
|
|
|
|
#define CONF_ARCH_ENDIAN_BIG 1
|
2014-06-16 11:29:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__ARMEL__)
|
2020-09-26 19:41:58 +00:00
|
|
|
#define CONF_ARCH_ARM 1
|
|
|
|
#define CONF_ARCH_STRING "arm"
|
|
|
|
#define CONF_ARCH_ENDIAN_LITTLE 1
|
2014-06-16 11:29:18 +00:00
|
|
|
#endif
|
2007-08-22 07:52:33 +00:00
|
|
|
|
|
|
|
#ifndef CONF_FAMILY_STRING
|
|
|
|
#define CONF_FAMILY_STRING "unknown"
|
|
|
|
#endif
|
|
|
|
|
2020-08-18 13:03:09 +00:00
|
|
|
#ifndef PLATFORM_STRING
|
|
|
|
#define PLATFORM_STRING "unknown"
|
2007-08-22 07:52:33 +00:00
|
|
|
#endif
|
|
|
|
|
2020-08-18 13:03:09 +00:00
|
|
|
#ifndef PLATFORM_SUFFIX
|
|
|
|
#define PLATFORM_SUFFIX ""
|
|
|
|
#endif
|
|
|
|
|
2021-10-16 19:16:47 +00:00
|
|
|
#define CONF_PLATFORM_STRING PLATFORM_STRING PLATFORM_SUFFIX
|
2020-08-18 13:03:09 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
#ifndef CONF_ARCH_STRING
|
|
|
|
#define CONF_ARCH_STRING "unknown"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|