Debian Codegraph @

ext/extconf.rb

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