Cleanup extconf.rb a bit.
@@ -25,18 +25,28 @@ else
dir_config('xml2')
end
-unless find_header('libxml/xmlversion.h',
+found_header = find_header('libxml/xmlversion.h',
'/opt/include/libxml2',
'/opt/local/include/libxml2',
'/usr/local/include/libxml2',
- '/usr/include/libxml2') &&
- find_library('xml2', 'xmlParseDoc',
+ '/usr/include/libxml2',
+ '/usr/local/include')
+
+found_lib = find_library('xml2', 'xmlParseDoc',
'/opt/lib',
'/opt/local/lib',
'/usr/local/lib',
'/usr/lib')
- crash(<<EOL)
-need libxml2.
+
+found_lib ||= find_library('libxml2', 'xmlParseDoc',
+ '/opt/lib',
+ '/opt/local/lib',
+ '/usr/local/lib',
+ '/usr/lib')
+
+if !found_header || !found_lib
+ crash(<<~EOL)
+ Cannot find libxml2.
Install the library or try one of the following options to extconf.rb:
@@ -47,11 +57,5 @@ need libxml2.
EOL
end
-have_func('rb_io_bufwrite', 'ruby/io.h')
-
-# For FreeBSD add /usr/local/include
-$INCFLAGS << " -I/usr/local/include"
-$CFLAGS << ' ' << $INCFLAGS
-
create_header()
create_makefile('libxml_ruby')
