Subject: db1 detection in bdb.buildlink3.mk
To: None <tech-pkg@NetBSD.org>
From: Min Sik Kim <minskim@NetBSD.org>
List: tech-pkg
Date: 04/20/2004 10:42:45
--Signature=_Tue__20_Apr_2004_10_42_45_-0500_hvIuWUm49hkzx9yr
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Hi,

Currently, mk/bdb.buildlink3.mk assumes that /usr/include/db.h is from
db-1.85, but that doesn't hold on some platforms.  For example,
/usr/include/db.h on Debian Linux woody is from db2, and that on
Debian Linux sarge is from db3.  The following patch modifies
bdb.buildlink3.mk so that it accepts /usr/include/db.h as a valid
db-1.85 header file only when "^\#define.*HASHVERSION.*2$" is found.
(Python also looks for HASHVERSION when detecting the db-1.85 header
file.)  It was tested with python23{,-pth} on NetBSD-current and
Debian Linux.

Index: bdb.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bdb.buildlink3.mk,v
retrieving revision 1.5
diff -u -r1.5 bdb.buildlink3.mk
--- bdb.buildlink3.mk	12 Apr 2004 15:13:30 -0000	1.5
+++ bdb.buildlink3.mk	14 Apr 2004 03:26:29 -0000
@@ -56,11 +56,19 @@
 _BDB_OK.native?=	no
 _BDB_INSTALLED.native?=	no
 .  if exists(/usr/include/db.h)
-_BDB_OK.native=		yes
+_BDB_OK.native!=	\
+	if ${GREP} -q "^\#define.*HASHVERSION.*2$$" /usr/include/db.h; then \
+		${ECHO} "yes";						\
+	else								\
+		${ECHO} "no";						\
+	fi
+.    if !empty(_BDB_OK.native:M[yY][eE][sS])
 _BDB_INSTALLED.native=	yes
 _BDB_INCDIRS=		include
 _BDB_TRANSFORM=		# empty
-.  elif exists(/usr/include/db1/db.h)
+.    endif
+.  endif
+.  if !empty(_BDB_OK.native:M[nN][oO]) && exists(/usr/include/db1/db.h)
 _BDB_OK.native=		yes
 _BDB_INSTALLED.native=	yes
 _BDB_INCDIRS=		include/db1


Any comments?

-- 
Min Sik Kim

--Signature=_Tue__20_Apr_2004_10_42_45_-0500_hvIuWUm49hkzx9yr
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iQEVAwUBQIVE9fQsKR/Zi7L+AQJosQf+J2T7lYeEorxlwNw8fJUtns7S53i2Lxag
DlYnNw53+W7pES6xE/rz0WcSZkQ/yMH5jxEwkzgjGIpWAS5hu/lcns9Q+rpFfQ6i
yyP2zZPG9IUeem3T5UDhwF4iXcfma//2SOLfUJEro46o3suDlK81CIyhWcswRslO
mRKKlHDHQoXSSMOdBzQ/9w9I8NImnVD+Je0a0umY7siIV22lTUyBH4EvCZuySZac
JsOm/chp/FA7h+ZSz43sgd41VHifD2GoJvTiEnpwOs77u5zXECiObs2+b8fi5BYL
hvYRZjKgyCJ8XP3E8klaos26kGKVkiCTgOYUIatDbPn58D6MPkUftA==
=dgMk
-----END PGP SIGNATURE-----

--Signature=_Tue__20_Apr_2004_10_42_45_-0500_hvIuWUm49hkzx9yr--