1 # $NetBSD: builtin.mk,v 1.40 2011/01/21 21:24:11 wiz Exp $
3 .include "../../mk/bsd.fast.prefs.mk"
7 BUILTIN_FIND_LIBS:= intl
8 BUILTIN_FIND_FILES_VAR:= H_GETTEXT H_GENTOO_GETTEXT \
10 BUILTIN_FIND_FILES.H_GETTEXT= /usr/include/libintl.h
11 BUILTIN_FIND_GREP.H_GETTEXT= \#define[ ]*__USE_GNU_GETTEXT
12 BUILTIN_FIND_FILES.H_GENTOO_GETTEXT= /usr/include/libintl.h
13 BUILTIN_FIND_GREP.H_GENTOO_GETTEXT= gentoo-multilib/.*/libintl.h
14 BUILTIN_FIND_FILES.H_NGETTEXT_GETTEXT= /usr/include/libintl.h
15 BUILTIN_FIND_GREP.H_NGETTEXT_GETTEXT= char.*ngettext
17 .include "../../mk/buildlink3/bsd.builtin.mk"
20 ### Determine if there is a built-in implementation of the package and
21 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
24 # Gentoo Linux has an unusual scheme where /usr/include/libintl.h
25 # pulls in gentoo-multilib/$ARCH/libintl.h, where the latter is the
26 # real libintl.h file. We can safely assume that this is GNU gettext
29 .if !defined(IS_BUILTIN.gettext)
30 IS_BUILTIN.gettext= no
31 . if (empty(H_GETTEXT:M__nonexistent__) && \
32 empty(H_GETTEXT:M${LOCALBASE}/*)) || \
33 (empty(H_GENTOO_GETTEXT:M__nonexistent__) && \
34 empty(H_GENTOO_GETTEXT:M${LOCALBASE}/*))
35 IS_BUILTIN.gettext= yes
38 MAKEVARS+= IS_BUILTIN.gettext
41 ### Determine whether we should use the built-in implementation if it
42 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
44 .if !defined(USE_BUILTIN.gettext)
45 . if ${PREFER.gettext} == "pkgsrc"
46 USE_BUILTIN.gettext= no
48 USE_BUILTIN.gettext= ${IS_BUILTIN.gettext}
49 . if defined(BUILTIN_PKG.gettext) && \
50 !empty(IS_BUILTIN.gettext:M[yY][eE][sS])
51 USE_BUILTIN.gettext= yes
52 . for _dep_ in ${BUILDLINK_API_DEPENDS.gettext}
53 . if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
54 USE_BUILTIN.gettext!= \
55 if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gettext:Q}; then \
64 # XXX By default, assume that the native gettext implementation is good
65 # XXX enough to replace GNU gettext if it supplies ngettext().
67 . if empty(H_NGETTEXT_GETTEXT:M__nonexistent__) && \
68 empty(H_NGETTEXT_GETTEXT:M${LOCALBASE}/*)
69 USE_BUILTIN.gettext= yes
72 # Some platforms don't have a gettext implementation that can replace
75 _INCOMPAT_GETTEXT?= SunOS-*-* # XXX move to mk/platforms/SunOS.mk
76 . for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT}
77 . if !empty(MACHINE_PLATFORM:M${_pattern_})
78 USE_BUILTIN.gettext= no
81 . endif # PREFER.gettext
83 MAKEVARS+= USE_BUILTIN.gettext
85 # Define BUILTIN_LIBNAME.gettext to be the base name of the built-in
88 .if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS])
89 BUILTIN_LIBNAME.gettext= intl
91 BUILTIN_LIBNAME.gettext= # empty (part of the C library)
95 ### The section below only applies if we are not including this file
96 ### solely to determine whether a built-in implementation exists.
98 CHECK_BUILTIN.gettext?= no
99 .if !empty(CHECK_BUILTIN.gettext:M[nN][oO])
101 . if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
102 BUILDLINK_LIBNAME.gettext= ${BUILTIN_LIBNAME.gettext}
103 . if empty(BUILTIN_LIBNAME.gettext)
104 BUILDLINK_TRANSFORM+= rm:-lintl
108 # If using a built-in libintl that isn't from GNU gettext, then set up
109 # some GNU configure variables that are checked by modern gettext.m4
110 # so that it will detect "GNU gettext" in the existing libintl.
112 . if defined(GNU_CONFIGURE)
113 . if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
114 . if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS])
115 CONFIGURE_ENV+= gt_cv_func_gnugettext_libintl="yes"
116 CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes"
117 . if empty(H_NGETTEXT_GETTEXT:M__nonexistent__) && \
118 empty(H_NGETTEXT_GETTEXT:M${LOCALBASE}/*)
119 CONFIGURE_ENV+= gt_cv_func_gnugettext2_libintl="yes"
123 . if !empty(USE_BUILTIN.gettext:M[nN][oO])
124 CONFIGURE_ARGS+= --with-libintl-prefix="${BUILDLINK_PREFIX.gettext}"
128 .endif # CHECK_BUILTIN.gettext