summaryrefslogtreecommitdiff
path: root/ext/openssl/extconf.rb
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 17:58:56 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 17:58:56 +0000
commitc9aad4c098193cad0440228595c85aadc44bebe5 (patch)
treeaaa90e93fedc802656383953822d034537ff2a93 /ext/openssl/extconf.rb
parent4d859f926a2bacd21f06630ff185da3d09a1a314 (diff)
* 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
Diffstat (limited to 'ext/openssl/extconf.rb')
-rw-r--r--ext/openssl/extconf.rb37
1 files changed, 18 insertions, 19 deletions
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")