Bug 1079322 - Extract properties using libc functions. r=gwagner
[gecko.git] / tools / profiler / PlatformMacros.h
blob9a544a42e35231f9e9faa5299e4947ad68569b5b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef SPS_PLATFORM_MACROS_H
7 #define SPS_PLATFORM_MACROS_H
9 /* Define platform selection macros in a consistent way. Don't add
10 anything else to this file, so it can remain freestanding. The
11 primary factorisation is on (ARCH,OS) pairs ("PLATforms") but ARCH_
12 and OS_ macros are defined too, since they are sometimes
13 convenient. */
15 #undef SPS_PLAT_arm_android
16 #undef SPS_PLAT_amd64_linux
17 #undef SPS_PLAT_x86_linux
18 #undef SPS_PLAT_amd64_darwin
19 #undef SPS_PLAT_x86_darwin
20 #undef SPS_PLAT_x86_windows
21 #undef SPS_PLAT_amd64_windows
23 #undef SPS_ARCH_arm
24 #undef SPS_ARCH_x86
25 #undef SPS_ARCH_amd64
27 #undef SPS_OS_android
28 #undef SPS_OS_linux
29 #undef SPS_OS_darwin
30 #undef SPS_OS_windows
32 #if defined(__linux__) && defined(__x86_64__)
33 # define SPS_PLAT_amd64_linux 1
34 # define SPS_ARCH_amd64 1
35 # define SPS_OS_linux 1
37 #elif defined(__ANDROID__) && defined(__arm__)
38 # define SPS_PLAT_arm_android 1
39 # define SPS_ARCH_arm 1
40 # define SPS_OS_android 1
42 #elif defined(__ANDROID__) && defined(__i386__)
43 # define SPS_PLAT_x86_android 1
44 # define SPS_ARCH_x86 1
45 # define SPS_OS_android 1
47 #elif defined(__linux__) && defined(__i386__)
48 # define SPS_PLAT_x86_linux 1
49 # define SPS_ARCH_x86 1
50 # define SPS_OS_linux 1
52 #elif defined(__APPLE__) && defined(__x86_64__)
53 # define SPS_PLAT_amd64_darwin 1
54 # define SPS_ARCH_amd64 1
55 # define SPS_OS_darwin 1
57 #elif defined(__APPLE__) && defined(__i386__)
58 # define SPS_PLAT_x86_darwin 1
59 # define SPS_ARCH_x86 1
60 # define SPS_OS_darwin 1
62 #elif (defined(_MSC_VER) || defined(__MINGW32__)) && (defined(_M_IX86) || defined(__i386__))
63 # define SPS_PLAT_x86_windows 1
64 # define SPS_ARCH_x86 1
65 # define SPS_OS_windows 1
67 #elif (defined(_MSC_VER) || defined(__MINGW32__)) && (defined(_M_X64) || defined(__x86_64__))
68 # define SPS_PLAT_amd64_windows 1
69 # define SPS_ARCH_amd64 1
70 # define SPS_OS_windows 1
72 #else
73 # error "Unsupported platform"
74 #endif
76 #endif /* ndef SPS_PLATFORM_MACROS_H */