ext/xml/extconf.rb in libxml-ruby-0.3.6 vs ext/xml/extconf.rb in libxml-ruby-0.3.8

- old
+ new

@@ -40,12 +40,14 @@ crash('need zlib') else $defs.push('-DHAVE_ZLIB_H') end -unless have_library('iconv','iconv_open') or have_library('c','iconv_open') or - have_library('recode','iconv_open') +unless have_library('iconv','iconv_open') or + have_library('c','iconv_open') or + have_library('recode','iconv_open') or + have_library('iconv') crash(<<EOL) need libiconv. Install the libiconv or try passing one of the following options to extconf.rb: @@ -54,11 +56,17 @@ --with-iconv-lib=/path/to/iconv/lib --with-iconv-include=/path/to/iconv/include EOL end -unless have_library('xml2', 'xmlParseDoc') +unless (have_library('xml2', 'xmlParseDoc') or + find_library('xml2', '/opt/lib', '/usr/local/lib', '/usr/lib')) and + (have_header('libxml/xmlversion.h') or + find_header('libxml/xmlversion.h', + '/opt/include/libxml2', + '/usr/local/include/libxml2', + '/usr/include/libxml2')) crash(<<EOL) need libxml2. Install the library or try one of the following options to extconf.rb: @@ -74,22 +82,14 @@ unless have_func('docbCreateFileParserCtxt') crash('Need docbCreateFileParserCtxt') end -$LDFLAGS << ' ' + `xslt-config --libs`.chomp -$LDFLAGS << ' ' + `xml2-config --libs`.chomp +if try_compile('int main() { return 0; }','-Wall') + $CFLAGS << ' -Wall' +end -$CFLAGS << ' ' + `xslt-config --cflags`.chomp -$CFLAGS << ' ' + `xml2-config --cflags`.chomp -$CFLAGS = '-g -Wall ' + $CFLAGS +$CFLAGS << ' ' << $INCFLAGS +$INSTALLFILES = [["../xml/libxml.rb", "$(RUBYLIBDIR)", "../xml"]] create_header() -create_makefile('xml/libxml') - -# Quick hack around a problem building on OSX -if RUBY_PLATFORM =~ /darwin/ - mf = File.read('Makefile') - File.open('Makefile','w+') do |f| - f << mf.gsub(/^CFLAGS\s+=\s+(.*)/) { "CFLAGS = #{$1.gsub('-fno-common','')}" } - end -end +create_makefile('xml/libxml_so')