Debian Codegraph @

tools/detect.c

raw
1 /* Copyright 2018 Google Inc.
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License. */
14
15 /* Define macros
16 detected_cc compiler type (e.g., gcc)
17 detected_os OS type (e.g., netbsd)
18 detected_arch CPU type (e.g., mips)
19 detected_lang language (e.g., c, c11, c++, c++11)
20 Each value is suffixed with an "X" to prevent the strings used conflicting
21 with other predefined macros. */
22
23 #if defined(__clang__)
24 detected_cc=clangX
25 #elif defined(__LCC__)
26 detected_cc=lccX
27 #elif defined(__TINYC__)
28 detected_cc=tccX
29 #elif defined(__DECC)
30 detected_cc=deccX
31 #elif defined(__PCC__)
32 detected_cc=pccX
33 #elif defined(__TenDRA__)
34 detected_cc=tendraccX
35 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6))
36 detected_cc=gccX
37 #elif defined(__GNUC__)
38 detected_cc=gcc_oldX
39 #else
40 detected_cc=posixX
41 #endif
42
43 #if defined(__linux__)
44 detected_os=linuxX
45 #elif defined(__NetBSD__)
46 detected_os=netbsdX
47 #elif defined(__OpenBSD__)
48 detected_os=openbsdX
49 #elif defined(__FreeBSD__)
50 detected_os=freebsdX
51 #elif defined(__osf__)
52 detected_os=osf1X
53 #elif defined(__hpux__)
54 detected_os=hpuxX
55 #elif __ANDROID__
56 detected_os=androidX
57 #elif __APPLE__
58 #if TARGET_OS_IPHONE || TARGET_OS_IOS || TARGET_IPHONE_SIMULATOR
59 detected_os=iosX
60 #else
61 detected_os=macosX
62 #endif
63 #elif defined(__CYGWIN__)
64 detected_os=cygwinX
65 #elif defined(_WIN64)
66 detected_os=win32X
67 #elif defined(_WIN32)
68 detected_os=win32X
69 #else /* defined(_POSIX_VERSION) || defined(__unix__) */
70 detected_os=posixX
71 #endif
72
73 #if defined(__x86_64__) || defined(__amd64__)
74 detected_arch=x86_64X
75 #elif defined(__x86_32__) || defined(__i686__) || defined(__i586__) || defined(__i486__) || defined(__i386__)
76 detected_arch=x86_32X
77 #elif defined(__alpha__)
78 detected_arch=alphaX
79 #elif defined(__loongarch__)
80 detected_arch=loongarchX
81 #elif defined(__mips64__) || defined(__mips32__) || defined(__mips__)
82 detected_arch=mipsX
83 #elif defined(__ppc64__) || defined(__powerpc64__) || defined(__ppc__) || defined(__powerpc__)
84 detected_arch=ppcX
85 #elif defined(__riscv__) || defined(__riscv)
86 detected_arch=riscvX
87 #elif defined(__pnacl__)
88 detected_arch=pnaclX
89 #elif defined(__sparc64__)
90 detected_arch=sparc64X
91 #elif defined(__sparc__)
92 detected_arch=sparcX
93 #elif defined(__hppa64__)
94 detected_arch=parisc64X
95 #elif defined(__hppa__)
96 detected_arch=pariscX
97 #elif defined(__s390x__)
98 detected_arch=s390xX
99 #elif defined(__s390__)
100 detected_arch=s390X
101 #elif defined(__mc68000__) || defined(__m68k__)
102 detected_arch=m68kX
103 #elif defined(__aarch64__) || defined(__arm64__)
104 detected_arch=aarch64X
105 #elif defined(__arm32__) || defined(__arm__)
106 detected_arch=armX
107 #elif defined(__ia64__)
108 detected_arch=ia64X
109 #else
110 detected_arch=posixX
111 #endif
112
113 #if __cplusplus >= 201103L
114 detected_lang=c++11X
115 #elif defined(__cplusplus)
116 detected_lang=c++X
117 #elif __STDC_VERSION__ >= 201112L
118 detected_lang=c11X
119 #else
120 detected_lang=cX
121 #endif