diff options
Diffstat (limited to 'mk/dlopen.builtin.mk')
-rw-r--r-- | mk/dlopen.builtin.mk | 102 |
1 files changed, 65 insertions, 37 deletions
diff --git a/mk/dlopen.builtin.mk b/mk/dlopen.builtin.mk index be0c1e54a81..29e6660c4c4 100644 --- a/mk/dlopen.builtin.mk +++ b/mk/dlopen.builtin.mk @@ -1,54 +1,78 @@ -# $NetBSD: dlopen.builtin.mk,v 1.10 2005/01/20 15:22:39 jlam Exp $ +# $NetBSD: dlopen.builtin.mk,v 1.11 2005/06/01 18:03:06 jlam Exp $ -.for _lib_ in dl -. if !defined(_BLNK_LIB_FOUND.${_lib_}) -_BLNK_LIB_FOUND.${_lib_}!= \ - if ${TEST} "`${ECHO} /usr/lib/lib${_lib_}.*`" != "/usr/lib/lib${_lib_}.*"; then \ - ${ECHO} "yes"; \ - elif ${TEST} "`${ECHO} /lib/lib${_lib_}.*`" != "/lib/lib${_lib_}.*"; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi -BUILDLINK_VARS+= _BLNK_LIB_FOUND.${_lib_} -. endif -.endfor -.undef _lib_ +BUILTIN_PKG:= dl + +BUILTIN_FIND_LIBS:= dl +BUILTIN_FIND_FILES_VAR:= H_DL +BUILTIN_FIND_FILES.H_DL= /usr/include/dlfcn.h \ + /opt/gcc.3.3/include/dlfcn.h +.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.dl) -IS_BUILTIN.dl= no -. if exists(/usr/include/dlfcn.h) || exists(/opt/gcc.3.3/include/dlfcn.h) -IS_BUILTIN.dl= yes +IS_BUILTIN.dl= no +. if empty(H_DL:M${LOCALBASE}/*) && exists(${H_DL}) +IS_BUILTIN.dl= yes . endif -BUILDLINK_VARS+= IS_BUILTIN.dl -.endif # IS_BUILTIN.pthread +.endif +MAKEVARS+= IS_BUILTIN.dl +### +### 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.dl) -USE_BUILTIN.dl= ${IS_BUILTIN.dl} -. if ${OPSYS} == "Darwin" +. if ${PREFER.dl} == "pkgsrc" +USE_BUILTIN.dl= no +. else +USE_BUILTIN.dl= ${IS_BUILTIN.dl} +. if defined(BUILTIN_PKG.dl) && \ + !empty(IS_BUILTIN.dl:M[yY][eE][sS]) +USE_BUILTIN.dl= yes +. for _dep_ in ${BUILDLINK_DEPENDS.dl} +. if !empty(USE_BUILTIN.dl:M[yY][eE][sS]) +USE_BUILTIN.dl!= \ + if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.dl:Q}; then \ + ${ECHO} yes; \ + else \ + ${ECHO} no; \ + fi +. endif +. endfor +. endif +. if ${OPSYS} == "Darwin" USE_BUILTIN.dl= no # Darwin uses devel/dlcompat -. endif +. endif +. endif # PREFER.dl .endif -# +MAKEVARS+= USE_BUILTIN.dl + # The following platforms require pthreads to be linked into the # application if it uses dlopen() or else the applications will core # dump when they dlopen a shared module that _is_ linked with pthread # support. # -_DLOPEN_REQUIRE_PTHREAD_PLATFORMS= \ +_BLNK_DLOPEN_REQUIRE_PTHREAD_PLATFORMS= \ NetBSD-2.[0-9]_*-* \ NetBSD-2.[0-9]-* NetBSD-2.[0-9].[0-9]*-* \ NetBSD-2.[0-8][0-9]*-* NetBSD-2.9[0-8]*-* \ NetBSD-2.99.[0-9]-* NetBSD-2.99.10-* -_DLOPEN_REQUIRE_PTHREADS?= no -.for _pattern_ in ${_DLOPEN_REQUIRE_PTHREAD_PLATFORMS} -. if !empty(MACHINE_PLATFORM:M${_pattern_}) -. if !empty(PREFER_NATIVE_PTHREADS:M[yY][eE][sS]) -_DLOPEN_REQUIRE_PTHREADS= yes +.if !defined(_BLNK_DLOPEN_REQUIRE_PTHREADS) +_BLNK_DLOPEN_REQUIRE_PTHREADS?= no +. for _pattern_ in ${_BLNK_DLOPEN_REQUIRE_PTHREAD_PLATFORMS} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) +. if !empty(PREFER_NATIVE_PTHREADS:M[yY][eE][sS]) +_BLNK_DLOPEN_REQUIRE_PTHREADS= yes +. endif . endif -. endif -.endfor +. endfor +.endif +MAKEVARS+= _BLNK_DLOPEN_REQUIRE_PTHREADS # # DLOPEN_REQUIRE_PTHREADS is a user- and package-settable yes/no variable # whose value decides whether pthread.buildlink3.mk is automatically @@ -56,24 +80,28 @@ _DLOPEN_REQUIRE_PTHREADS= yes # pthreads exist. # .if defined(DLOPEN_REQUIRE_PTHREADS) -_DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS} +_BLNK_DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS} .else -DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS} +DLOPEN_REQUIRE_PTHREADS= ${_BLNK_DLOPEN_REQUIRE_PTHREADS} .endif +### +### The section below only applies if we are not including this file +### solely to determine whether a built-in implementation exists. +### CHECK_BUILTIN.dl?= no .if !empty(CHECK_BUILTIN.dl:M[nN][oO]) . if !empty(USE_BUILTIN.dl:M[yY][eE][sS]) BUILDLINK_PREFIX.dl= /usr -. if !empty(_BLNK_LIB_FOUND.dl:M[yY][eE][sS]) +. if !empty(BUILTIN_LIB_FOUND.dl:M[yY][eE][sS]) # # No need to add this to BUILDLINK_LIBS.dl since most GNU configure # scripts already check for -ldl themselves. # BUILDLINK_LDADD.dl= -ldl . endif -. if !empty(_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS]) +. if !empty(_BLNK_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS]) BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ . include "../../mk/pthread.buildlink3.mk" BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} @@ -82,6 +110,6 @@ BUILDLINK_CFLAGS.dl+= ${PTHREAD_CFLAGS} BUILDLINK_LDFLAGS.dl+= ${PTHREAD_LDFLAGS} BUILDLINK_LIBS.dl+= ${PTHREAD_LIBS} . endif -. endif # USE_BUILTIN.dl == yes +. endif .endif # CHECK_BUILTIN.dl |