diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-25 06:33:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-06-25 06:33:26 +0000 |
commit | c5fe339b5516eb35fbca66712685bd69bc6b5027 (patch) | |
tree | 0e5a03799d079dd3824e97cbc7dc2eae4db13407 /ext/iconv | |
parent | 68a117d8e2ca53777af1c7bd88d14f5431f64787 (diff) |
* ext/iconv/extconf.rb: check stricter. [ruby-talk:104501]
* ext/iconv/extconf.rb: include iconv.h for libiconv. [ruby-dev:22715]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/iconv')
-rw-r--r-- | ext/iconv/extconf.rb | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb index 36cd60ed15..65ea327950 100644 --- a/ext/iconv/extconf.rb +++ b/ext/iconv/extconf.rb @@ -5,22 +5,26 @@ dir_config("iconv") conf = File.exist?(File.join($srcdir, "config.charset")) conf = with_config("config-charset", enable_config("config-charset", conf)) -if have_header("iconv.h") - if !try_compile("", "-Werror") or checking_for("iconv() 2nd argument is const") do - !try_compile(' -#include <iconv.h> -size_t -test(iconv_t cd, char **inptr, size_t *inlen, char **outptr, size_t *outlen) -{ - return iconv(cd, inptr, inlen, outptr, outlen); -} -', "-Werror") +if have_func("iconv", "iconv.h") or + have_library("iconv", "iconv") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include <iconv.h>")} + if checking_for("const of iconv() 2nd argument") do + create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---") + src = xpopen(cpp_command("")) {|f|f.read} + if !(func = src[/^--->\s*(\w+).*\s*<---/, 1]) + Logging::message "iconv function name not found" + false + elsif !(second = src[%r"\b#{func}\s*\(.*?,(.*?),.*?\)\s*;"m, 1]) + Logging::message "prototype for #{func}() not found" + false + else + Logging::message $&+"\n" + /\bconst\b/ =~ second + end end $defs.push('-DICONV_INPTR_CAST=""') else $defs.push('-DICONV_INPTR_CAST="(char **)"') end - have_library("iconv") if conf prefix = '$(srcdir)' prefix = $nmake ? "{#{prefix}}" : "#{prefix}/" |