diff options
Diffstat (limited to 'ext/unicorn_http')
-rw-r--r-- | ext/unicorn_http/ext_help.h | 23 | ||||
-rw-r--r-- | ext/unicorn_http/extconf.rb | 3 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h index 8220600..8ccb2b9 100644 --- a/ext/unicorn_http/ext_help.h +++ b/ext/unicorn_http/ext_help.h @@ -10,4 +10,27 @@ #define RSTRING_LEN(s) (RSTRING(s)->len) #endif +#ifndef SIZEOF_OFF_T +# define SIZEOF_OFF_T 4 +# warning SIZEOF_OFF_T not defined, guessing 4. Did you run extconf.rb? +#endif + +#if SIZEOF_OFF_T == 4 +# define UH_OFF_T_MAX 0x7fffffff +#elif SIZEOF_OFF_T == 8 +# define UH_OFF_T_MAX 0x7fffffffffffffff +#else +# error off_t size unknown for this platform! +#endif + +#ifndef HAVE_RB_STR_SET_LEN +/* this is taken from Ruby 1.8.7, 1.8.6 may not have it */ +static void rb_18_str_set_len(VALUE str, long len) +{ + RSTRING(str)->len = len; + RSTRING(str)->ptr[len] = '\0'; +} +# define rb_str_set_len(str,len) rb_18_str_set_len(str,len) +#endif + #endif diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb index 29d9334..39bd510 100644 --- a/ext/unicorn_http/extconf.rb +++ b/ext/unicorn_http/extconf.rb @@ -1,5 +1,6 @@ require 'mkmf' dir_config("unicorn_http") -have_library("c", "main") +check_sizeof("off_t", "sys/types.h") +have_func("rb_str_set_len", "ruby.h") create_makefile("unicorn_http") |