diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:54:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:54:00 +0000 |
commit | 63f5a7164bd906beebef677004dbd0722d0462cc (patch) | |
tree | ce7614d7122c98d81edc1e88c999fccccbbd4e87 /lib | |
parent | 306b93466aa0ed0b65971de663058eb9e6d937c4 (diff) |
* lib/mkmf.rb (pkg_config): get configuration by pkg-config. [new]
* ext/openssl/extconf.rb: use pkg_config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index d56fe8896e..80c1651994 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -617,6 +617,27 @@ def dir_config(target, idefault=nil, ldefault=nil) [idir, ldir] 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 end |