* ext/dbm/extconf.rb: rollback for each headers for each libraries.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-11-13 10:58:18 +00:00
Родитель e8ca9cc343
Коммит bfed16a21f
2 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sun Nov 13 19:57:18 2011 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: rollback for each headers for each libraries.
Sun Nov 13 16:24:48 2011 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: treat libc as a choice for a library which

Просмотреть файл

@ -29,10 +29,10 @@ end
headers.found = []
headers.defs = nil
def headers.db_check(db)
def headers.db_check(db, hdr)
old_libs = $libs.dup
old_defs = $defs.dup
result = db_check2(db)
result = db_check2(db, hdr)
if !result
$libs = old_libs
$defs = old_defs
@ -40,19 +40,17 @@ def headers.db_check(db)
result
end
def headers.db_check2(db)
def headers.db_check2(db, hdr)
hsearch = nil
case db
when /^db[2-5]?$/
hsearch = "-DDB_DBM_HSEARCH"
when "gdbm"
when "gdbm_compat"
have_library("gdbm") or return false
end
hdrs = self.fetch(db, ["ndbm.h"])
if (hdr = hdrs.find {|h| have_type("DBM", h, hsearch)} || hdrs.find {|h| have_type("DBM", ["db.h", h], hsearch)}) and
if (have_type("DBM", hdr, hsearch) || have_type("DBM", ["db.h", hdr], hsearch)) and
(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch)) and
have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
@ -68,7 +66,7 @@ def headers.db_check2(db)
end
end
if dblib.any? {|db| headers.db_check(db)}
if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(db, hdr) } }
have_header("cdefs.h")
have_header("sys/cdefs.h")
have_func("dbm_pagfno((DBM *)0)", headers.found, headers.defs)