diff options
Diffstat (limited to 'ext/ripper/extconf.rb')
-rw-r--r-- | ext/ripper/extconf.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/ripper/extconf.rb b/ext/ripper/extconf.rb new file mode 100644 index 0000000000..536e23d3ad --- /dev/null +++ b/ext/ripper/extconf.rb @@ -0,0 +1,24 @@ +#!ruby -s + +require 'mkmf' +require 'rbconfig' + +def main + unless have_command('bison') + $stderr.puts 'Ripper requires bison; abort' + exit 1 + end + $objs = %w(ripper.o) + $cleanfiles.concat %w(ripper.y ripper.c ripper.output ids1 ids2) + $CPPFLAGS += ' -DRIPPER' + $CPPFLAGS += ' -DRIPPER_DEBUG' if $debug + create_makefile 'ripper' +end + +def have_command(cmd) + ENV['PATH'].split(File::PATH_SEPARATOR).any? {|path| + File.executable?("#{path}/#{cmd}#{Config::CONFIG['EXEEXT']}") + } +end + +main |