1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-09-09 00:27:34 +00:00
parent 5be82d1487
commit 097c3e9cbb

View file

@ -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