diff options
Diffstat (limited to 'devel/libgetopt/builtin.mk')
-rw-r--r-- | devel/libgetopt/builtin.mk | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/devel/libgetopt/builtin.mk b/devel/libgetopt/builtin.mk index 7c43be9e1c5..7f533d245c3 100644 --- a/devel/libgetopt/builtin.mk +++ b/devel/libgetopt/builtin.mk @@ -1,26 +1,67 @@ -# $NetBSD: builtin.mk,v 1.2 2004/03/29 05:43:30 jlam Exp $ +# $NetBSD: builtin.mk,v 1.3 2005/06/01 18:02:44 jlam Exp $ +BUILTIN_PKG:= getopt + +BUILTIN_FIND_FILES_VAR:= H_GETOPT +BUILTIN_FIND_FILES.H_GETOPT= /usr/include/getopt.h +BUILTIN_FIND_GREP.H_GETOPT= int.*getopt_long + +.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.getopt) IS_BUILTIN.getopt= no -. if exists(/usr/include/getopt.h) +. if empty(H_GETOPT:M${LOCALBASE}/*) && exists(${H_GETOPT}) IS_BUILTIN.getopt= yes . endif .endif # IS_BUILTIN.getopt +MAKEVARS+= IS_BUILTIN.getopt -USE_BUILTIN.getopt?= ${IS_BUILTIN.getopt} +### +### 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.getopt) +. if ${PREFER.getopt} == "pkgsrc" +USE_BUILTIN.getopt= no +. else +USE_BUILTIN.getopt= ${IS_BUILTIN.getopt} +. if defined(BUILTIN_PKG.getopt) && \ + !empty(IS_BUILTIN.getopt:M[yY][eE][sS]) +USE_BUILTIN.getopt= yes +. for _dep_ in ${BUILDLINK_DEPENDS.getopt} +. if !empty(USE_BUILTIN.getopt:M[yY][eE][sS]) +USE_BUILTIN.getopt!= \ + if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.getopt:Q}; then \ + ${ECHO} yes; \ + else \ + ${ECHO} no; \ + fi +. endif +. endfor +. endif +. endif # PREFER.getopt +.endif +MAKEVARS+= USE_BUILTIN.getopt +### +### The section below only applies if we are not including this file +### solely to determine whether a built-in implementation exists. +### CHECK_BUILTIN.getopt?= no .if !empty(CHECK_BUILTIN.getopt:M[nN][oO]) -.if !empty(USE_BUILTIN.getopt:M[nN][oO]) -LIBGETOPT= -lgetopt -.else -LIBGETOPT= # empty -.endif - -BUILDLINK_LDADD.getopt?= ${LIBGETOPT} +. if !empty(USE_BUILTIN.getopt:M[nN][oO]) +_BLNK_LIBGETOPT= -lgetopt +. else +_BLNK_LIBGETOPT= # empty +. endif +BUILDLINK_LDADD.getopt?= ${_BLNK_LIBGETOPT} -CONFIGURE_ENV+= LIBGETOPT="${LIBGETOPT}" -MAKE_ENV+= LIBGETOPT="${LIBGETOPT}" +CONFIGURE_ENV+= LIBGETOPT=${BUILDLINK_LDADD.getopt:Q} +MAKE_ENV+= LIBGETOPT=${BUILDLINK_LDADD.getopt:Q} .endif # CHECK_BUILTIN.getopt |