mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/dbm/extconf.rb: refactored to split too long conditions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d698ea8991
commit
2f92a267f4
2 changed files with 41 additions and 26 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Feb 17 07:30:53 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/dbm/extconf.rb: refactored to split too long conditions.
|
||||
|
||||
Fri Feb 17 00:23:25 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/dbm/test_dbm.rb: fix skip condition for libgdbm 1.8.0 or prior.
|
||||
|
|
|
@ -76,33 +76,44 @@ def headers.db_check2(db, hdr)
|
|||
have_library("gdbm") or return false
|
||||
end
|
||||
|
||||
if have_type("DBM", 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) and
|
||||
(/\Adb\d?\z/ =~ db || db == 'libc' || !have_macro('_DB_H_', hdr, hsearch)) # _DB_H_ should not be defined except Berkeley DB.
|
||||
case db
|
||||
when /\Adb\d?\z/
|
||||
have_func('db_version((int *)0, (int *)0, (int *)0)', hdr, hsearch)
|
||||
when /\Agdbm/
|
||||
have_var("gdbm_version", hdr, hsearch)
|
||||
# gdbm_version is not declared by ndbm.h until gdbm 1.8.3.
|
||||
# We can't include ndbm.h and gdbm.h because they both define datum type.
|
||||
# ndbm.h includes gdbm.h and gdbm_version is declared since gdbm 1.9.
|
||||
have_libvar(["gdbm_version", "char *"], hdr, hsearch)
|
||||
when /\Aqdbm\z/
|
||||
have_var("dpversion", hdr, hsearch)
|
||||
end
|
||||
if hsearch
|
||||
$defs << hsearch
|
||||
@defs = hsearch
|
||||
end
|
||||
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||
@found << hdr
|
||||
true
|
||||
else
|
||||
false
|
||||
if !have_type("DBM", hdr, hsearch)
|
||||
return false
|
||||
end
|
||||
|
||||
if !(db == 'libc' ? have_func('dbm_open("", 0, 0)', hdr, hsearch) :
|
||||
have_library(db, 'dbm_open("", 0, 0)', hdr, hsearch))
|
||||
return false
|
||||
end
|
||||
|
||||
if !have_func('dbm_clearerr((DBM *)0)', hdr, hsearch)
|
||||
return false
|
||||
end
|
||||
|
||||
# _DB_H_ should not be defined except Berkeley DB.
|
||||
if !(/\Adb\d?\z/ =~ db || db == 'libc' || !have_macro('_DB_H_', hdr, hsearch))
|
||||
return false
|
||||
end
|
||||
|
||||
case db
|
||||
when /\Adb\d?\z/
|
||||
have_func('db_version((int *)0, (int *)0, (int *)0)', hdr, hsearch)
|
||||
when /\Agdbm/
|
||||
have_var("gdbm_version", hdr, hsearch)
|
||||
# gdbm_version is not declared by ndbm.h until gdbm 1.8.3.
|
||||
# We can't include ndbm.h and gdbm.h because they both define datum type.
|
||||
# ndbm.h includes gdbm.h and gdbm_version is declared since gdbm 1.9.
|
||||
have_libvar(["gdbm_version", "char *"], hdr, hsearch)
|
||||
when /\Aqdbm\z/
|
||||
have_var("dpversion", hdr, hsearch)
|
||||
end
|
||||
if hsearch
|
||||
$defs << hsearch
|
||||
@defs = hsearch
|
||||
end
|
||||
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||
@found << hdr
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(db, hdr) } }
|
||||
|
|
Loading…
Reference in a new issue