update Thu Jun 17 12:37:00 PDT 2010
authorCharlie <root@crater.dragonflybsd.org>
Thu, 17 Jun 2010 19:44:29 +0000 (12:44 -0700)
committerCharlie <root@crater.dragonflybsd.org>
Thu, 17 Jun 2010 19:44:29 +0000 (12:44 -0700)
databases/sqlite3/Makefile
mk/dlopen.builtin.mk

index 1c7b9d9..63e57b6 100644 (file)
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.27 2010/04/01 12:01:53 tnn Exp $
+# $NetBSD: Makefile,v 1.28 2010/06/17 13:45:36 obache Exp $
 
 DISTNAME=      sqlite-amalgamation-3.6.23.1
 PKGNAME=       ${DISTNAME:S/sqlite-amalgamation/sqlite3/}
@@ -23,6 +23,13 @@ PKGCONFIG_OVERRIDE+= sqlite3.pc.in
 INSTALLATION_DIRS+=    ${PKGMANDIR}/man1
 CONFIGURE_ARGS+=       --with-readline-inc= --enable-threadsafe
 
+.include "../../mk/bsd.prefs.mk"
+
+# Darwin < 9 (Mac OS X < 10.5 "Leopard") doesn't have gethostuuid(2)
+.if !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+CFLAGS+=               -DSQLITE_ENABLE_LOCKING_STYLE=0
+.endif
+
 # Uses dlopen and friends but doesn't use -ldl on Linux.
 # See http://www.sqlite.org/cvstrac/tktview?tn=3555
 LIBS+=                 ${BUILDLINK_LDADD.dl}
index a0914af..0e89435 100644 (file)
@@ -1,4 +1,4 @@
-# $NetBSD: dlopen.builtin.mk,v 1.21 2010/06/16 19:57:08 drochner Exp $
+# $NetBSD: dlopen.builtin.mk,v 1.22 2010/06/17 18:09:40 drochner Exp $
 
 BUILTIN_PKG:=  dl
 
@@ -38,6 +38,44 @@ USE_BUILTIN.dl=              no      # Darwin-[56].* uses devel/dlcompat
 .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.
+# It is not required for NetBSD>=5 if just linked with pthread or using
+# pthread_mutex_*(), but need if using pthread_create() / pthread_join().
+#
+_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-*                            \
+       NetBSD-[3-9]*-*                                                 \
+       NetBSD-[1-9][0-9]*-*
+
+.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
+.  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
+#      included or not.  Its default value depends on whether native
+#      pthreads exist.
+#
+.if defined(DLOPEN_REQUIRE_PTHREADS)
+_BLNK_DLOPEN_REQUIRE_PTHREADS:=        ${DLOPEN_REQUIRE_PTHREADS}
+.else
+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.
@@ -54,6 +92,13 @@ BUILDLINK_PREFIX.dl= /usr
 #
 BUILDLINK_LDADD.dl=    -ldl
 .    endif
+.    if !empty(_BLNK_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS])
+.      include "../../mk/pthread.buildlink3.mk"
+.      include "../../mk/pthread.builtin.mk"
+BUILDLINK_CFLAGS.dl+=  ${PTHREAD_CFLAGS}
+BUILDLINK_LDFLAGS.dl+= ${PTHREAD_LDFLAGS}
+BUILDLINK_LIBS.dl+=    ${PTHREAD_LIBS}
+.    endif
 .  endif
 
 .endif # CHECK_BUILTIN.dl