2012-09-28 18:36:46 -04:00
|
|
|
/*******************************************************************************
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-03-22 13:47:38 -04:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
This file is part of the Sortix C Library.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
features.h
|
2013-10-13 07:04:27 -04:00
|
|
|
Detects the appropriate standard that this translation unit uses.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2012-09-28 18:36:46 -04:00
|
|
|
*******************************************************************************/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-09-22 17:58:52 -04:00
|
|
|
#ifndef INCLUDE_FEATURES_H
|
2013-10-13 07:04:27 -04:00
|
|
|
#define INCLUDE_FEATURES_H
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2013-09-22 13:20:02 -04:00
|
|
|
#define __sortix_libc__ 1
|
|
|
|
|
2013-09-22 18:05:38 -04:00
|
|
|
/* Detect whether we are a core system library. */
|
2013-08-31 07:15:53 -04:00
|
|
|
#if defined(__is_sortix_libc) || \
|
|
|
|
defined(__is_sortix_libm) || \
|
|
|
|
defined(__is_sortix_libpthread)
|
2013-09-22 18:05:38 -04:00
|
|
|
#if !defined(__is_sortix_system_library)
|
2014-01-18 10:21:46 -05:00
|
|
|
#define __is_sortix_system_library
|
2013-09-22 18:05:38 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Detect whether we are a core system component. */
|
2014-01-18 10:21:46 -05:00
|
|
|
#if defined(__is_sortix_kernel) || defined(__is_sortix_system_library)
|
2013-09-22 18:05:38 -04:00
|
|
|
#if !defined(__is_sortix_system_component)
|
2014-01-18 10:21:46 -05:00
|
|
|
#define __is_sortix_system_component
|
2013-09-22 18:05:38 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-03-22 13:47:38 -04:00
|
|
|
/* Support macro to ease testing the compiler version. */
|
|
|
|
#define __GCC_PREREQ(gcc_major, gcc_minor) \
|
|
|
|
(((gcc_major) == __GNUC__ && (gcc_minor) >= __GNUC_MINOR__) || \
|
|
|
|
((gcc_major) < __GNUC__))
|
|
|
|
|
2013-03-19 18:28:32 -04:00
|
|
|
/* Sortix system components implicitly use the native API. */
|
2014-01-18 10:21:46 -05:00
|
|
|
#if defined(__is_sortix_system_component)
|
2013-03-19 18:28:32 -04:00
|
|
|
#define _SORTIX_SOURCE 1
|
|
|
|
#endif
|
|
|
|
|
2012-02-11 12:50:12 -05:00
|
|
|
/* By default, assume the source is compiled using the native API. */
|
|
|
|
#if !defined(_SORTIX_SOURCE) && \
|
|
|
|
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
|
|
|
!defined(_BSD_SOURCE) && \
|
|
|
|
!defined(_SVID_SOURCE) && \
|
|
|
|
!defined(_XOPEN_SOURCE) && !defined(_XOPEN_SOURCE_EXTENDED) && \
|
|
|
|
!defined(_GNU_SOURCE) && \
|
2012-02-11 20:03:34 -05:00
|
|
|
1
|
2012-02-11 12:50:12 -05:00
|
|
|
#define _SORTIX_SOURCE 1
|
|
|
|
#endif
|
|
|
|
|
2012-02-12 19:07:02 -05:00
|
|
|
/* Whether to override some "standard" functions with Sortix alternatives. */
|
|
|
|
#if !defined(__SORTIX_STDLIB_REDIRECTS)
|
|
|
|
#if defined(_SORTIX_SOURCE)
|
|
|
|
#define __SORTIX_STDLIB_REDIRECTS 1
|
|
|
|
#else
|
|
|
|
#define __SORTIX_STDLIB_REDIRECTS 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-09-22 18:19:45 -04:00
|
|
|
/* Provide the restrict keyword when building system components. */
|
2014-01-18 10:21:46 -05:00
|
|
|
#if defined(__is_sortix_system_component) && !defined(__want_restrict)
|
2013-09-22 18:19:45 -04:00
|
|
|
#define __want_restrict 1
|
|
|
|
#endif
|
|
|
|
|
2013-04-07 11:27:11 -04:00
|
|
|
/* Detect whether the restrict keyword is available. */
|
|
|
|
#if __STDC_VERSION__ >= 199901L
|
|
|
|
#define __HAS_RESTRICT 1
|
|
|
|
#endif
|
|
|
|
|
2013-09-22 18:22:54 -04:00
|
|
|
/* Provide the full <stdint.h> in all system components. */
|
2014-01-18 10:21:46 -05:00
|
|
|
#if defined(__is_sortix_system_component)
|
2013-09-22 18:22:54 -04:00
|
|
|
#undef __STDC_CONSTANT_MACROS
|
|
|
|
#undef __STDC_LIMIT_MACROS
|
|
|
|
#define __STDC_CONSTANT_MACROS
|
|
|
|
#define __STDC_LIMIT_MACROS
|
|
|
|
#endif
|
|
|
|
|
2011-08-05 08:25:00 -04:00
|
|
|
#endif
|