extconf.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
  2. require 'mkmf'
  3. # :stopdoc:
  4. RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
  5. # --with-sqlite3-{dir,include,lib}
  6. dir_config("sqlite3")
  7. # prioritize local builds
  8. if enable_config("local", false)
  9. $LDFLAGS = ENV.fetch("LDFLAGS", nil)
  10. end
  11. if RbConfig::CONFIG["host_os"] =~ /mswin/
  12. $CFLAGS << ' -W3'
  13. end
  14. def asplode missing
  15. if RUBY_PLATFORM =~ /mingw|mswin/
  16. abort "#{missing} is missing. Install SQLite3 from " +
  17. "http://www.sqlite.org/ first."
  18. else
  19. abort <<-error
  20. #{missing} is missing. Try 'port install sqlite3 +universal'
  21. or 'yum install sqlite-devel' and check your shared library search path (the
  22. location where your sqlite3 shared library is located).
  23. error
  24. end
  25. end
  26. asplode('sqlite3.h') unless find_header 'sqlite3.h'
  27. asplode('sqlite3') unless find_library 'sqlite3', 'sqlite3_libversion_number'
  28. # Functions defined in 1.9 but not 1.8
  29. have_func('rb_proc_arity')
  30. # These functions may not be defined
  31. have_func('sqlite3_initialize')
  32. have_func('sqlite3_backup_init')
  33. have_func('sqlite3_column_database_name')
  34. have_func('sqlite3_enable_load_extension')
  35. have_func('sqlite3_load_extension')
  36. have_func('sqlite3_open_v2')
  37. have_func('sqlite3_prepare_v2')
  38. have_type('sqlite3_int64', 'sqlite3.h')
  39. have_type('sqlite3_uint64', 'sqlite3.h')
  40. create_makefile('sqlite3/sqlite3_native')