From c9aad4c098193cad0440228595c85aadc44bebe5 Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Thu, 24 Jul 2003 17:58:56 +0000 Subject: * ext/openssl/extconf.rb: add check for libsocket and libnsl. * ext/openssl/extconf.rb: use pkg-config to build CFLAGS and LDFLAGS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/extconf.rb | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'ext') diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 2335fc680d..94b79d4428 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -18,13 +18,6 @@ require "mkmf" dir_config("openssl") -if !defined? message - def message(*s) - printf(*s) - Logging::message(*s) - end -end - message "=== OpenSSL for Ruby configurator ===\n" @@ -65,23 +58,29 @@ EOD end -message "=== Checking for required stuff... ===\n" - -result = have_header("openssl/crypto.h") -result &= ( have_library("crypto", "OpenSSL_add_all_digests") || - have_library("libeay32", "OpenSSL_add_all_digests") ) -result &= ( have_library("ssl", "SSL_library_init") || - have_library("ssleay32", "SSL_library_init") ) -if !result - message "=== Checking for required stuff failed. ===\n" - message "Makefile wasn't created. Fix the errors above.\n" - exit 1 -end message "=== Checking for system dependent stuff... ===\n" +have_library("nsl", "t_open") +have_library("socket", "socket") have_header("unistd.h") have_header("sys/time.h") +message "=== Checking for required stuff... ===\n" +if find_executable("pkg-config") and system("pkg-config", "--exists", "openssl") + $CFLAGS += " " << `pkg-config --cflags openssl`.chomp + $DLDFLAGS += " " << `pkg-config --libs-only-L openssl`.chomp + $LIBS += " " << `pkg-config --libs-only-l openssl`.chomp +else + result = have_header("openssl/crypto.h") + 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")} + if !result + message "=== Checking for required stuff failed. ===\n" + message "Makefile wasn't created. Fix the errors above.\n" + exit 1 + end +end + message "=== Checking for OpenSSL features... ===\n" have_func("HMAC_CTX_copy") have_func("X509_STORE_get_ex_data") -- cgit v1.2.3