/* ----------------------------------------------------------------------------
 * Raima Database Manager
 *
 * Copyright (c) 2012 Raima Inc.,  All rights reserved.
 *
 * Use of this software, whether in source code format, or in executable,
 * binary object code form, is governed by the Birdstep LICENSE which
 * is fully described in the LICENSE.TXT file, included within this
 * distribution of files.
 * ----------------------------------------------------------------------------
 */

#ifndef PSPPLATDETECT_H
    #define PSPPLATDETECT_H
    /* The following is compiled from:
       http://sourceforge.net/p/predef/wiki/Home/ */
    #if defined(__ANDROID__)
        #if defined(__arm__) /* GCC */
            #define ANDROID_ARM
        #endif
    #elif defined(__linux__)
        #if defined(__arm__) /* GCC */
            #define LINUX_ARM
        #elif defined(i386) || defined(__i386__) /* GCC */ || \
            defined(__x86_64) || defined(__x86_64__) /* Intel C/C++ */
            #if defined(RDM_64BIT)
                #define LINUX_X64
            #else
                #define LINUX_X86
            #endif
        #elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) /* GCC */
            #define LINUX_ITANIUM_64
        #elif defined (__powerpc) || defined (__powerpc__) || defined (__POWERPC__) || defined (__ppc__) /* GCC */
            #define LINUX_POWERPC
        #endif
    #elif defined(__QNX__) /* QNX 4.x */ || \
        defined(__QNXNTO__) /* QNX 6.x */
        #if defined(__arm__) /* GCC */
            #define NEUTRINO_ARM
        #elif defined(i386) || defined(__i386__) /* GCC */
            #define NEUTRINO_X86
        #elif defined (__PPC__) /* GCC */
            #define NEUTRINO_PPC
        #endif
    #elif defined(__APPLE__) & defined(__MACH__)
        #if defined(__arm__) /* GCC */
            #define IPHONE_ARM
        #elif defined(i386) || defined(__i386__) /* GCC */
            #if defined(RDM_64BIT)
                #define OSX_X64
            #else
                #define OSX_X86
            #endif
        #elif defined(__x86_64) || defined(__x86_64__ ) /* GCC */
                #define OSX_X64
        #endif
    #elif defined(sun) || defined(__sun)
        #if defined(__SVR4) || defined(__svr4__) /* Solaris */
            #if defined(__sparc) /* Sun Studio */ || \
                defined(__x86_64) || defined(__x86_64__) /* Intel C/C++ */ || \
                defined(__sparc__) /* GCC */
                #if defined(RDM_64BIT)
                    #define SOLARIS_SPARC_64
                #else
                    #define SOLARIS_SPARC_32
                #endif
            #elif defined(__i386) /* Sun Studio */ || \
                defined(__i386__) || defined(i386)
                #if defined(RDM_64BIT)
                    #define SOLARIS_X64
                #else
                    #define SOLARIS_X86
                #endif
            #endif
        #else /* SunOS */
            /* SunOS not supported */
        #endif
    #elif defined(_AIX)
        #if defined(RDM_64BIT)
            #define AIX_POWERPC_64
        #else
            #define AIX_POWERPC_32
        #endif
    #elif defined(hpux) || defined(__hpux) || \
        defined(_hpux) /* HP UPC */
        #if defined(__ia64) /* HP aCC */
            #if defined(RDM_64BIT)
                #define HPUX_ITANIUM_64
            #else
                #define HPUX_ITANIUM_32
            #endif
        #elif defined(__hppa__) /* GCC */ || \
            defined(__hppa)
            #if defined(RDM_64BIT)
                #define HPUX_PARISC_64
            #else
                #define HPUX_PARISC_32
            #endif
        #endif
    #elif defined(_WIN32_WCE)
        #define WINCE
    #elif defined(_WIN32)
        #if defined (_WIN64)
            #if !defined(WINDOWS_X64)
                #define WINDOWS_X64
            #endif
        #else
            #if !defined(WINDOWS_X86)
                #define WINDOWS_X86
            #endif
        #endif
    #elif defined(__FreeBSD__)
        #if defined(RDM_64BIT)
            #define FREEBSD_X64
        #else
            #define FREEBSD_X86
        #endif
    #elif defined(__NetBSD__)
        #if defined(RDM_64BIT)
            #define NETBSD_X64
        #else
            #define NETBSD_X86
        #endif
    #elif defined(__OpenBSD__)
        #if defined(RDM_64BIT)
            #define OPENBSD_X64
        #else
            #define OPENBSD_X86
        #endif
    #elif defined(sco) ||defined(_UNIXWARE7)
        #define UNIXWARE_X86
    #elif defined(__Lynx__)
        #define LYNX_X86
    #elif defined(__INTEGRITY)
        #if defined(__i386) || defined(__i386__)
            #define INTEGRITY_X86
        #elif defined (__x86_64__)
            #define INTEGRITY_X64
        #elif defined (__ppc__) || defined (__ppc) || defined (__PPC__)
            #define INTEGRITY_POWERPC
        #endif
    #elif defined(__VXWORKS__)
        #if defined(i386) || defined(__i386__) /* GCC */
            #define VXWORKS_X86
        #elif defined (__powerpc) || defined (__powerpc__) || defined (__POWERPC__) || defined (__ppc__) /* GCC */
            #define VXWORKS_POWERPC
        #elif defined(__sh__) /* GCC */
            #if defined(__SH4__)
                #define VXWORKS_SH4 /* We should really redefine this to SH4 or SH */
            #endif
        #elif defined(__arm__) /* GCC */
            #define VXWORKS_ARM
        #endif
    #elif defined(__HAIKU__)
        #if defined(__i386__)
            #define HAIKU_X86
        #endif
    #endif
    #undef RDM_64BIT
#endif
