summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-09 00:27:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-09 00:27:34 +0000
commit097c3e9cbbf23718371f08c24b2d2297b039f63f (patch)
tree3b256b6e835f9a1f1e6156203830ca4ad276cdc0 /lib
parent5be82d14872e0a65c1df1a4c557817911e8bc42e (diff)
mkmf.rb: -I flags to $INCFLAGS
* lib/mkmf.rb (MakeMakefile#pkg_config): separate -I flags to $INCFLAGS, which is used by CPP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index c2690969b4..2a83189e30 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1759,22 +1759,37 @@ SRC
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}
elsif ($PKGCONFIG ||=
(pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
find_executable0(pkgconfig) && pkgconfig) and
system("#{$PKGCONFIG} --exists #{pkg}")
# default to pkg-config command
- get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.strip}
+ pkgconfig = $PKGCONFIG
+ get = proc {|opt|
+ opt = IO.popen("#{$PKGCONFIG} --#{opt} #{pkg}", err:[:child, :out], &:read)
+ opt.strip if $?.success?
+ }
elsif find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
- get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
+ else
+ pkgconfig = nil
+ end
+ if pkgconfig
+ get ||= proc {|opt|
+ opt = IO.popen("#{pkgconfig} --#{opt}", err:[:child, :out], &:read)
+ opt.strip if $?.success?
+ }
end
orig_ldflags = $LDFLAGS
if get and option
get[option]
elsif get and try_ldflags(ldflags = get['libs'])
- cflags = get['cflags']
+ if incflags = get['cflags-only-I']
+ $INCFLAGS << " " << incflags
+ cflags = get['cflags-only-other']
+ else
+ cflags = get['cflags']
+ end
libs = get['libs-only-l']
ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
$CFLAGS += " " << cflags