From 52510289842a8b643c4b699de39ffdc1b7a8a383 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Feb 2004 03:29:16 +0000 Subject: * ext/iconv/iconv.c (iconv_s_list): new method Iconv.list (libiconv only). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/iconv/extconf.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'ext/iconv/extconf.rb') diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb index 9e6c266bc7..5e80188013 100644 --- a/ext/iconv/extconf.rb +++ b/ext/iconv/extconf.rb @@ -6,21 +6,26 @@ 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("const of iconv() 2nd argument") do - !try_compile(' -#include -size_t -test(iconv_t cd, char **inptr, size_t *inlen, char **outptr, size_t *outlen) -{ - return iconv(cd, inptr, inlen, outptr, outlen); -} -', "-Werror") + have_library("iconv", "iconv") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include ")} + 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", "iconv") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include ")} + have_func("iconvlist", "iconv.h") if conf prefix = '$(srcdir)' prefix = $nmake ? "{#{prefix}}" : "#{prefix}/" -- cgit v1.2.3