From: nobu.nakada@... Date: 2003-08-02T09:21:26+09:00 Subject: [ruby-dev:21065] mkmf.rb: pkg_config なかだです。 最近のlib/mkmf.rbに対する変更のために、ext/opensslがpkg-config が必要な環境でhave_funcに失敗するようになっていました。これは have_funcが$DLDFLAGSではなく$LDFLAGSを使うように戻ったせいです が、こういった詳細を各ライブラリに分担させるのは望ましくないと 思います。 Index: lib/mkmf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v retrieving revision 1.142 diff -u -2 -p -r1.142 mkmf.rb --- lib/mkmf.rb 30 Jul 2003 13:35:23 -0000 1.142 +++ lib/mkmf.rb 2 Aug 2003 00:18:22 -0000 @@ -618,4 +618,25 @@ def dir_config(target, idefault=nil, lde end +def pkg_config(pkg) + unless defined?($PKGCONFIG) + if pkgconfig = with_config("pkg-config", !CROSS_COMPILING && "pkg-config") + find_executable0(pkgconfig) or pkgconfig = nil + end + $PKGCONFIG = pkgconfig + end + if $PKGCONFIG and system("#{$PKGCONFIG} --exists #{pkg}") + cflags = `#{$PKGCONFIG} --cflags #{pkg}`.chomp + ldflags = `#{$PKGCONFIG} --libs-only-L #{pkg}`.chomp + libs = `#{$PKGCONFIG} --libs-only-l #{pkg}`.chomp + $CFLAGS += " " << cflags + $LDFLAGS += " " << ldflags + $LIBS += " " << libs + Logging::message "package configuration for %s\n", pkg + Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n", + cflags, ldflags, libs + [cflags, ldflags, libs] + end +end + def with_destdir(dir) /^\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir Index: ext/openssl/extconf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/ext/openssl/extconf.rb,v retrieving revision 1.12 diff -u -2 -p -r1.12 extconf.rb --- ext/openssl/extconf.rb 1 Aug 2003 08:20:20 -0000 1.12 +++ ext/openssl/extconf.rb 1 Aug 2003 08:20:59 -0000 @@ -19,5 +19,4 @@ require "mkmf" dir_config("openssl") dir_config("kerberos") -pkgconfig = with_config("pkg-config", !CROSS_COMPILING && "pkg-config") message "=== OpenSSL for Ruby configurator ===\n" @@ -52,11 +51,5 @@ result &&= %w[crypto libeay32].any? {|li result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")} if !result - if find_executable(pkgconfig) and system(pkgconfig, "--exists", "openssl") - $CFLAGS += " " << `#{pkgconfig} --cflags openssl`.chomp - $DLDFLAGS += " " << `#{pkgconfig} --libs-only-L openssl`.chomp - $LIBS += " " << `#{pkgconfig} --libs-only-l openssl`.chomp - result = have_header("openssl/ssl.h") - end - if !result + unless pkg_config("openssl") and have_header("openssl/ssl.h") message "=== Checking for required stuff failed. ===\n" message "Makefile wasn't created. Fix the errors above.\n" -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦