~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/openssl/extconf.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=begin
 
2
= $RCSfile$ -- Generator for Makefile
 
3
 
 
4
= Info
 
5
  'OpenSSL for Ruby 2' project
 
6
  Copyright (C) 2002  Michal Rokos <m.rokos@sh.cvut.cz>
 
7
  All rights reserved.
 
8
 
 
9
= Licence
 
10
  This program is licenced under the same licence as Ruby.
 
11
  (See the file 'LICENCE'.)
 
12
 
 
13
= Version
 
14
  $Id: extconf.rb 11944 2007-02-28 13:23:42Z knu $
 
15
=end
 
16
 
 
17
require "mkmf"
 
18
 
 
19
dir_config("openssl")
 
20
dir_config("kerberos")
 
21
 
 
22
message "=== OpenSSL for Ruby configurator ===\n"
 
23
 
 
24
##
 
25
# Adds -Wall -DOSSL_DEBUG for compilation and some more targets when GCC is used
 
26
# To turn it on, use: --with-debug or --enable-debug
 
27
#
 
28
if with_config("debug") or enable_config("debug")
 
29
  $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
 
30
 
 
31
  if /gcc/ =~ CONFIG["CC"]
 
32
    $CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
 
33
  end
 
34
end
 
35
 
 
36
message "=== Checking for system dependent stuff... ===\n"
 
37
have_library("nsl", "t_open")
 
38
have_library("socket", "socket")
 
39
have_header("assert.h")
 
40
 
 
41
message "=== Checking for required stuff... ===\n"
 
42
if $mingw
 
43
  have_library("wsock32")
 
44
  have_library("gdi32")
 
45
end
 
46
result = have_header("openssl/ssl.h")
 
47
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "OpenSSL_add_all_digests")}
 
48
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")}
 
49
if !result
 
50
  unless pkg_config("openssl") and have_header("openssl/ssl.h")
 
51
    message "=== Checking for required stuff failed. ===\n"
 
52
    message "Makefile wasn't created. Fix the errors above.\n"
 
53
    exit 1
 
54
  end
 
55
end
 
56
 
 
57
unless have_header("openssl/conf_api.h")
 
58
  message "OpenSSL 0.9.6 or later required.\n"
 
59
  exit 1
 
60
end
 
61
 
 
62
message "=== Checking for OpenSSL features... ===\n"
 
63
have_func("ERR_peek_last_error")
 
64
have_func("BN_mod_add")
 
65
have_func("BN_mod_sqr")
 
66
have_func("BN_mod_sub")
 
67
have_func("BN_pseudo_rand_range")
 
68
have_func("BN_rand_range")
 
69
have_func("CONF_get1_default_config_file")
 
70
have_func("EVP_CIPHER_CTX_copy")
 
71
have_func("EVP_CIPHER_CTX_set_padding")
 
72
have_func("EVP_CipherFinal_ex")
 
73
have_func("EVP_CipherInit_ex")
 
74
have_func("EVP_DigestFinal_ex")
 
75
have_func("EVP_DigestInit_ex")
 
76
have_func("EVP_MD_CTX_cleanup")
 
77
have_func("EVP_MD_CTX_create")
 
78
have_func("EVP_MD_CTX_destroy")
 
79
have_func("EVP_MD_CTX_init")
 
80
have_func("HMAC_CTX_cleanup")
 
81
have_func("HMAC_CTX_copy")
 
82
have_func("HMAC_CTX_init")
 
83
have_func("PEM_def_callback")
 
84
have_func("X509V3_set_nconf")
 
85
have_func("X509V3_EXT_nconf_nid")
 
86
have_func("X509_CRL_add0_revoked")
 
87
have_func("X509_CRL_set_issuer_name")
 
88
have_func("X509_CRL_set_version")
 
89
have_func("X509_CRL_sort")
 
90
have_func("X509_STORE_get_ex_data")
 
91
have_func("X509_STORE_set_ex_data")
 
92
have_func("OBJ_NAME_do_all_sorted")
 
93
have_func("OPENSSL_cleanse")
 
94
if try_compile("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1,2);FOO(1,2,3);}\n")
 
95
  $defs.push("-DHAVE_VA_ARGS_MACRO")
 
96
end
 
97
if have_header("openssl/engine.h")
 
98
  have_func("ENGINE_add")
 
99
  have_func("ENGINE_load_builtin_engines")
 
100
  have_func("ENGINE_load_openbsd_dev_crypto")
 
101
  have_func("ENGINE_get_digest")
 
102
  have_func("ENGINE_get_cipher")
 
103
  have_func("ENGINE_cleanup")
 
104
end
 
105
if try_compile(<<SRC)
 
106
#include <openssl/opensslv.h>
 
107
#if OPENSSL_VERSION_NUMBER < 0x00907000L
 
108
# error "OpenSSL version is less than 0.9.7."
 
109
#endif
 
110
SRC
 
111
  have_header("openssl/ocsp.h")
 
112
end
 
113
have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
 
114
have_struct_member("EVP_CIPHER_CTX", "engine", "openssl/evp.h")
 
115
have_struct_member("X509_ATTRIBUTE", "single", "openssl/x509.h")
 
116
 
 
117
message "=== Checking done. ===\n"
 
118
 
 
119
create_header
 
120
create_makefile("openssl")
 
121
message "Done.\n"