summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-11-26 01:56:17 +0000
committerjlam <jlam@pkgsrc.org>2004-11-26 01:56:17 +0000
commita3af230352c3ec76dadfbf16aef611760c089c06 (patch)
tree0fc2f4e6d601389f0b6c9d1f444eb9a692f09b16 /mk
parentf551f31daff60d5fba83108eef6e12705cf6b333 (diff)
downloadpkgsrc-a3af230352c3ec76dadfbf16aef611760c089c06.tar.gz
Define DL_{CFLAGS,LDFLAGS,LIBS} as compiler/linker flags for building
or linking code that uses dl*() functions. Also re-structure a bit to pave the way for a future dlopen.builtin.mk that handles -ldl on some platforms and dlcompat on Darwin.
Diffstat (limited to 'mk')
-rw-r--r--mk/dlopen.buildlink3.mk26
1 files changed, 25 insertions, 1 deletions
diff --git a/mk/dlopen.buildlink3.mk b/mk/dlopen.buildlink3.mk
index 30d9de3b4f4..8c2d8cd0bfe 100644
--- a/mk/dlopen.buildlink3.mk
+++ b/mk/dlopen.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: dlopen.buildlink3.mk,v 1.4 2004/11/26 01:40:42 jlam Exp $
+# $NetBSD: dlopen.buildlink3.mk,v 1.5 2004/11/26 01:56:17 jlam Exp $
#
# This Makefile fragment is included by package Makefiles and
# buildlink3.mk files for the packages that use dlopen().
@@ -9,6 +9,8 @@
# pthreads exist.
#
# Including pthread.buildlink3.mk is deferred until bsd.pkg.mk.
+#
+DLOPEN_BUILDLINK3_MK:= ${DLOPEN_BUILDLINK3_MK}+
.include "../../mk/bsd.prefs.mk"
@@ -35,3 +37,25 @@ _DLOPEN_REQUIRE_PTHREADS:= ${DLOPEN_REQUIRE_PTHREADS}
.else
DLOPEN_REQUIRE_PTHREADS= ${_DLOPEN_REQUIRE_PTHREADS}
.endif
+
+.if !empty(DLOPEN_BUILDLINK3_MK:M+)
+#
+# 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
+CONFIGURE_ENV+= DL_CFLAGS="${DL_CFLAGS}"
+CONFIGURE_ENV+= DL_LDFLAGS="${DL_LDFLAGS}"
+CONFIGURE_ENV+= DL_LIBS="${DL_LIBS}"
+MAKE_ENV+= DL_CFLAGS="${DL_CFLAGS}"
+MAKE_ENV+= DL_LDFLAGS="${DL_LDFLAGS}"
+MAKE_ENV+= DL_LIBS="${DL_LIBS}"
+.endif # DLOPEN_BUILDLINK3_MK