summaryrefslogtreecommitdiff
path: root/mk/db1.builtin.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-11-15 17:54:49 +0000
committerjlam <jlam@pkgsrc.org>2004-11-15 17:54:49 +0000
commitb67b0725c487d6867521ee52db866b955f29d0fd (patch)
tree5579b0ab6b1d842e66a7d3075d37a9f9564a124e /mk/db1.builtin.mk
parent8f9890fc252ddfbc4e7f77aea28c933fe28c5a81 (diff)
downloadpkgsrc-b67b0725c487d6867521ee52db866b955f29d0fd.tar.gz
Rework the Berkeley DB detection in buildlink3:
* Add a db1.builtin.mk file that detects whether DB-1.85 functionality exists in the base system, and remove the distinction between "native" and the other Berkeley DB packages -- we now refer to db[1234]. This paves the way for any future databases/db1 package. * USE_DB185 shouldn't need to be set by any packages -- its correct value is now automatically determined by bdb.buildlink3.mk depending on whether we explicitly request db1 or not. By default, if you include bdb.buildlink3.mk, you want DB-1.85 functionality and USE_DB185 defaults to "yes", but if you explicitly remove db1 from the list of acceptable DBs, then USE_DB185 defaults to "no". * Set BDB_LIBS to the library options needed to link against the DB library when bdb.buildlink3.mk is included. * We only add the DB library to the linker command automatically if we want DB-1.85 functionality; otherwise assume that the package configure process can figure out how to probe for the correct headers and libraries. Edit package Makefiles to nuke redundant settings of USE_DB185.
Diffstat (limited to 'mk/db1.builtin.mk')
-rw-r--r--mk/db1.builtin.mk72
1 files changed, 72 insertions, 0 deletions
diff --git a/mk/db1.builtin.mk b/mk/db1.builtin.mk
new file mode 100644
index 00000000000..dee2f8cf3cd
--- /dev/null
+++ b/mk/db1.builtin.mk
@@ -0,0 +1,72 @@
+# $NetBSD: db1.builtin.mk,v 1.1 2004/11/15 17:54:49 jlam Exp $
+
+.for _lib_ in db db1
+. if !defined(_BLNK_LIB_FOUND.${_lib_})
+_BLNK_LIB_FOUND.${_lib_}!= \
+ if ${TEST} `${ECHO} /usr/lib/lib${_lib_}.*` = "/usr/lib/lib${_lib_}.*"; then \
+ ${ECHO} "no"; \
+ elif ${TEST} `${ECHO} /lib/lib${_lib_}.*` = "/lib/lib${_lib_}.*"; then \
+ ${ECHO} "no"; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+BUILDLINK_VARS+= _BLNK_LIB_FOUND.${_lib_}
+. endif
+.endfor
+.undef _lib_
+
+.if !defined(IS_BUILTIN.db1)
+IS_BUILTIN.db1= no
+#
+# The builtin Berkeley database library must support hash version 2 or
+# else it doesn't support db-1.85 databases.
+#
+_BLNK_NATIVE_DB1_OK= no
+. for _inc_ in /usr/include/db.h /usr/include/db1/db.h
+. if exists(${_inc_})
+_BLNK_NATIVE_DB1_OK.${_inc_}!= \
+ if ${GREP} -q "^\#define.*HASHVERSION.*2$$" ${_inc_}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+_BLNK_NATIVE_DB1_OK+= ${_BLNK_NATIVE_DB1_OK.${_inc_}}
+. endfor
+. undef _inc_
+. if !empty(_BLNK_NATIVE_DB1_OK:M[yY][eE][sS])
+IS_BUILTIN.db1= yes
+. endif
+BUILDLINK_VARS+= IS_BUILTIN.db1
+.endif # IS_BUILTIN.db1
+
+.if !defined(USE_BUILTIN.db1)
+USE_BUILTIN.db1?= ${IS_BUILTIN.db1}
+_INCOMPAT_DB1?= # empty
+. for _pattern_ in ${_INCOMPAT_DB1} ${INCOMPAT_DB1}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.db1= no
+. endif
+. endfor
+. undef _pattern_
+BUILDLINK_VARS+= USE_BUILTIN.db1
+.endif # USE_BUILTIN.db1
+
+CHECK_BUILTIN.db1?= no
+.if !empty(CHECK_BUILTIN.db1:M[nN][oO])
+. if !empty(USE_BUILTIN.db1:M[yY][eE][sS])
+BUILDLINK_PREFIX.db1= /usr
+. if exists(/usr/include/db.h)
+BUILDLINK_INCDIRS.db1= include
+. elif exists(/usr/include/db1/db.h)
+BUILDLINK_INCDIRS.db1= include/db1
+. endif
+. if !empty(_BLNK_LIB_FOUND.db:M[yY][eE][sS])
+BUILDLINK_LIBS.db1= -ldb
+. endif
+. if !empty(_BLNK_LIB_FOUND.db1:M[yY][eE][sS])
+BUILDLINK_LIBS.db1= -ldb1
+BUILDLINK_TRANSFORM+= l:db:db1
+. endif
+. endif # USE_BUILTIN.db1 == yes
+.endif # CHECK_BUILTIN.db1