Skip to content

Commit 9d91a32

Browse files
committed
extconf.rb: print informative message if OpenSSL can't be found
Describe --with-openssl-dir option that specifies the directory the OpenSSL installed if the libraries could not found, and suggest installing "development package" if just the headers are missing. Also, let it raise an exception instead of writing to Logging and terminating the process. This improves the look of the error message on 'gem install openssl' or 'make' (on the Ruby tree) failure.
1 parent 67b500e commit 9d91a32

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ext/openssl/extconf.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@
4343
have_library("crypt32")
4444
end
4545

46-
result = have_header("openssl/ssl.h")
47-
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "CRYPTO_malloc")}
46+
result = %w[crypto libeay32].any? {|lib| have_library(lib, "CRYPTO_malloc")}
4847
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_new")}
4948
unless result
50-
Logging::message "=== Checking for required stuff failed. ===\n"
51-
Logging::message "Makefile wasn't created. Fix the errors above.\n"
52-
exit 1
49+
raise "OpenSSL library could not be found. You might want to use " \
50+
"--with-openssl-dir=<dir> option to specify the prefix where OpenSSL " \
51+
"is installed."
52+
end
53+
unless have_header("openssl/ssl.h")
54+
raise "OpenSSL library itself was found, but the necessary header files " \
55+
"are missing. Installing \"development package\" of OpenSSL on your " \
56+
"system might help."
5357
end
5458
end
5559

0 commit comments

Comments
 (0)