diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-02 12:30:34 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-09 01:19:24 -0700 |
commit | 718d5e9b6c863e388984e641d36b6e6cbacd99c7 (patch) | |
tree | 085e61da552c5bfb62f6853cccb93ee927b90cca | |
parent | 08e2c22210b62c1f513c23003d486aadc3452708 (diff) | |
download | unicorn-718d5e9b6c863e388984e641d36b6e6cbacd99c7.tar.gz |
We'll be needing the UH_OFF_T_MAX define for the chunked body handling and rb_str_set_len may be needed as well.
-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") |