#!/usr/bin/ruby -w # See the LICENSE file for copyright and distribution information require "mkmf" def help print < --enable-debug compile with memwatch HELP end if ARGV.include?( "--help" ) help() exit 0 end if enable_config("debug", false) File.symlink( "debug/memwatch.h", "memwatch.h" ) if( ! File.exist?("memwatch.h") ) File.symlink( "debug/memwatch.c", "memwatch.c" ) if( ! File.exist?("memwatch.c") ) $CFLAGS += " -DMEMWATCH -D__DEBUG__" end if enable_config("error-handler", false) $CFLAGS += " -DUSE_ERROR_HANDLER" end $LIBPATH.push(Config::CONFIG['libdir']) def crash(str) printf(" extconf failure: %s\n", str) exit 1 end #unless have_library("z", "inflate") # crash("need zlib") #else # $defs.push('-DHAVE_ZLIB_H') #end if dir_config( "xslt" ) != [nil, nil] inc, lib = dir_config( 'xslt' ) $LDFLAGS << " -L#{lib} -lxslt -lxml2 -lz -lpthread -liconv -lm" $CFLAGS << " -I#{inc}" elsif ex = find_executable( "xslt-config" ) $LDFLAGS << ' ' + `#{ex} --libs`.chomp $CFLAGS << ' ' + `#{ex} --cflags`.chomp else crash(<