Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
config.h
Go to the documentation of this file.
1#ifndef RBIMPL_CONFIG_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_CONFIG_H
23#include "ruby/config.h"
24
25#ifdef RUBY_EXTCONF_H
26# include RUBY_EXTCONF_H
27#endif
28
30
31#undef HAVE_PROTOTYPES
32#define HAVE_PROTOTYPES 1
33
34#undef HAVE_STDARG_PROTOTYPES
35#define HAVE_STDARG_PROTOTYPES 1
36
37#undef TOKEN_PASTE
38#define TOKEN_PASTE(x,y) x##y
39
40#if defined(__cplusplus)
41#/* __builtin_choose_expr and __builtin_types_compatible aren't available
42# * on C++. See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
43# undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
44# undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P
45
46/* HAVE_VA_ARGS_MACRO is for C. C++ situations might be different. */
47# undef HAVE_VA_ARGS_MACRO
48# if __cplusplus >= 201103L
49# define HAVE_VA_ARGS_MACRO
50# elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__
51# define HAVE_VA_ARGS_MACRO
52# elif defined(__INTEL_CXX11_MODE__)
53# define HAVE_VA_ARGS_MACRO
54# elif RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
55# define HAVE_VA_ARGS_MACRO
56# else
57# /* NG, not known. */
58# endif
59#endif
60
61#if RBIMPL_COMPILER_BEFORE(GCC, 4, 9, 0)
62# /* See https://bugs.ruby-lang.org/issues/14221 */
63# undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
64#endif
65
66#if RBIMPL_COMPILER_BEFORE(GCC, 5, 0, 0)
67# /* GCC 4.9.2 reportedly has this feature and is broken. The function is not
68# * officially documented below. Seems we should not use it.
69# * https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Other-Builtins.html */
70# undef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
71#endif
72
73#if defined(__SUNPRO_CC)
74# /* Oracle Developer Studio 12.5: GCC compatibility guide says it supports
75# * statement expressions. But to our knowledge they support the extension
76# * only for C and not for C++. Prove me wrong. Am happy to support them if
77# * there is a way. */
78# undef HAVE_STMT_AND_DECL_IN_EXPR
79#endif
80
81#ifndef STRINGIZE0
82# define STRINGIZE(expr) STRINGIZE0(expr)
83# define STRINGIZE0(expr) #expr
84#endif
85
86#ifdef AC_APPLE_UNIVERSAL_BUILD
87# undef WORDS_BIGENDIAN
88# ifdef __BIG_ENDIAN__
89# define WORDS_BIGENDIAN
90# endif
91#endif
92
93#ifndef DLEXT_MAXLEN
94# define DLEXT_MAXLEN 4
95#endif
96
97#ifndef RUBY_PLATFORM
98# define RUBY_PLATFORM "unknown-unknown"
99#endif
100
101#ifdef UNALIGNED_WORD_ACCESS
102# /* Take that. */
103#elif defined(__i386)
104# define UNALIGNED_WORD_ACCESS 1
105#elif defined(__i386__)
106# define UNALIGNED_WORD_ACCESS 1
107#elif defined(_M_IX86)
108# define UNALIGNED_WORD_ACCESS 1
109#elif defined(__x86_64)
110# define UNALIGNED_WORD_ACCESS 1
111#elif defined(__x86_64__)
112# define UNALIGNED_WORD_ACCESS 1
113#elif defined(_M_AMD64)
114# define UNALIGNED_WORD_ACCESS 1
115#elif defined(__powerpc64__)
116# define UNALIGNED_WORD_ACCESS 1
117#elif defined(__aarch64__)
118# define UNALIGNED_WORD_ACCESS 1
119#elif defined(__mc68020__)
120# define UNALIGNED_WORD_ACCESS 1
121#else
122# define UNALIGNED_WORD_ACCESS 0
123#endif
124
125/* Detection of __VA_OPT__ */
126#if ! defined(HAVE_VA_ARGS_MACRO)
127# undef HAVE___VA_OPT__
128
129#else
130# /* Idea taken from: https://stackoverflow.com/a/48045656 */
131# define RBIMPL_TEST3(q, w, e, ...) e
132# define RBIMPL_TEST2(...) RBIMPL_TEST3(__VA_OPT__(,),1,0,0)
133# define RBIMPL_TEST1() RBIMPL_TEST2("ruby")
134# if RBIMPL_TEST1()
135# define HAVE___VA_OPT__
136# else
137# undef HAVE___VA_OPT__
138# endif
139# undef RBIMPL_TEST1
140# undef RBIMPL_TEST2
141# undef RBIMPL_TEST3
142#endif /* HAVE_VA_ARGS_MACRO */
143
144#endif /* RBIMPL_CONFIG_H */
Defines RBIMPL_COMPILER_SINCE.