File: extconf.rb

package info (click to toggle)
ruby-mkrf 0.2.3+dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,752 kB
  • ctags: 4,291
  • sloc: ansic: 12,494; ruby: 6,984; sh: 790; yacc: 374; makefile: 57; cpp: 10
file content (50 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download
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
require '../../../../../lib/mkrf'

def crash(str)
  printf(" extconf failure: %s\n", str)
  exit 1
end

Mkrf::Generator.new('libxml_so', ['*.c']) do |g|

  g.include_library('socket','socket')
  g.include_library('nsl','gethostbyname')

  unless g.include_library('z', 'inflate')
    crash('need zlib')
  else
    g.add_define('HAVE_ZLIB_H')
  end

  unless g.include_library('iconv','iconv_open') or 
         g.include_library('c','iconv_open') or
         g.include_library('recode','iconv_open') or
         g.include_library('iconv')
    crash(<<-EOL)
  need libiconv.

  	Install the libiconv or try passing one of the following options
  	to extconf.rb:

  	--with-iconv-dir=/path/to/iconv
  	--with-iconv-lib=/path/to/iconv/lib
  	--with-iconv-include=/path/to/iconv/include
  EOL
  end

  g.include_library('xml2', 'xmlParseDoc')
  has_header = g.include_header('libxml/xmlversion.h', 
                   '/opt/include/libxml2', 
                   '/usr/local/include/libxml2', 
                   '/usr/include/libxml2')

  unless g.include_library('xml2', 'xmlDocFormatDump')
    crash('Your version of libxml2 is too old.  Please upgrade.')
  end

  # this module is deprecated in recent libxml2
  #unless g.has_function? 'docbCreateFileParserCtxt'
  #  crash('Need docbCreateFileParserCtxt')
  #end

end