summaryrefslogtreecommitdiff
path: root/devel/gettext-lib/buildlink.mk
blob: 074b4aeffee1eb988a3ddfb978326635aeba2653 (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
# $NetBSD: buildlink.mk,v 1.6 2001/06/11 01:59:34 jlam Exp $
#
# This Makefile fragment is included by packages that use gettext.
#
# To use this Makefile fragment, simply:
#
# (1) Optionally define GETTEXT_REQD to the version of gettext desired.
# (2) Include this Makefile fragment in the package Makefile,
# (3) Add ${BUILDLINK_DIR}/include to the front of the C preprocessor's header
#     search path, and
# (4) Add ${BUILDLINK_DIR}/lib to the front of the linker's library search
#     path.

.if !defined(GETTEXT_BUILDLINK_MK)
GETTEXT_BUILDLINK_MK=	# defined

GETTEXT_REQD?=		0.10.35nb1

.if defined(USE_GNU_GETTEXT)
_NEED_GNU_GETTEXT=	YES
.elif exists(/usr/include/libintl.h)
_NEED_GNU_GETTEXT=	NO
.else
_NEED_GNU_GETTEXT=	YES
.endif

.if ${_NEED_GNU_GETTEXT} == "YES"
DEPENDS+=		gettext-lib>=${GETTEXT_REQD}:../../devel/gettext-lib
BUILDLINK_PREFIX.gettext=	${LOCALBASE}
.else
BUILDLINK_PREFIX.gettext=	/usr
.endif

BUILDLINK_FILES.gettext=	include/libintl.h
BUILDLINK_FILES.gettext+=	lib/libintl.*

BUILDLINK_TARGETS.gettext=	gettext-buildlink
BUILDLINK_TARGETS+=		${BUILDLINK_TARGETS.gettext}

.if defined(GNU_CONFIGURE)
#
# Add -lintl to LIBS in CONFIGURE_ENV to work around broken gettext.m4:
# gettext.m4 does not add -lintl where it should, and the resulting
# configure script fails to detect if libintl.a is the genuine GNU gettext
# or not.
#
CONFIGURE_ENV+=		CPPFLAGS="${CPPFLAGS}"
CONFIGURE_ENV+=		LIBS="${LIBS}"
CFLAGS+=		-I${BUILDLINK_DIR}/include
CPPFLAGS+=		-I${BUILDLINK_DIR}/include
LDFLAGS+=		-L${BUILDLINK_DIR}/lib
LIBS+=			-lintl
.endif

pre-configure: ${BUILDLINK_TARGETS.gettext}
gettext-buildlink: _BUILDLINK_USE

.include "../../mk/bsd.buildlink.mk"

.endif	# GETTEXT_BUILDLINK_MK