--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig	2010-11-07 22:13:03 +0100
+++ hotspot/src/os/bsd/vm/os_bsd.cpp	2010-11-07 22:57:28 +0100
@@ -45,7 +45,7 @@
 # define EM_X86_64       62    /* AMD x86-64 architecture */
 # endif
 #endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 # include <elf.h>
 # include <pthread_np.h>
 #endif
@@ -57,8 +57,20 @@
 # define pthread_getprio(a) 0
 # define pthread_setprio(a, b) 0
 # define pthread_main_np() 0
+typedef struct link_map Link_map; /* Needed on at least NetBSD 5.0 */
 #endif
 
+/*
+ * XXX I have no idea why this is suddently needed.
+ * It built fine on NetBSD 4.99.54 and then began failing on 4.99.55.
+ * This definition usually lives in:
+ *   hotspot/src/share/vm/utilities/globalDefinitions.hpp
+ * But doesn't seem to be picked up anymore.
+ */
+#ifdef bool
+#undef bool
+#endif
+#define bool jint
 #ifndef timespecsub
 #define	timespecsub(tsp, usp, vsp)					\
 	do {								\
@@ -516,7 +528,7 @@
 #define getenv(n) ::getenv(n)
 
 #ifndef DEFAULT_LD_LIBRARY_PATH
-#define DEFAULT_LD_LIBRARY_PATH "/usr/lib" /* See ld.so.1(1) */
+#define DEFAULT_LD_LIBRARY_PATH "/usr/lib:%%PREFIX%%/lib:%%X11BASE%%/lib" /* See ld.so.1(1) */
 #endif
 #define EXTENSIONS_DIR "/lib/ext"
 #define ENDORSED_DIR "/lib/endorsed"
@@ -3008,7 +3020,7 @@
 
   // XXX ugly hack for 32-bit address space, since we know the
   // java heap is allocated with mmap() not sbrk():
-#if !defined(__OpenBSD__) && !defined(_LP64)
+#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(_LP64)
   // set the max datasegment size to something reasonable
   // complain if getrlimit/setrlimit fails but continue regardless. 
   struct rlimit dseg_size;
