diff options
author | jlam <jlam@pkgsrc.org> | 2004-11-26 07:05:19 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-11-26 07:05:19 +0000 |
commit | 825f6216b4de2cda7ca47ff3e9fb4c3900b244bf (patch) | |
tree | e90c32f5bfe7fcc686d323ddfdc28bb7e004e5a4 /mk | |
parent | a6a81db9db1f54bf153b1f982cc74ed1e9fe3395 (diff) | |
download | pkgsrc-825f6216b4de2cda7ca47ff3e9fb4c3900b244bf.tar.gz |
Split dlopen.buildlink3.mk into two files: dlopen.buildlink3.mk, which
is included by packages that use dlopen(), and dlopen.builtin.mk,
which checks for the presence of built-in dl*() functions. On Darwin,
including dlopen.buildlink3.mk will cause the devel/dlcompat package
to be used if the base system lacks a dlcompat library.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/dlopen.buildlink3.mk | 55 | ||||
-rw-r--r-- | mk/dlopen.builtin.mk | 79 |
2 files changed, 98 insertions, 36 deletions
diff --git a/mk/dlopen.buildlink3.mk b/mk/dlopen.buildlink3.mk index 244133b76b2..345cb3109a7 100644 --- a/mk/dlopen.buildlink3.mk +++ b/mk/dlopen.buildlink3.mk @@ -1,41 +1,30 @@ -# $NetBSD: dlopen.buildlink3.mk,v 1.6 2004/11/26 01:58:47 jlam Exp $ +# $NetBSD: dlopen.buildlink3.mk,v 1.7 2004/11/26 07:05:19 jlam Exp $ # # This Makefile fragment is included by package Makefiles and # buildlink3.mk files for the packages that use dlopen(). # -# DLOPEN_REQUIRE_PTHREADS is a user- and package-settable yes/no variable -# whose value decides whether pthread.buildlink3.mk is automatically -# included or not. Its default value depends on whether native -# pthreads exist. -# -# Including pthread.buildlink3.mk is deferred until bsd.pkg.mk. -# DLOPEN_BUILDLINK3_MK:= ${DLOPEN_BUILDLINK3_MK}+ .include "../../mk/bsd.prefs.mk" -# 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= \ - NetBSD-2.[0-9]-* NetBSD-2.[0-8][0-9]*-* NetBSD-2.9[0-8]*-* \ - NetBSD-2.99.[0-9]-* NetBSD-2.99.10-* +.if !empty(DLOPEN_BUILDLINK3_MK:M+) +CHECK_BUILTIN.dl:= yes +.include "../../mk/dlopen.builtin.mk" +CHECK_BUILTIN.dl:= no +.endif # DLOPEN_BUILDLINK3_MK -_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 -. endif -. endif -.endfor +DL_AUTO_VARS?= no -.if defined(DLOPEN_REQUIRE_PTHREADS) -_DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS} +.if !empty(USE_BUILTIN.dl) +BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ndl} +BUILDLINK_PACKAGES+= dl +BUILDLINK_BUILTIN_MK.dl= ../../mk/dlopen.builtin.mk +BUILDLINK_AUTO_VARS.dl= ${DL_AUTO_VARS} +.elif ${OPSYS} == "Darwin" +. include "../../devel/dlcompat/buildlink3.mk" +BUILDLINK_AUTO_VARS.dlcompat= ${DL_AUTO_VARS} .else -DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS} +PKG_SKIP_REASON= "${PKGNAME} requires a working dlopen()." .endif .if !empty(DLOPEN_BUILDLINK3_MK:M+) @@ -43,15 +32,9 @@ DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS} # Define user-visible DL_{CFLAGS,LDFLAGS,LIBS} as compiler options used # to compile/link code that uses dl*() functions. # -. if !empty(_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS]) -DL_CFLAGS= ${PTHREAD_CFLAGS} -DL_LDFLAGS= ${PTHREAD_LDFLAGS} -DL_LIBS= ${PTHREAD_LIBS} -. else -DL_CFLAGS= # empty -DL_LDFLAGS= # empty -DL_LIBS= # empty -. endif +DL_CFLAGS= ${BUILDLINK_CFLAGS.dl} +DL_LDFLAGS= ${BUILDLINK_LDFLAGS.dl} +DL_LIBS= ${BUILDLINK_LIBS.dl} CONFIGURE_ENV+= DL_CFLAGS="${DL_CFLAGS}" CONFIGURE_ENV+= DL_LDFLAGS="${DL_LDFLAGS}" CONFIGURE_ENV+= DL_LIBS="${DL_LIBS}" diff --git a/mk/dlopen.builtin.mk b/mk/dlopen.builtin.mk new file mode 100644 index 00000000000..09600d6b6d2 --- /dev/null +++ b/mk/dlopen.builtin.mk @@ -0,0 +1,79 @@ +# $NetBSD: dlopen.builtin.mk,v 1.1 2004/11/26 07:05:19 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} "no"; \ + elif ${TEST} "`${ECHO} /lib/lib${_lib_}.*`" = "/lib/lib${_lib_}.*"; then \ + ${ECHO} "no"; \ + else \ + ${ECHO} "yes"; \ + fi +BUILDLINK_VARS+= _BLNK_LIB_FOUND.${_lib_} +. endif +.endfor +.undef _lib_ + +.if !defined(IS_BUILTIN.dl) +IS_BUILTIN.dl= no +. if exists(/usr/include/dlfcn.h) +IS_BUILTIN.dl= yes +. endif +BUILDLINK_VARS+= IS_BUILTIN.dl +.endif # IS_BUILTIN.pthread + +.if !defined(USE_BUILTIN.dl) +USE_BUILTIN.dl= ${IS_BUILTIN.dl} +. if ${OPSYS} == "Darwin" +USE_BUILTIN.dl= no # Darwin uses devel/dlcompat +. endif +.endif + +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]) +BUILDLINK_LIBS.dl= -ldl +. endif +# +# 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= \ + NetBSD-2.[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 +. endif +. endif +. endfor +# +# DLOPEN_REQUIRE_PTHREADS is a user- and package-settable yes/no variable +# whose value decides whether pthread.buildlink3.mk is automatically +# included or not. Its default value depends on whether native +# pthreads exist. +# +# Including pthread.buildlink3.mk is deferred until bsd.pkg.mk. +# +. if defined(DLOPEN_REQUIRE_PTHREADS) +_DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS} +. else +DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS} +. endif +. if !empty(_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS]) +BUILDLINK_CFLAGS.dl+= ${PTHREAD_CFLAGS} +BUILDLINK_LDFLAGS.dl+= ${PTHREAD_LDFLAGS} +BUILDLINK_LIBS.dl+= ${PTHREAD_LIBS} +. endif +. endif # USE_BUILTIN.dl == yes + +.endif # CHECK_BUILTIN.dl |