summaryrefslogtreecommitdiff
path: root/devel/libexecinfo/builtin.mk
blob: 6a1039684cec69f5d924eb21e934056cf60d96c9 (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
# $NetBSD: builtin.mk,v 1.1 2013/07/03 14:47:04 ryoon Exp $

BUILTIN_PKG:=	libexecinfo

BUILTIN_FIND_FILES_VAR:=	H_EXECINFO
BUILTIN_FIND_FILES.H_EXECINFO=	/usr/include/execinfo.h

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.libexecinfo)
IS_BUILTIN.libexecinfo=	no
.  if empty(H_EXECINFO:M__nonexistent__) && empty(H_EXECINFO:M${LOCALBASE}/*)
IS_BUILTIN.libexecinfo=	yes
.  endif
.endif	# IS_BUILTIN.libexecinfo
MAKEVARS+=	IS_BUILTIN.libexecinfo

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.libexecinfo)
.  if ${PREFER.libexecinfo} == "pkgsrc"
USE_BUILTIN.libexecinfo=	no
.  else
USE_BUILTIN.libexecinfo=	${IS_BUILTIN.libexecinfo}
.    if defined(BUILTIN_PKG.libexecinfo) && \
        !empty(IS_BUILTIN.libexecinfo:M[yY][eE][sS])
USE_BUILTIN.libexecinfo=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.libexecinfo}
.        if !empty(USE_BUILTIN.libexecinfo:M[yY][eE][sS])
USE_BUILTIN.libexecinfo!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.libexecinfo:Q}; then	\
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
.  endif  # PREFER.libexecinfo
.endif
MAKEVARS+=	USE_BUILTIN.libexecinfo

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.libexecinfo?=	no
.if !empty(CHECK_BUILTIN.libexecinfo:M[nN][oO])

.  if !empty(USE_BUILTIN.libexecinfo:M[nN][oO])
_BLTN_LIBEXECINFO=	-lexecinfo
.  else
.    if exists(/usr/include/execinfo.h) && (${OPSYS} == "NetBSD")
_BLTN_LIBEXECINFO=	-lexecinfo
.    else
_BLTN_LIBEXECINFO=	# empty
.    endif
.  endif
BUILDLINK_LDADD.libexecinfo?=	${_BLTN_LIBEXECINFO}
BUILDLINK_LDFLAGS.libexecinfo?=	${_BLTN_LIBEXECINFO}

.endif	# CHECK_BUILTIN.libexecinfo