diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index 950bfc0..e3d3cc3 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -5,6 +5,7 @@ #include "ruby.h" #include "ruby/encoding.h" #include "ruby/re.h" +#include "ruby/util.h" #ifndef HAVE_RB_LEN_T typedef long rb_len_t; @@ -17,8 +18,12 @@ typedef long rb_len_t; #undef strncasecmp #define strncasecmp STRNCASECMP +#ifndef HAVE_RB_INT_POSITIVE_POW RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y); +#endif +#ifndef HAVE_RUBY_SCAN_DIGITS RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow); +#endif /* #define TIGHT_PARSER */ diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb index 963f96f..df2eb5b 100644 --- a/ext/date/extconf.rb +++ b/ext/date/extconf.rb @@ -16,4 +16,8 @@ have_func("rb_gc_mark_movable", "ruby.h") # RUBY_VERSION >= 2.7 have_const("RUBY_TYPED_EMBEDDABLE", "ruby.h") # RUBY_VERSION >= 3.3 +# check if the declarations are exposed +have_func(%[rb_int_positive_pow(0, 0)], "ruby/util.h") # RUBY_VERSION >= 3.1 +have_func(%[ruby_scan_digits("", 0, 0, NULL, NULL)], "ruby/util.h") # RUBY_VERSION >= 3.1 + create_makefile('date_core')