Files
vlibc/include/vlibc/features.h.in
T

78 lines
2.5 KiB
C

#ifndef VLIBC_FEATURES_H
#define VLIBC_FEATURES_H
/*
* vlibc — compatibility feature gate.
*
* This header is generated by configure from include/vlibc/features.h.in; do
* not edit the generated file. It exposes the active compatibility profile as
* build-time constants, so headers and sources can gate declarations on the
* profile level (see configure.ac and docs/compatibility.md):
*
* 1 onlyposix pure POSIX, nothing more
* 2 muslmimic musl-like, light
* 3 muslext musl-extended
* 4 spoof glibc replica (drop-in compatibility)
* 5 vlibc glibc-extended, the default
*
* VLIBC_LEVEL is the numeric level (1..5); VLIBC_PROFILE is the profile name.
* Both are emitted only when not already defined: the library's own sources
* include config.h first (via HAVE_CONFIG_H), whose values win, and this
* header skips the redefinition. Consumers of the installed header get the
* values baked in at configure time.
*/
/* clang-format off */
#ifndef VLIBC_LEVEL
#define VLIBC_LEVEL @vlibc_level@
#endif
#ifndef VLIBC_PROFILE
#define VLIBC_PROFILE "@vlibc_profile@"
#endif
/* clang-format on */
/* True when the active profile is at least level n. */
#define VLIBC_LEVEL_GE(n) (VLIBC_LEVEL >= (n))
/*
* Per-profile feature booleans, derived from VLIBC_LEVEL. Levels are
* cumulative: level 3 implies the POSIX and musl feature sets as well. A
* macro is defined (as 1) when its feature set is present and left undefined
* otherwise, so `#if VLIBC_HAS_MUSL` works in both cases.
*/
#if VLIBC_LEVEL >= 1
#define VLIBC_HAS_POSIX 1
#endif
#if VLIBC_LEVEL >= 2
#define VLIBC_HAS_MUSL 1
#endif
#if VLIBC_LEVEL >= 3
#define VLIBC_HAS_MUSLEXT 1
#endif
#if VLIBC_LEVEL >= 4
#define VLIBC_HAS_GLIBC 1
#endif
#if VLIBC_LEVEL >= 5
#define VLIBC_HAS_VLIBC 1
#endif
/*
* Per-header availability gates, derived from VLIBC_LEVEL. The ISO C core
* headers (<stddef.h>, <stdint.h>, <stdbool.h>, <stdalign.h>, <iso646.h>,
* <limits.h>, <float.h>, <assert.h>, <stdarg.h>, <stdnoreturn.h>,
* <stdatomic.h>, <stdbit.h>, <stdckdint.h>, <tgmath.h>) are present in every
* profile and carry no gate. The POSIX-facing headers below exist only in
* profiles that provide POSIX (level >= 1, i.e. all profiles today); each
* header includes this file and gates its declarations on its own macro.
*/
#if VLIBC_LEVEL >= 1
#define VLIBC_HAS_HEADER_SYS_TYPES_H 1
#define VLIBC_HAS_HEADER_UCHAR_H 1
#define VLIBC_HAS_HEADER_CPIO_H 1
#define VLIBC_HAS_HEADER_TAR_H 1
#define VLIBC_HAS_HEADER_THREADS_H 1
#endif
#endif /* VLIBC_FEATURES_H */