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