Adding two more people to the RELICENSING file.
[tinycc.git] / conftest.c
Commit [+]AuthorDateLineData
944627c4 grischka2013-02-14 06:53:07 +01001#include <stdio.h>
2
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +01003/* Define architecture */
4#if defined(__i386__)
5# define TRIPLET_ARCH "i386"
6#elif defined(__x86_64__)
7# define TRIPLET_ARCH "x86_64"
8#elif defined(__arm__)
9# define TRIPLET_ARCH "arm"
b14ef0e2
EGE
Edmund Grimley Evans2015-02-13 18:58:31 +000010#elif defined(__aarch64__)
11# define TRIPLET_ARCH "aarch64"
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010012#else
13# define TRIPLET_ARCH "unknown"
14#endif
15
16/* Define OS */
17#if defined (__linux__)
18# define TRIPLET_OS "linux"
19#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
20# define TRIPLET_OS "kfreebsd"
21#elif !defined (__GNU__)
22# define TRIPLET_OS "unknown"
23#endif
24
25/* Define calling convention and ABI */
b4656f31
TP
Thomas Preud'homme2013-02-14 16:40:16 +010026#if defined (__ARM_EABI__)
27# if defined (__ARM_PCS_VFP)
28# define TRIPLET_ABI "gnueabihf"
29# else
30# define TRIPLET_ABI "gnueabi"
31# endif
32#else
33# define TRIPLET_ABI "gnu"
34#endif
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010035
36#ifdef __GNU__
37# define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
38#else
39# define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
40#endif
41
497f9393
AE
Austin English2014-02-08 14:38:41 -080042#if defined(_WIN32)
43int _CRT_glob = 0;
44#endif
45
944627c4 grischka2013-02-14 06:53:07 +010046int main(int argc, char *argv[])
47{
48 switch(argc == 2 ? argv[1][0] : 0) {
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010049 case 'b':
50 {
51 volatile unsigned foo = 0x01234567;
52 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
944627c4 grischka2013-02-14 06:53:07 +010053 break;
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010054 }
55#ifdef __GNUC__
944627c4 grischka2013-02-14 06:53:07 +010056 case 'm':
57 printf("%d\n", __GNUC_MINOR__);
58 break;
944627c4 grischka2013-02-14 06:53:07 +010059 case 'v':
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010060 printf("%d\n", __GNUC__);
61 break;
62#else
944627c4 grischka2013-02-14 06:53:07 +010063 case 'm':
b1a82335 Thomas Preud'homme2013-02-14 15:39:35 +010064 case 'v':
944627c4 grischka2013-02-14 06:53:07 +010065 puts("0");
66 break;
67#endif
b1a82335
TP
Thomas Preud'homme2013-02-14 15:39:35 +010068 case 't':
69 puts(TRIPLET);
944627c4 grischka2013-02-14 06:53:07 +010070 break;
944627c4 grischka2013-02-14 06:53:07 +010071 case -1:
72 /* to test -Wno-unused-result */
73 fread(NULL, 1, 1, NULL);
74 break;
75 }
76 return 0;
77}