Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#die(msg) ⇒ Object



1
2
3
4
# File 'ext/extconf.rb', line 1

def die(msg)
  $stderr.puts "**** ERROR: #{msg}"
  exit 1
end

#motto_mysqlObject

make mysql constant File.open(“conftest.c”, “w”) do |f|

f.puts src

end

if defined? cpp_command then

cpp = Config.expand(cpp_command(''))

else

cpp = Config.expand sprintf(CPP, $CPPFLAGS, $CFLAGS, '')

end if /mswin32/ =~ RUBY_PLATFORM && !/-E/.match(cpp)

cpp << " -E"

end unless system “#cpp > confout” then

die "can't compile test source."

end

add ‘#define ulong unsigned long’ to mysql.c on MacOS X if /darwin/ =~ RUBY_PLATFORM && /i686/ =~ RUBY_PLATFORM

definition = "#define ulong unsigned long\n"
s = File.open('mysql.c') {|f| f.read }
unless s.index(definition)
  print "add '#{definition.chomp}' to mysql.c..."
  File.open('mysql.c', 'w') {|f| f.write(definition + s) }
  puts "done."
end

end

File.unlink “conftest.c”

error_syms = [] IO.foreach(‘confout’) do |l|

next unless l =~ /errmsg\.h|mysqld_error\.h/
fn = l.split(/\"/)[1]
IO.foreach(fn) do |m|
  if m =~ /^#define\s+([CE]R_[0-9A-Z_]+)/ then
    error_syms << $1
  end
end

end File.unlink ‘confout’ error_syms.uniq!

File.open(‘error_const.h’, ‘w’) do |f|

error_syms.each do |s|
  f.puts "    rb_define_mysql_const(#{s});"
end

end

create_makefile(“mysql”)



114
# File 'ext/extconf.rb', line 114

create_makefile("motto_mysql")