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

* lib/mkmf.rb (pkg_config): particular config commands support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-05-24 15:51:03 +00:00
parent 865efd821e
commit 18cf07cc7c
2 changed files with 23 additions and 9 deletions

View file

@ -1,3 +1,7 @@
Thu May 25 00:51:18 2006 nobuyoshi nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (pkg_config): particular config commands support.
Wed May 24 23:52:11 2006 nobuyoshi nakada <nobu@ruby-lang.org>
* configure.in (ac_install_sh): ignore dummy install-sh.

View file

@ -880,16 +880,23 @@ def dir_config(target, idefault=nil, ldefault=nil)
end
def pkg_config(pkg)
unless defined?($PKGCONFIG)
if pkgconfig = with_config("pkg-config", !CROSS_COMPILING && "pkg-config")
find_executable0(pkgconfig) or pkgconfig = nil
end
$PKGCONFIG = pkgconfig
if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
# iff package specific config command is given
get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
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}`.chomp}
elsif find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
end
if $PKGCONFIG and system("#{$PKGCONFIG} --exists #{pkg}")
cflags = `#{$PKGCONFIG} --cflags #{pkg}`.chomp
ldflags = `#{$PKGCONFIG} --libs #{pkg}`.chomp
libs = `#{$PKGCONFIG} --libs-only-l #{pkg}`.chomp
if get
cflags = get['cflags']
ldflags = get['libs']
libs = get['libs-only-l']
ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
$CFLAGS += " " << cflags
$LDFLAGS += " " << ldflags
@ -898,6 +905,9 @@ def pkg_config(pkg)
Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
cflags, ldflags, libs
[cflags, ldflags, libs]
else
Logging::message "package configuration for %s is not found\n", pkg
nil
end
end