summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-16 22:32:10 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-16 22:32:10 +0000
commit2f92a267f4d0c4aad1c414515092ca7bf99206fe (patch)
treee35619359820ddfe4cac1ae43285a5633724f8c8 /ext/dbm
parentd698ea8991ff6f0d6160838bdd5785a01fdf266d (diff)
* 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
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/extconf.rb63
1 files changed, 37 insertions, 26 deletions
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 69889a3..02f1611 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -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) } }