1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
if VERSION < "1.3"
print "This library is for ruby-1.3 or higher.\n"
exit 1
end
require "mkmf"
dir_config('pgsql')
$CFLAGS = ""
$LDFLAGS = ""
have_library("wsock32", "cygwin32_socket") or have_library("socket", "socket")
have_library("inet", "gethostbyname")
have_library("nsl", "gethostbyname")
have_header("sys/un.h")
if have_func("socket") or have_func("cygwin32_socket")
have_func("hsterror")
unless have_func("gethostname")
have_func("uname")
end
if ENV["SOCKS_SERVER"] # test if SOCKSsocket needed
if have_library("socks", "Rconnect")
$CFLAGS+="-DSOCKS"
end
end
incdir = ENV["POSTGRES_INCLUDE"]
incdir ||= with_config("pgsql-include-dir")
if incdir
$CFLAGS += "-I#{incdir}"
puts "Using PostgreSQL include directory: #{incdir}"
end
libdir = ENV["POSTGRES_LIB"]
libdir ||= with_config("pgsql-lib-dir")
if libdir
$LDFLAGS += "-L#{libdir}"
puts "Using PostgreSQL lib directory: #{libdir}"
end
if have_library("pq", "PQsetdbLogin")
have_func("PQsetClientEncoding")
have_func("pg_encoding_to_char")
have_func("PQescapeString")
create_makefile("postgres")
else
puts "Could not find PostgreSQL libraries: Makefile not created"
end
end
|