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