summaryrefslogtreecommitdiff
path: root/lang/ruby18-base/patches/patch-ac
blob: 8daa27d00cbae80e448191638e54a0e664c72058 (plain)
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
$NetBSD: patch-ac,v 1.7 2009/08/11 14:26:58 taca Exp $

* Accept db3 or db4 as include/library.

--- ext/dbm/extconf.rb.orig	2007-02-13 08:01:19.000000000 +0900
+++ ext/dbm/extconf.rb
@@ -5,13 +5,15 @@ dir_config("dbm")
 if dblib = with_config("dbm-type", nil)
   dblib = dblib.split(/[ ,]+/)
 else
-  dblib = %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
+  dblib = %w(db db2 db1 db4 db3 dbm gdbm gdbm_compat qdbm)
 end
 
 headers = {
   "db" => ["db.h"],
   "db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
   "db2" => ["db2/db.h", "db2.h", "db.h"],
+  "db3" => ["db3/db.h", "db3.h", "db.h"],
+  "db4" => ["db4/db.h", "db4.h", "db.h"],
   "dbm" => ["ndbm.h"],
   "gdbm" => ["gdbm-ndbm.h", "ndbm.h"],
   "gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h"],
@@ -24,7 +26,7 @@ def headers.db_check(db)
   hsearch = nil
 
   case db
-  when /^db2?$/
+  when /^db[2-4]?$/
     db_prefix = "__db_n"
     hsearch = "-DDB_DBM_HSEARCH "
   when "gdbm"
@@ -36,7 +38,8 @@ def headers.db_check(db)
   db_prefix ||= ""
 
   if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
-      hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", hdr, hsearch)}
+      (hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", hdr, hsearch)} or
+       hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", ["db.h", hdr], hsearch)})
     have_func(db_prefix+"dbm_clearerr") unless have_gdbm
     $defs << hsearch if hsearch
     $defs << '-DDBM_HDR="<'+hdr+'>"'