diff options
author | jlam <jlam@pkgsrc.org> | 2008-02-27 22:10:34 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2008-02-27 22:10:34 +0000 |
commit | 1ba751eba24b07c1344b2888c4706554918f8ee4 (patch) | |
tree | 1609b129b1f252201860de23bdb307a36fd19bc3 /devel/gettext-lib | |
parent | e332637fc79a5dddf52e2ccd8bc01bf49e099f61 (diff) | |
download | pkgsrc-1ba751eba24b07c1344b2888c4706554918f8ee4.tar.gz |
Greatly simplify the logic that tries to determine whether -lintl
needs -liconv in order to satisfy linkage requirements. This is now
patterned after the approach taken with readline and termlib.
Examples on NetBSD for a package that includes only
gettext-lib/buildlink3.mk:
PREFER_NATIVE= yes
PREFER_PKGSRC= # empty
# This uses the native gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
PREFER_NATIVE= yes
PREFER_PKGSRC= iconv
# This uses the native gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
PREFER_NATIVE= yes
PREFER_PKGSRC= gettext
# This uses the pkgsrc gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
PREFER_NATIVE= yes
PREFER_PKGSRC= gettext iconv
# This uses the pkgsrc gettext and pkgsrc iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl -liconv"
PREFER_NATIVE= # empty
PREFER_PKGSRC= yes
# This uses the pkgsrc gettext and pkgsrc iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl -liconv"
PREFER_NATIVE= iconv
PREFER_PKGSRC= yes
# This uses the pkgsrc gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
PREFER_NATIVE= gettext
PREFER_PKGSRC= yes
# This uses the native gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
PREFER_NATIVE= gettext iconv
PREFER_PKGSRC= yes
# This uses the native gettext and native iconv, with:
# BUILDLINK_LDADD.gettext == "-lintl"
Diffstat (limited to 'devel/gettext-lib')
-rw-r--r-- | devel/gettext-lib/buildlink3.mk | 25 | ||||
-rw-r--r-- | devel/gettext-lib/builtin.mk | 100 |
2 files changed, 54 insertions, 71 deletions
diff --git a/devel/gettext-lib/buildlink3.mk b/devel/gettext-lib/buildlink3.mk index a496a64e518..c77c894ab1e 100644 --- a/devel/gettext-lib/buildlink3.mk +++ b/devel/gettext-lib/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.29 2008/01/23 17:35:20 tnn Exp $ +# $NetBSD: buildlink3.mk,v 1.30 2008/02/27 22:10:34 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ GETTEXT_BUILDLINK3_MK:= ${GETTEXT_BUILDLINK3_MK}+ @@ -14,16 +14,35 @@ BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}gettext .if !empty(GETTEXT_BUILDLINK3_MK:M+) BUILDLINK_API_DEPENDS.gettext+= gettext-lib>=0.14.5 BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib +BUILDLINK_LIBNAME.gettext= intl +BUILDLINK_LDADD.gettext= ${BUILDLINK_LIBNAME.gettext:S/^/-l/:S/^-l$//} +BUILDLINK_LDADD.gettext+= ${BUILDLINK_LDADD.iconv} .endif # GETTEXT_BUILDLINK3_MK .include "../../mk/bsd.fast.prefs.mk" +# Some GNU configure scripts generated with an older and broken gettext.m4 +# fail to detect if gettext is present or not because it fails to add +# "-lintl" to the linker command line. +# +# If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" +# to LIBS to workaround this brokenness. +# +BROKEN_GETTEXT_DETECTION?= no +. if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) +BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} +CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" +. endif + CHECK_BUILTIN.gettext:= yes .include "../../devel/gettext-lib/builtin.mk" CHECK_BUILTIN.gettext:= no -.if !empty(USE_BUILTIN.gettext:M[nN][oO]) -. include "../../converters/libiconv/buildlink3.mk" +# A built-in gettext is always going to use a built-in iconv. +.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) +USE_BUILTIN.iconv= yes .endif +.include "../../converters/libiconv/buildlink3.mk" + BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} diff --git a/devel/gettext-lib/builtin.mk b/devel/gettext-lib/builtin.mk index 8c0183d2a91..adaafbba266 100644 --- a/devel/gettext-lib/builtin.mk +++ b/devel/gettext-lib/builtin.mk @@ -1,16 +1,18 @@ -# $NetBSD: builtin.mk,v 1.37 2008/01/25 14:42:27 joerg Exp $ +# $NetBSD: builtin.mk,v 1.38 2008/02/27 22:10:34 jlam Exp $ .include "../../mk/bsd.fast.prefs.mk" BUILTIN_PKG:= gettext BUILTIN_FIND_LIBS:= intl -BUILTIN_FIND_FILES_VAR:= H_GETTEXT _BLTN_H_GETTEXT +BUILTIN_FIND_FILES_VAR:= H_GETTEXT H_NGETTEXT_GETTEXT \ + H_GLIBC_GETTEXT BUILTIN_FIND_FILES.H_GETTEXT= /usr/include/libintl.h -BUILTIN_FIND_FILES._BLTN_H_GETTEXT= /usr/include/libintl.h -.if ${OPSYS} != "Linux" BUILTIN_FIND_GREP.H_GETTEXT= \#define[ ]*__USE_GNU_GETTEXT -.endif +BUILTIN_FIND_FILES.H_NGETTEXT_GETTEXT= /usr/include/libintl.h +BUILTIN_FIND_GREP.H_NGETTEXT_GETTEXT= char.*ngettext +BUILTIN_FIND_FILES.H_GLIBC_GETTEXT= /usr/include/libintl.h +BUILTIN_FIND_GREP.H_GLIBC_GETTEXT= This file is part of the GNU C Library .include "../../mk/buildlink3/bsd.builtin.mk" @@ -28,22 +30,9 @@ IS_BUILTIN.gettext= yes .endif MAKEVARS+= IS_BUILTIN.gettext -.if !defined(BUILTIN_GETTEXT_NGETTEXT) -BUILTIN_GETTEXT_NGETTEXT= no -. if empty(_BLTN_H_GETTEXT:M__nonexistent__) -BUILTIN_GETTEXT_NGETTEXT!= \ - if ${GREP} -q "char.*ngettext" ${_BLTN_H_GETTEXT:Q}; then \ - ${ECHO} yes; \ - else \ - ${ECHO} no; \ - fi -. endif -.endif -MAKEVARS+= BUILTIN_GETTEXT_NGETTEXT - ### ### Determine whether we should use the built-in implementation if it -### exists, and uset USE_BUILTIN.<pkg> appropriate ("yes" or "no"). +### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no"). ### .if !defined(USE_BUILTIN.gettext) . if ${PREFER.gettext} == "pkgsrc" @@ -51,45 +40,38 @@ USE_BUILTIN.gettext= no . else USE_BUILTIN.gettext= ${IS_BUILTIN.gettext} . if defined(BUILTIN_PKG.gettext) && \ - !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) + !empty(IS_BUILTIN.gettext:M[yY][eE][sS]) USE_BUILTIN.gettext= yes . for _dep_ in ${BUILDLINK_API_DEPENDS.gettext} -. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) +. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) USE_BUILTIN.gettext!= \ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gettext:Q}; then \ ${ECHO} yes; \ else \ ${ECHO} no; \ fi -. endif +. endif . endfor . endif -. if !defined(_BLTN_REPLACE.gettext) -_BLTN_REPLACE.gettext= no # XXX # XXX By default, assume that the native gettext implementation is good # XXX enough to replace GNU gettext if it is part of glibc (the GNU C # XXX Library). # XXX -. if empty(_BLTN_H_GETTEXT:M__nonexistent__) -_BLTN_REPLACE.gettext!= \ - if ${GREP} -q "This file is part of the GNU C Library" ${_BLTN_H_GETTEXT:Q}; then \ - ${ECHO} yes; \ - else \ - ${ECHO} no; \ - fi -. endif -. endif -MAKEVARS+= _BLTN_REPLACE.gettext -. if !empty(_BLTN_REPLACE.gettext:M[yY][eE][sS]) +. if empty(H_GLIBC_GETTEXT:M__nonexistent__) && \ + empty(H_GLIBC_GETTEXT:M${LOCALBASE}/*) && \ + !empty(BUILTIN_LIB_FOUND.intl:M[nN][oO]) USE_BUILTIN.gettext= yes +H_GETTEXT= ${H_GLIBC_GETTEXT} . endif # XXX # XXX By default, assume that the native gettext implementation is good # XXX enough to replace GNU gettext if it supplies ngettext(). # XXX -. if !empty(BUILTIN_GETTEXT_NGETTEXT:M[yY][eE][sS]) +. if empty(H_NGETTEXT_GETTEXT:M__nonexistent__) && \ + empty(H_NGETTEXT_GETTEXT:M${LOCALBASE}/*) USE_BUILTIN.gettext= yes +H_GETTEXT= ${H_NGETTEXT_GETTEXT} . endif # # Some platforms don't have a gettext implementation that can replace @@ -105,6 +87,15 @@ USE_BUILTIN.gettext= no .endif MAKEVARS+= USE_BUILTIN.gettext +# Define BUILTIN_LIBNAME.gettext to be the base name of the built-in +# gettext library. +# +.if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS]) +BUILTIN_LIBNAME.gettext= intl +.else +BUILTIN_LIBNAME.gettext= # empty (part of the C library) +.endif + ### ### The section below only applies if we are not including this file ### solely to determine whether a built-in implementation exists. @@ -112,41 +103,13 @@ MAKEVARS+= USE_BUILTIN.gettext CHECK_BUILTIN.gettext?= no .if !empty(CHECK_BUILTIN.gettext:M[nN][oO]) -###################################################################### -# If we are using the builtin gettext implementation... -###################################################################### . if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) -. if ${BUILTIN_LIB_FOUND.intl} == "yes" -_BLTN_LIBINTL= -lintl -. else -_BLTN_LIBINTL= # empty -BUILDLINK_TRANSFORM+= rm:-lintl +BUILDLINK_LIBNAME.gettext= ${BUILTIN_LIBNAME.gettext} +. if empty(BUILTIN_LIBNAME.gettext) +BUILDLINK_TRANSFORM+= rm:-lintl . endif . endif -###################################################################### -# If we are using pkgsrc gettext implementation... -###################################################################### -. if !empty(USE_BUILTIN.gettext:M[nN][oO]) -_BLTN_LIBINTL= -lintl -_BLTN_LIBINTL+= ${BUILDLINK_LDADD.iconv} -. endif - -BUILDLINK_LDADD.gettext?= ${_BLTN_LIBINTL} - -# Some GNU configure scripts generated with an older and broken gettext.m4 -# fail to detect if gettext is present or not because it fails to add -# "-lintl" to the linker command line. -# -# If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" -# to LIBS to workaround this brokenness. -# -BROKEN_GETTEXT_DETECTION?= no -. if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) -BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} -CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" -. endif - # If using a built-in libintl that isn't from GNU gettext, then set up # some GNU configure variables that are checked by modern gettext.m4 # so that it will detect "GNU gettext" in the existing libintl. @@ -156,7 +119,8 @@ CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" . if !empty(BUILTIN_LIB_FOUND.intl:M[yY][eE][sS]) CONFIGURE_ENV+= gt_cv_func_gnugettext_libintl="yes" CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes" -. if !empty(BUILTIN_GETTEXT_NGETTEXT:M[yY][eE][sS]) +. if empty(H_NGETTEXT_GETTEXT:M__nonexistent__) && \ + empty(H_NGETTEXT_GETTEXT:M${LOCALBASE}/*) CONFIGURE_ENV+= gt_cv_func_gnugettext2_libintl="yes" . endif . endif |