mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/mkmf.rb (pkg_config): get configuration by pkg-config. [new]
* ext/openssl/extconf.rb: use pkg_config. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
306b93466a
commit
63f5a7164b
3 changed files with 28 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Aug 2 14:53:55 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/mkmf.rb (pkg_config): get configuration by pkg-config. [new]
|
||||||
|
|
||||||
|
* ext/openssl/extconf.rb: use pkg_config.
|
||||||
|
|
||||||
Sat Aug 2 14:02:39 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Aug 2 14:02:39 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* variable.c (classname): find regular class name if not set.
|
* variable.c (classname): find regular class name if not set.
|
||||||
|
|
|
@ -18,7 +18,6 @@ require "mkmf"
|
||||||
|
|
||||||
dir_config("openssl")
|
dir_config("openssl")
|
||||||
dir_config("kerberos")
|
dir_config("kerberos")
|
||||||
pkgconfig = with_config("pkg-config", !CROSS_COMPILING && "pkg-config")
|
|
||||||
|
|
||||||
message "=== OpenSSL for Ruby configurator ===\n"
|
message "=== OpenSSL for Ruby configurator ===\n"
|
||||||
|
|
||||||
|
@ -51,13 +50,7 @@ result = have_header("openssl/ssl.h")
|
||||||
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "OpenSSL_add_all_digests")}
|
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "OpenSSL_add_all_digests")}
|
||||||
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")}
|
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")}
|
||||||
if !result
|
if !result
|
||||||
if find_executable(pkgconfig) and system(pkgconfig, "--exists", "openssl")
|
unless pkg_config("openssl") and have_header("openssl/ssl.h")
|
||||||
$CFLAGS += " " << `#{pkgconfig} --cflags openssl`.chomp
|
|
||||||
$DLDFLAGS += " " << `#{pkgconfig} --libs-only-L openssl`.chomp
|
|
||||||
$LIBS += " " << `#{pkgconfig} --libs-only-l openssl`.chomp
|
|
||||||
result = have_header("openssl/ssl.h")
|
|
||||||
end
|
|
||||||
if !result
|
|
||||||
message "=== Checking for required stuff failed. ===\n"
|
message "=== Checking for required stuff failed. ===\n"
|
||||||
message "Makefile wasn't created. Fix the errors above.\n"
|
message "Makefile wasn't created. Fix the errors above.\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
21
lib/mkmf.rb
21
lib/mkmf.rb
|
@ -617,6 +617,27 @@ def dir_config(target, idefault=nil, ldefault=nil)
|
||||||
[idir, ldir]
|
[idir, ldir]
|
||||||
end
|
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
|
||||||
|
end
|
||||||
|
if $PKGCONFIG and system("#{$PKGCONFIG} --exists #{pkg}")
|
||||||
|
cflags = `#{$PKGCONFIG} --cflags #{pkg}`.chomp
|
||||||
|
ldflags = `#{$PKGCONFIG} --libs-only-L #{pkg}`.chomp
|
||||||
|
libs = `#{$PKGCONFIG} --libs-only-l #{pkg}`.chomp
|
||||||
|
$CFLAGS += " " << cflags
|
||||||
|
$LDFLAGS += " " << ldflags
|
||||||
|
$LIBS += " " << libs
|
||||||
|
Logging::message "package configuration for %s\n", pkg
|
||||||
|
Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
|
||||||
|
cflags, ldflags, libs
|
||||||
|
[cflags, ldflags, libs]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def with_destdir(dir)
|
def with_destdir(dir)
|
||||||
/^\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
|
/^\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue