Basic infrastructure to build on *BSD

This commit is contained in:
dhewg 2011-12-07 17:12:44 +01:00 committed by Daniel Gibson
parent 471f51ef9b
commit 18e8dc4dc6

View file

@ -104,25 +104,40 @@ If you have questions concerning this license or the applicable additional terms
#endif
// Linux
#ifdef __linux__
// Unix
#ifdef __unix__
#define BUILD_OS_ID 2
#ifdef __linux__
#define BUILD_OS "linux"
#elif defined(__FreeBSD__)
#define BUILD_OS "FreeBSD"
#elif defined(__DragonFly__)
#define BUILD_OS "DragonFly"
#elif defined(__OpenBSD__)
#define BUILD_OS "OpenBSD"
#elif defined(__NetBSD__)
#define BUILD_OS "NetBSD"
#else
#error unknown operating system!
#endif
#ifdef __i386__
#define BUILD_STRING "linux-x86"
#define CPUSTRING "x86"
#define CPU_EASYARGS 1
#elif defined(__x86_64__)
#define BUILD_STRING "linux-x86_64"
#define CPUSTRING "x86_64"
#define CPU_EASYARGS 0
#elif defined(__ppc__)
#define BUILD_STRING "linux-ppc"
#define CPUSTRING "ppc"
#define CPU_EASYARGS 0
#else
#error unknown cpu architecture!
#endif
#define BUILD_STRING (BUILD_OS "-" CPUSTRING)
#define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))