From df9d334d80c20502c5e69282068e8632c5333862 Mon Sep 17 00:00:00 2001 From: jlam Date: Thu, 25 Nov 2004 21:33:36 +0000 Subject: dlopen.buildlink3.mk should be added to packages that use dlopen() to load shared objects. Some 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. Including dlopen.buildlink3.mk in a package Makefile will cause pthread.buildlink3.mk to also be included. It is up to the package to ensure that PTHREAD_{CFLAGS,LDFLAGS,LIBS} (defined by pthread.buildlink3.mk) are passed to the compiler when building/linking the applications, possibly by setting PTHREAD_AUTO_VARS to "yes" in the package Makefile. --- mk/dlopen.buildlink3.mk | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 mk/dlopen.buildlink3.mk (limited to 'mk/dlopen.buildlink3.mk') diff --git a/mk/dlopen.buildlink3.mk b/mk/dlopen.buildlink3.mk new file mode 100644 index 00000000000..40907688e82 --- /dev/null +++ b/mk/dlopen.buildlink3.mk @@ -0,0 +1,35 @@ +# $NetBSD: dlopen.buildlink3.mk,v 1.1 2004/11/25 21:33:37 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. + +.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 + +_DLOPEN_REQUIRE_PTHREADS?= no +.for _pattern_ in ${_DLOPEN_REQUIRE_PTHREAD_PLATFORMS} +. if !empty(MACHINE_PLATFORM:${_pattern_}) +_DLOPEN_REQUIRE_PTHREADS= yes +. endif +.endfor + +.if defined(DLOPEN_REQUIRE_PTHREADS) +_DLOPEN_REQUIRE_PTHREADS= ${DLOPEN_REQUIRE_PTHREADS} +.else +DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS} +.endif -- cgit v1.2.3