~ubuntu-branches/ubuntu/trusty/ruby-xmlparser/trusty

« back to all changes in this revision

Viewing changes to ext/extconf.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-06-16 21:57:51 UTC
  • Revision ID: james.westby@ubuntu.com-20110616215751-b4ymizpvexd6qfm7
Tags: 0.7.2-1
Switch to gem2deb-based packaging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# ruby extconf.rb
 
3
#         --with-perl-enc-map[=/path/to/enc-map]
 
4
#         --with-expat-dir=/path/to/expat
 
5
#         --with-expat-lib=/path/to/expat/lib
 
6
#         --with-expat-include=/path/to/expat/include
 
7
#
 
8
require 'mkmf'
 
9
 
 
10
cwd=`pwd`.chomp!
 
11
perl= ENV['PERL'] || 'perl'
 
12
 
 
13
## Encoding maps may be stored in $perl_archlib/XML/Parser/Encodins/
 
14
#perl_archlib = '/usr/lib/perl5/site_perl/5.005/i586-linux'
 
15
#perl_archlib = '/usr/local/lib'
 
16
perl_archlib = `#{perl} -e 'use Config; print $Config{"archlib"}'`
 
17
xml_enc_path = with_config("perl-enc-map")
 
18
if xml_enc_path == true
 
19
  xml_enc_path = perl_archlib + "/XML/Parser/Encodings"
 
20
end
 
21
 
 
22
##$CFLAGS="-I#{cwd}/expat/xmlparse -I#{cwd}/expat/xmltok" +
 
23
##  ' -DXML_ENC_PATH=getenv\(\"XML_ENC_PATH\"\)' +
 
24
##  " -DNEW_EXPAT"
 
25
#$CFLAGS = "-I#{cwd}/expat/xmlparse -I#{cwd}/expat/xmltok"
 
26
#$LDFLAGS = "-L#{cwd}/expat/xmlparse -Wl,-rpath,/usr/local/lib"
 
27
#$LDFLAGS = "-L#{cwd}/expat/xmlparse"
 
28
dir_config("expat")
 
29
#dir_config("xmltok")
 
30
#dir_config("xmlparse")
 
31
if xml_enc_path
 
32
  $CFLAGS += " -DXML_ENC_PATH=\\\"#{xml_enc_path}\\\""
 
33
end
 
34
 
 
35
#if have_header("xmlparse.h") || have_header("expat.h")
 
36
if have_header("expat.h") || have_header("xmlparse.h")
 
37
  if have_library("expat", "XML_ParserCreate") ||
 
38
      have_library("xmltok", "XML_ParserCreate")
 
39
    if have_func("XML_SetNotStandaloneHandler")
 
40
      $CFLAGS += " -DNEW_EXPAT"
 
41
    end
 
42
    if have_func("XML_SetParamEntityParsing")
 
43
      $CFLAGS += " -DXML_DTD"
 
44
    end
 
45
#    if have_func("XML_SetExternalParsedEntityDeclHandler")
 
46
#      $CFLAGS += " -DEXPAT_1_2"
 
47
#    end
 
48
    have_func("XML_SetDoctypeDeclHandler")
 
49
    have_func("XML_ParserReset")
 
50
    have_func("XML_SetSkippedEntityHandler")
 
51
    have_func("XML_GetFeatureList")
 
52
    have_func("XML_UseForeignDTD")
 
53
    have_func("XML_GetIdAttributeIndex")
 
54
    have_library("socket", "ntohl")
 
55
    have_library("wsock32") if RUBY_PLATFORM =~ /mswin32|mingw/
 
56
    create_makefile("xmlparser")
 
57
  end
 
58
end