Add lang/perl5 early, but not specifically as part of BULK_PREREQ, so that
[pkgsrc.git] / mk / dlopen.builtin.mk
1 # $NetBSD: dlopen.builtin.mk,v 1.13 2005/06/09 05:59:51 jlam Exp $
2
3 BUILTIN_PKG:=   dl
4
5 BUILTIN_FIND_LIBS:=             dl
6 BUILTIN_FIND_FILES_VAR:=        H_DL
7 BUILTIN_FIND_FILES.H_DL=        /usr/include/dlfcn.h                    \
8                                 /opt/gcc.3.3/include/dlfcn.h
9
10 .include "../../mk/buildlink3/bsd.builtin.mk"
11
12 ###
13 ### Determine if there is a built-in implementation of the package and
14 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
15 ###
16 .if !defined(IS_BUILTIN.dl)
17 IS_BUILTIN.dl=  no
18 .  if empty(H_DL:M${LOCALBASE}/*) && exists(${H_DL})
19 IS_BUILTIN.dl=  yes
20 .  endif
21 .endif
22 MAKEVARS+=      IS_BUILTIN.dl
23
24 ###
25 ### Determine whether we should use the built-in implementation if it
26 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
27 ###
28 #
29 # We ignore the value of PREFER_PKGSRC and PREFER_NATIVE because for
30 # every platform except for Darwin-[56].*, we can only use the built-in
31 # dynamic linker functions, so USE_BUILTIN.dl must match IS_BUILTIN.dl.
32 #
33 .if !defined(USE_BUILTIN.dl)
34 USE_BUILTIN.dl=         ${IS_BUILTIN.dl}
35 .  if !empty(MACHINE_PLATFORM:MDarwin-[56].*)
36 USE_BUILTIN.dl=         no      # Darwin-[56].* uses devel/dlcompat
37 .  endif
38 .endif
39 MAKEVARS+=      USE_BUILTIN.dl
40
41 # The following platforms require pthreads to be linked into the
42 # application if it uses dlopen() or else the applications will core
43 # dump when they dlopen a shared module that _is_ linked with pthread
44 # support.
45 #
46 _BLNK_DLOPEN_REQUIRE_PTHREAD_PLATFORMS=                                 \
47         NetBSD-2.[0-9]_*-*                                              \
48         NetBSD-2.[0-9]-* NetBSD-2.[0-9].[0-9]*-*                        \
49         NetBSD-2.[0-8][0-9]*-* NetBSD-2.9[0-8]*-*                       \
50         NetBSD-2.99.[0-9]-* NetBSD-2.99.10-*
51
52 .if !defined(_BLNK_DLOPEN_REQUIRE_PTHREADS)
53 _BLNK_DLOPEN_REQUIRE_PTHREADS?= no
54 .  for _pattern_ in ${_BLNK_DLOPEN_REQUIRE_PTHREAD_PLATFORMS}
55 .    if !empty(MACHINE_PLATFORM:M${_pattern_})
56 .      if !empty(PREFER_NATIVE_PTHREADS:M[yY][eE][sS])
57 _BLNK_DLOPEN_REQUIRE_PTHREADS=  yes
58 .      endif
59 .    endif
60 .  endfor
61 .endif
62 MAKEVARS+=      _BLNK_DLOPEN_REQUIRE_PTHREADS
63 #
64 # DLOPEN_REQUIRE_PTHREADS is a user- and package-settable yes/no variable
65 #       whose value decides whether pthread.buildlink3.mk is automatically
66 #       included or not.  Its default value depends on whether native
67 #       pthreads exist.
68 #
69 .if defined(DLOPEN_REQUIRE_PTHREADS)
70 _BLNK_DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS}
71 .else
72 DLOPEN_REQUIRE_PTHREADS=        ${_BLNK_DLOPEN_REQUIRE_PTHREADS}
73 .endif
74
75 ###
76 ### The section below only applies if we are not including this file
77 ### solely to determine whether a built-in implementation exists.
78 ###
79 CHECK_BUILTIN.dl?=      no
80 .if !empty(CHECK_BUILTIN.dl:M[nN][oO])
81
82 .  if !empty(USE_BUILTIN.dl:M[yY][eE][sS])
83 BUILDLINK_PREFIX.dl=    /usr
84 .    if !empty(BUILTIN_LIB_FOUND.dl:M[yY][eE][sS])
85 #
86 # No need to add this to BUILDLINK_LIBS.dl since most GNU configure
87 # scripts already check for -ldl themselves.
88 #
89 BUILDLINK_LDADD.dl=     -ldl
90 .    endif
91 .    if !empty(_BLNK_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS])
92 BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
93 .      include "../../mk/pthread.buildlink3.mk"
94 BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
95 .      include "../../mk/pthread.builtin.mk"
96 BUILDLINK_CFLAGS.dl+=   ${PTHREAD_CFLAGS}
97 BUILDLINK_LDFLAGS.dl+=  ${PTHREAD_LDFLAGS}
98 BUILDLINK_LIBS.dl+=     ${PTHREAD_LIBS}
99 .    endif
100 .  endif
101
102 .endif  # CHECK_BUILTIN.dl