summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-10 21:15:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-10 21:15:32 +0000
commitc607493e48c9f3dbf957a4bb5f0be2e8aa288442 (patch)
tree686f735ff88ec31d8b457fadb60401825ff65506 /lib/mkmf.rb
parente79d4b363c93c2c976a98dc4265cdb6bac216188 (diff)
* 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
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb6
1 files changed, 4 insertions, 2 deletions
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(" ")