-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathextconf.rb
More file actions
133 lines (115 loc) · 3.52 KB
/
extconf.rb
File metadata and controls
133 lines (115 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#----------------------------------------------------------------------------
#
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
#
# Gmail: garbagecat10
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#---------------------------------------------------------------------------
#
# extconf.rb for Ruby/EventMachine
# We have to munge LDSHARED because this code needs a C++ link.
#
require 'mkmf'
flags = []
case RUBY_PLATFORM.split('-',2)[1]
when 'mswin32', 'mingw32', 'bccwin32'
unless have_header('windows.h') and
have_header('winsock.h') and
have_library('kernel32') and
have_library('rpcrt4') and
have_library('gdi32')
exit
end
flags << "-D OS_WIN32"
flags << '-D BUILD_FOR_RUBY'
flags << "-EHs"
flags << "-GR"
dir_config('ssl')
if have_library('ssleay32') and
have_library('libeay32') and
have_header('openssl/ssl.h') and
have_header('openssl/err.h')
flags << '-D WITH_SSL'
else
flags << '-D WITHOUT_SSL'
end
when /solaris/
unless have_library('pthread') and
have_library('nsl') and
have_library('socket')
exit
end
flags << '-D OS_UNIX'
flags << '-D OS_SOLARIS8'
flags << '-D BUILD_FOR_RUBY'
pkg_config('openssl') || dir_config('ssl')
if have_library('ssl') and
have_library('crypto') and
have_header('openssl/ssl.h') and
have_header('openssl/err.h')
flags << '-D WITH_SSL'
else
flags << '-D WITHOUT_SSL'
end
# on Unix we need a g++ link, not gcc.
CONFIG['LDSHARED'] = "$(CXX) -shared"
when /darwin/
flags << '-DOS_UNIX'
flags << '-DBUILD_FOR_RUBY'
pkg_config('openssl') || dir_config('ssl')
if have_library('ssl') and
have_library('crypto') and
have_library('C') and
have_header('openssl/ssl.h') and
have_header('openssl/err.h')
flags << '-DWITH_SSL'
else
flags << '-DWITHOUT_SSL'
end
# on Unix we need a g++ link, not gcc.
# Ff line contributed by Daniel Harple.
CONFIG['LDSHARED'] = "$(CXX) " + CONFIG['LDSHARED'].split[1..-1].join(' ')
else
unless have_library('pthread')
exit
end
flags << '-DOS_UNIX'
flags << '-DBUILD_FOR_RUBY'
pkg_config('openssl') || dir_config('ssl')
if have_library('ssl') and
have_library('crypto') and
have_header('openssl/ssl.h') and
have_header('openssl/err.h')
flags << '-DWITH_SSL'
else
flags << '-DWITHOUT_SSL'
end
# on Unix we need a g++ link, not gcc.
CONFIG['LDSHARED'] = "$(CXX) -shared"
# Modify the mkmf constant LINK_SO so the generated shared object is stripped.
# You might think modifying CONFIG['LINK_SO'] would be a better way to do this,
# but it doesn't work because mkmf doesn't look at CONFIG['LINK_SO'] again after
# it initializes.
# linkso = Object.send :remove_const, "LINK_SO"
# LINK_SO = linkso + "; strip $@"
end
if $CPPFLAGS
$CPPFLAGS += ' ' + flags.join(' ')
else
$CFLAGS += ' ' + flags.join(' ')
end
create_makefile "eventmachine_httpserver"