ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/ require 'mkmf' # :stopdoc: RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC'] # sqlite3 settings: # # The following settings taken from a more-or-less default OSX 10.10 sqlite installation. # # The only difference: we include FTS3 *and* FTS4 $defs.push "-DSQLITE_ENABLE_FTS4" $defs.push "-DSQLITE_ENABLE_FTS3_PARENTHESIS" $defs.push "-DSQLITE_ENABLE_LOCKING_STYLE=1" $defs.push "-DSQLITE_ENABLE_RTREE" $defs.push "-DSQLITE_SYSTEM_MALLOC" $defs.push "-DSQLITE_THREADSAFE=2" # additional settings $defs.push "-DSQLITE_ENABLE_COLUMN_METADATA" $defs.push "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" $defs.push "-DSQLITE_ENABLE_RTREE" $defs.push "-DSQLITE_SOUNDEX" $defs.push "-I#{File.dirname(__FILE__)}" # Some additional warnings: on my machine compiling the sqlite3 amalgation spits out some # warnings. As we don't hack sqlite3, but only the rubygem, we don't need these. $warnflags += " -Wno-incompatible-pointer-types-discards-qualifiers" $warnflags += " -Wno-unused-const-variable" $warnflags += " -Wno-shorten-64-to-32" $warnflags += " -Wno-typedef-redefinition" if RbConfig::CONFIG["host_os"] =~ /mswin/ $CFLAGS << ' -W3' end def asplode missing if RUBY_PLATFORM =~ /mingw|mswin/ abort "#{missing} is missing. Install SQLite3 from " + "http://www.sqlite.org/ first." else abort <<-error #{missing} is missing. Try 'port install sqlite3 +universal', 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' and check your shared library search path (the location where your sqlite3 shared library is located). error end end # -- sqlite3 platform configuration, see http://www.sqlite.org/compile.html have_func('fdatasync') have_func('gmtime_r') have_func('isnan') have_func('localtime_r') have_func('localtime_s') have_func('malloc_usable_size') have_func('strchrnul') have_func('usleep') have_func('utime') # -- ruby feature detection # Functions defined in 1.9 but not 1.8 have_func('rb_proc_arity') # Functions defined in 2.1 but not 2.0 have_func('rb_integer_pack') # These functions may not be defined in a standard sqlite3-ruby build - # they are here. We still need to define the test macros, as they are used # in the upstream (i.e. sqlite3-ruby) code. $defs.push "-DHAVE_SQLITE3_INITIALIZE" $defs.push "-DHAVE_SQLITE3_BACKUP_INIT" $defs.push "-DHAVE_SQLITE3_COLUMN_DATABASE_NAME" $defs.push "-DHAVE_SQLITE3_ENABLE_LOAD_EXTENSION" $defs.push "-DHAVE_SQLITE3_LOAD_EXTENSION" $defs.push "-DHAVE_SQLITE3_OPEN_V2" $defs.push "-DHAVE_SQLITE3_PREPARE_V2" $defs.push "-DHAVE_SQLITE3_INT64" $defs.push "-DHAVE_SQLITE3_UINT64" create_makefile('sqlite3/sqlite3_native')