diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-10 21:15:32 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-10 21:15:32 +0000 |
commit | c607493e48c9f3dbf957a4bb5f0be2e8aa288442 (patch) | |
tree | 686f735ff88ec31d8b457fadb60401825ff65506 | |
parent | e79d4b363c93c2c976a98dc4265cdb6bac216188 (diff) | |
download | ruby-c607493e48c9f3dbf957a4bb5f0be2e8aa288442.tar.gz |
* lib/mkmf.rb (pkg_config): Add optional argument "option".
If it is given, it returns the result of
`pkg-config --<option> <pkgname>`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/mkmf.rb | 6 |
2 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Thu Apr 11 05:30:43 2013 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/mkmf.rb (pkg_config): Add optional argument "option". + If it is given, it returns the result of + `pkg-config --<option> <pkgname>`. + Thu Apr 11 03:33:05 2013 NARUSE, Yui <naruse@ruby-lang.org> * ext/fiddle/closure.c (initialize): check mprotect's return value. diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 9ee27f5a91..da659bfc35 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1722,7 +1722,7 @@ SRC # # The actual command name can be overridden by # <code>--with-pkg-config</code> command line option. - def pkg_config(pkg) + def pkg_config(pkg, option=nil) if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig) # iff package specific config command is given get = proc {|opt| `#{pkgconfig} --#{opt}`.strip} @@ -1736,7 +1736,9 @@ SRC # default to package specific config command, as a last resort. get = proc {|opt| `#{pkgconfig} --#{opt}`.strip} end - if get and try_ldflags(ldflags = get['libs']) + if get and option + get[option] + elsif get and try_ldflags(ldflags = get['libs']) cflags = get['cflags'] libs = get['libs-only-l'] ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ") |