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/branches/ruby_1_8@10187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-05-24 15:51:03 +00:00
parent 6fab9f81f8
commit a6000650d2
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> Wed May 24 23:52:11 2006 nobuyoshi nakada <nobu@ruby-lang.org>
* configure.in (ac_install_sh): ignore dummy install-sh. * configure.in (ac_install_sh): ignore dummy install-sh.

View file

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