summaryrefslogtreecommitdiff
path: root/converters/libiconv/buildlink3.mk
blob: 5af6e87eac3a7f6e57ecd6e7f801d85902fa86ac (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# $NetBSD: buildlink3.mk,v 1.10 2004/02/06 19:04:24 jlam Exp $

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH}+
ICONV_BUILDLINK3_MK:=	${ICONV_BUILDLINK3_MK}+

.include "../../mk/bsd.prefs.mk"

.if !empty(ICONV_BUILDLINK3_MK:M+)
BUILDLINK_PACKAGES+=		iconv
BUILDLINK_DEPENDS.iconv+=	libiconv>=1.9.1
BUILDLINK_PKGSRCDIR.iconv?=	../../converters/libiconv
.endif	# ICONV_BUILDLINK3_MK

BUILDLINK_CHECK_BUILTIN.iconv?=	NO

.if !defined(BUILDLINK_IS_BUILTIN.iconv)
BUILDLINK_IS_BUILTIN.iconv=	NO
.  if exists(/usr/include/iconv.h)
BUILDLINK_IS_BUILTIN.iconv=	YES
.  endif
.endif

.if !empty(PREFER_PKGSRC:M[yY][eE][sS]) || \
    !empty(PREFER_PKGSRC:Miconv)
BUILDLINK_USE_BUILTIN.iconv=	NO
.endif

.if defined(USE_GNU_ICONV)
BUILDLINK_USE_BUILTIN.iconv=	NO
.endif

.if !empty(BUILDLINK_CHECK_BUILTIN.iconv:M[yY][eE][sS])
BUILDLINK_USE_BUILTIN.iconv=	YES
.endif

.if !defined(BUILDLINK_USE_BUILTIN.iconv)
.  if !empty(BUILDLINK_IS_BUILTIN.iconv:M[nN][oO])
BUILDLINK_USE_BUILTIN.iconv=	NO
.  else
BUILDLINK_USE_BUILTIN.iconv=	YES
_INCOMPAT_ICONV?=	# should be set from defs.${OPSYS}.mk
INCOMPAT_ICONV?=	# empty
.    for _pattern_ in ${_INCOMPAT_ICONV} ${INCOMPAT_ICONV}
.      if !empty(MACHINE_PLATFORM:M${_pattern_})
BUILDLINK_USE_BUILTIN.iconv=	NO
.      endif
.    endfor
.  endif
MAKEFLAGS+=	BUILDLINK_USE_BUILTIN.iconv=${BUILDLINK_USE_BUILTIN.iconv}
.endif

.if !empty(BUILDLINK_USE_BUILTIN.iconv:M[nN][oO])
.  if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+=	iconv
.  endif
.endif

.if !empty(ICONV_BUILDLINK3_MK:M+)
.  if !empty(BUILDLINK_USE_BUILTIN.iconv:M[nN][oO])
_BLNK_LIBICONV=		-liconv
.  else
.    if !defined(_BLNK_LIBICONV_FOUND)
_BLNK_LIBICONV_FOUND!=							\
	if [ "`${ECHO} /usr/lib/libiconv.*`" = "/usr/lib/libiconv.*" ]; then \
		${ECHO} NO;						\
	else								\
		${ECHO} YES;						\
	fi
MAKEFLAGS+=	_BLNK_LIBICONV_FOUND=${_BLNK_LIBICONV_FOUND}
.    endif
.    if ${_BLNK_LIBICONV_FOUND} == "YES"
_BLNK_LIBICONV=		-liconv
.    else
_BLNK_LIBICONV=		# empty
BUILDLINK_TRANSFORM+=	l:iconv:
.    endif
BUILDLINK_LDADD.iconv?=	${_BLNK_LIBICONV}
.  endif

.  if defined(GNU_CONFIGURE)
.    if !empty(BUILDLINK_USE_BUILTIN.iconv:M[nN][oO])
CONFIGURE_ARGS+=	--with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
.    else
CONFIGURE_ARGS+=	--without-libiconv-prefix
.    endif
.  endif
.endif	# ICONV_BUILDLINK3_MK

BUILDLINK_DEPTH:=	${BUILDLINK_DEPTH:S/+$//}