summaryrefslogtreecommitdiff
path: root/mk/db1.builtin.mk
blob: 760e63cd3cf6dcb339c52df70c523e3844006e4e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# $NetBSD: db1.builtin.mk,v 1.3 2004/11/15 18:14:10 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_LDADD.db1=	-ldb
.    endif
.    if !empty(_BLNK_LIB_FOUND.db1:M[yY][eE][sS])
BUILDLINK_LDADD.db1=	-ldb1
BUILDLINK_TRANSFORM+=	l:db:db1
.    endif
BUILDLINK_LIBS.db1=	${BUILDLINK_LDADD.db1}
.  endif # USE_BUILTIN.db1 == yes
.endif	# CHECK_BUILTIN.db1