diff options
-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(" ") |