Pullup ticket #2800.
[pkgsrc.git] / mk / curses.builtin.mk
1 # $NetBSD: curses.builtin.mk,v 1.4 2008/02/27 06:14:23 jlam Exp $
2
3 BUILTIN_PKG:=   curses
4
5 BUILTIN_FIND_LIBS:=             curses
6 BUILTIN_FIND_FILES_VAR:=        H_CURSES
7 BUILTIN_FIND_FILES.H_CURSES=    /usr/include/curses.h
8
9 .include "buildlink3/bsd.builtin.mk"
10
11 ###
12 ### Determine if there is a built-in implementation of the package and
13 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
14 ###
15 .if !defined(IS_BUILTIN.curses)
16 IS_BUILTIN.curses=      no
17 .  if empty(H_CURSES:M${LOCALBASE}/*) && exists(${H_CURSES})
18 IS_BUILTIN.curses=      yes
19 .  endif
20 .endif
21 MAKEVARS+=      IS_BUILTIN.curses
22
23 ###
24 ### Determine whether we should use the built-in implementation if it
25 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
26 ###
27 .if !defined(USE_BUILTIN.curses)
28 .  if ${PREFER.curses} == "pkgsrc"
29 USE_BUILTIN.curses=     no
30 .  else
31 USE_BUILTIN.curses=     ${IS_BUILTIN.curses}
32 .    if defined(BUILTIN_PKG.curses) && !empty(IS_BUILTIN.curses:M[yY][eE][sS])
33 USE_BUILTIN.curses=     yes
34 .      for _dep_ in ${BUILDLINK_API_DEPENDS.curses}
35 .        if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
36 USE_BUILTIN.curses!=                                                    \
37         if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.curses:Q}; then \
38                 ${ECHO} yes;                                            \
39         else                                                            \
40                 ${ECHO} no;                                             \
41         fi
42 .        endif
43 .      endfor
44 .    endif
45 .  endif  # PREFER.curses
46 .endif
47 MAKEVARS+=      USE_BUILTIN.curses
48
49 # Define BUILTIN_LIBNAME.curses to be the base name of the built-in
50 # curses library.
51 #
52 .if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
53 BUILTIN_LIBNAME.curses=         curses
54 .endif
55
56 ###
57 ### The section below only applies if we are not including this file
58 ### solely to determine whether a built-in implementation exists.
59 ###
60 CHECK_BUILTIN.curses?=  no
61 .if !empty(CHECK_BUILTIN.curses:M[nN][oO])
62
63 .  if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
64 .    if exists(${H_CURSES})
65 BUILDLINK_INCDIRS.curses?=      ${H_CURSES:H:S/^${BUILDLINK_PREFIX.curses}\///}
66 .    endif
67 BUILDLINK_LIBNAME.curses=       ${BUILTIN_LIBNAME.curses}
68 .  endif
69
70 .endif  # CHECK_BUILTIN.curses