]>
Commit | Line | Data |
---|---|---|
daecebc8 DR |
1 | /* Copyright (C) 2003, 2004, 2005, 2006, 2009, 2011, 2012 |
2 | Free Software Foundation. | |
8f23fc81 MM |
3 | |
4 | Define macros useful in tests for bulitin functions. */ | |
5 | ||
6 | /* Define HAVE_C99_RUNTIME if the entire C99 runtime is available on | |
7 | the target system. The value of HAVE_C99_RUNTIME should be the | |
8 | same as the value of TARGET_C99_FUNCTIONS in the GCC machine | |
9 | description. (Perhaps GCC should predefine a special macro | |
10 | indicating whether or not TARGET_C99_FUNCTIONS is set, but it does | |
11 | not presently do that.) */ | |
12 | ||
0193f437 JDA |
13 | #if defined(__hppa) && defined(__hpux) |
14 | /* PA HP-UX doesn't have the entire C99 runtime. */ | |
daecebc8 DR |
15 | #elif defined(__INTERIX) |
16 | /* Interix6 doesn't have the entire C99 runtime. */ | |
77cacee4 | 17 | #elif defined(__AVR__) |
98278ecf | 18 | /* AVR doesn't have the entire C99 runtime. */ |
76a15894 GP |
19 | #elif defined(__FreeBSD__) && (__FreeBSD__ < 9) |
20 | /* FreeBSD up to version 8 lacks support for cexp and friends. */ | |
56fca24a RS |
21 | #elif defined(__vxworks) |
22 | /* VxWorks doesn't have a full C99 time. (cabs is missing, for example.) */ | |
454e84fe JM |
23 | #elif defined(_WIN32) && !defined(__CYGWIN__) |
24 | /* Windows doesn't have the entire C99 runtime. */ | |
50b737e2 | 25 | #elif (defined(__APPLE__) && defined(__ppc__) \ |
ed5b9f96 GK |
26 | && ! defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)) |
27 | /* MacOS versions before 10.3 don't have many C99 functions. | |
28 | But, if you're including this file, you probably want to test the | |
29 | newer behaviour, so: */ | |
30 | #error forgot to set -mmacosx-version-min. | |
50b737e2 | 31 | #elif (defined(__APPLE__) && defined(__ppc__) \ |
ed5b9f96 GK |
32 | && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1030) |
33 | /* MacOS versions before 10.3 don't have many C99 functions. */ | |
8f23fc81 MM |
34 | #else |
35 | /* Newlib has the "f" variants of the math functions, but not the "l" | |
36 | variants. TARGET_C99_FUNCTIONS is only defined if all C99 | |
37 | functions are present. Therefore, on systems using newlib, tests | |
c092f1e1 NC |
38 | of builtins will fail the "l" variants, and we should therefore not |
39 | define HAVE_C99_RUNTIME. Including <sys/types.h> gives us a way of | |
40 | seeing if _NEWLIB_VERSION is defined. Including <math.h> would work | |
41 | too, but the GLIBC math inlines cause us to generate inferior code, | |
42 | which causes the test to fail, so it is not safe. Including <limits.h> | |
43 | also fails because the include search paths are ordered such that GCC's | |
464aea98 JM |
44 | version will be found before the newlib version. Similarly, uClibc |
45 | lacks the C99 functions. */ | |
c092f1e1 | 46 | #include <sys/types.h> |
464aea98 | 47 | #if defined(_NEWLIB_VERSION) || defined(__UCLIBC__) |
8c166806 KG |
48 | #elif defined(__sun) && __STDC_VERSION__ - 0 < 199901L |
49 | /* If you're including this file, you probably want to test the newer | |
50 | behaviour, so ensure the right flags were used for each test: */ | |
51 | #error forgot to set -std=c99. | |
52 | #elif defined(__sun) && ! defined (_STDC_C99) | |
53 | /* Solaris up to 9 doesn't have the entire C99 runtime. | |
54 | Solaris 10 defines _STDC_C99 if __STDC_VERSION__ is >= 199901L. | |
55 | This macro is defined in <sys/feature_tests.h> which is included by | |
56 | various system headers, in this case <sys/types.h> above. */ | |
8f23fc81 MM |
57 | #else |
58 | #define HAVE_C99_RUNTIME | |
59 | #endif | |
60 | #endif |