File: extconf.rb

package info (click to toggle)
libxml-parser-ruby 0.6.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 908 kB
  • ctags: 1,524
  • sloc: ruby: 11,080; ansic: 1,958; xml: 467; makefile: 69
file content (57 lines) | stat: -rw-r--r-- 1,885 bytes parent folder | download | duplicates (3)
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
#
# ruby extconf.rb
#         --with-perl-enc-map[=/path/to/enc-map]
#         --with-expat-lib[=/path/to/expat/lib]
#         --with-expat-include[=/path/to/expat/include]
#
require 'mkmf'

cwd=`pwd`.chomp!
perl= ENV['PERL'] || 'perl'

## Encoding maps may be stored in $perl_archlib/XML/Parser/Encodins/
#perl_archlib = '/usr/lib/perl5/site_perl/5.005/i586-linux'
#perl_archlib = '/usr/local/lib'
perl_archlib = `#{perl} -e 'use Config; print $Config{"archlib"}'`
xml_enc_path = with_config("perl-enc-map")
if xml_enc_path == true
  xml_enc_path = perl_archlib + "/XML/Parser/Encodings"
end

##$CFLAGS="-I#{cwd}/expat/xmlparse -I#{cwd}/expat/xmltok" +
##  ' -DXML_ENC_PATH=getenv\(\"XML_ENC_PATH\"\)' +
##  " -DNEW_EXPAT"
#$CFLAGS = "-I#{cwd}/expat/xmlparse -I#{cwd}/expat/xmltok"
#$LDFLAGS = "-L#{cwd}/expat/xmlparse -Wl,-rpath,/usr/local/lib"
#$LDFLAGS = "-L#{cwd}/expat/xmlparse"
dir_config("expat")
dir_config("xmltok")
dir_config("xmlparse")
if xml_enc_path
  $CFLAGS += " -DXML_ENC_PATH=\\\"#{xml_enc_path}\\\""
end

#if have_header("xmlparse.h") || have_header("expat.h")
if have_header("expat.h") || have_header("xmlparse.h")
  if have_library("expat", "XML_ParserCreate") ||
      have_library("xmltok", "XML_ParserCreate")
    if have_func("XML_SetNotStandaloneHandler")
      $CFLAGS += " -DNEW_EXPAT"
    end
    if have_func("XML_SetParamEntityParsing")
      $CFLAGS += " -DXML_DTD"
    end
#    if have_func("XML_SetExternalParsedEntityDeclHandler")
#      $CFLAGS += " -DEXPAT_1_2"
#    end
    have_func("XML_SetDoctypeDeclHandler")
    have_func("XML_ParserReset")
    have_func("XML_SetSkippedEntityHandler")
    have_func("XML_GetFeatureList")
    have_func("XML_UseForeignDTD")
    have_func("XML_GetIdAttributeIndex")
    have_library("socket", "ntohl")
    have_library("wsock32") if RUBY_PLATFORM =~ /mswin32|mingw/
    create_makefile("xmlparser")
  end
end