Debian Codegraph @

ext/extconf.rb

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 require 'mkmf'
2
3 dir_config('rdiscount')
4
5 HAVE_RANDOM = have_func('random')
6 HAVE_SRANDOM = have_func('srandom')
7 HAVE_RAND = have_func('rand')
8 HAVE_SRAND = have_func('srand')
9
10 def sized_int(size, types)
11 types.find { |type| check_sizeof(type) == size } ||
12 abort("no int with size #{size}")
13 end
14
15 DWORD = sized_int(4, ["unsigned long", "unsigned int"])
16 WORD = sized_int(2, ["unsigned int", "unsigned short"])
17 BYTE = "unsigned char"
18 VERSION = IO.read('VERSION').strip
19
20 open(File.join(File.dirname(__FILE__), "ruby-config.h"), "wb") do |f|
21 f.write <<-EOF
22 // These data types may be already defined if building on Windows (using MinGW)
23 #ifndef DWORD
24 #define DWORD #{DWORD}
25 #endif
26 #ifndef WORD
27 #define WORD #{WORD}
28 #endif
29 #ifndef BYTE
30 #define BYTE #{BYTE}
31 #endif
32 EOF
33 end
34
35 $defs.push("-DVERSION=\\\"#{VERSION}\\\"")
36 $defs.push("-DBRANCH=\"\"")
37
38 # Post XCode 5.1 the command line tools on OS X treat unrecognised
39 # command line options as errors and it's been seen that
40 # -multiply_definedsuppress can trickle from ruby build settings.
41 # Issue 115
42 if /darwin|mac os/.match RbConfig::CONFIG['host_os']
43 $DLDFLAGS.gsub!("-multiply_definedsuppress", "")
44 end
45
46 if /mswin/.match RbConfig::CONFIG['host_os']
47 $defs.push("-Dinline=__inline")
48 end
49
50 create_makefile('rdiscount')