Sha256: 3500e737e9c9534bed015f4a405aef1f75a5a626c67ff2535512ef651319b9b5

Contents?: true

Size: 930 Bytes

Versions: 8

Compression:

Stored size: 930 Bytes

Contents

if RUBY_VERSION < '1.3'
  puts 'This library is for ruby-1.3 or higher.'
  exit 1
end

require 'mkmf'

def config_value(type)
  ENV["POSTGRES_#{type.upcase}"] || pg_config(type)
end

def pg_config(type)
  IO.popen("pg_config --#{type}dir").readline.chomp rescue nil
end

def have_build_env
  have_library('pq') && have_header('libpq-fe.h') && have_header('libpq/libpq-fs.h')
end

dir_config('pgsql', config_value('include'), config_value('lib'))

required_libraries = %w(crypto ssl)
desired_functions = %w(PQsetClientEncoding pg_encoding_to_char PQfreemem)
compat_functions = %w(PQescapeString PQexecParams)

if have_build_env
  required_libraries.each(&method(:have_library))
  desired_functions.each(&method(:have_func))
  $objs = ['postgres.o'] if compat_functions.all?(&method(:have_func))
  create_makefile("postgres")
else
  puts 'Could not find PostgreSQL build environment (libraries & headers): Makefile not created'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-postgres-0.7.1.2005.11.24-mswin32 extconf.rb
ruby-postgres-0.7.1.2005.12.19-mswin32 extconf.rb
ruby-postgres-0.7.1.2005.11.27-mswin32 extconf.rb
ruby-postgres-0.7.1.2005.11.26 extconf.rb
ruby-postgres-0.7.1.2005.11.27 extconf.rb
ruby-postgres-0.7.1.2005.11.23 extconf.rb
ruby-postgres-0.7.1.2005.11.24 extconf.rb
ruby-postgres-0.7.1.2005.12.19 extconf.rb