summaryrefslogtreecommitdiff
path: root/mk/dlopen.buildlink3.mk
diff options
context:
space:
mode:
authorjlam <jlam>2004-11-25 21:33:36 +0000
committerjlam <jlam>2004-11-25 21:33:36 +0000
commit2a359666fe48e82f3a7893661bbad2607204b15c (patch)
treefbde1b1b76ee7c6985a9504e23c69509d4bf8721 /mk/dlopen.buildlink3.mk
parent57d19c012b34558f3fdeb559a8cb5f1ef52a2e8f (diff)
downloadpkgsrc-2a359666fe48e82f3a7893661bbad2607204b15c.tar.gz
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.
Diffstat (limited to 'mk/dlopen.buildlink3.mk')
-rw-r--r--mk/dlopen.buildlink3.mk35
1 files changed, 35 insertions, 0 deletions
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