$NetBSD: patch-ac,v 1.7 2005/09/21 14:49:08 joerg Exp $

--- tclUnixInit.c.orig	2005-05-24 04:20:12.000000000 +0000
+++ tclUnixInit.c
@@ -19,7 +19,7 @@
 #ifdef HAVE_LANGINFO
 #include <langinfo.h>
 #endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #   include <floatingpoint.h>
 #endif
 #if defined(__bsdi__)
@@ -28,6 +28,11 @@
 #	include <dlfcn.h>
 #   endif
 #endif
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+#endif
 
 /*
  * The Init script (common to Windows and Unix platforms) is
@@ -203,7 +208,7 @@ TclpInitPlatform()
     (void) signal(SIGPIPE, SIG_IGN);
 #endif /* SIGPIPE */
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
     fpsetround(FP_RN);
     fpsetmask(0L);
 #endif
@@ -740,6 +745,11 @@ TclpSetVariables(interp)
     int unameOK;
     CONST char *user;
     Tcl_DString ds;
+#if defined(__NetBSD__)
+    char machine_arch[SYS_NMLN];
+    int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
+    size_t len = sizeof(machine_arch);
+#endif
 
 #ifdef HAVE_COREFOUNDATION
     char tclLibPath[MAXPATHLEN + 1];
@@ -842,8 +852,16 @@ TclpSetVariables(interp)
 	    Tcl_SetVar2(interp, "tcl_platform", "osVersion", name.release,
 		    TCL_GLOBAL_ONLY|TCL_APPEND_VALUE);
 	}
+#if defined(__NetBSD__)
+	if (sysctl(mib, sizeof(mib) / sizeof(int), machine_arch, &len, NULL, 0) < 0)
+	    unameOK = 0;
+	else
+	    Tcl_SetVar2(interp, "tcl_platform", "machine", machine_arch,
+		    TCL_GLOBAL_ONLY);
+#else
 	Tcl_SetVar2(interp, "tcl_platform", "machine", name.machine,
 		TCL_GLOBAL_ONLY);
+#endif
     }
 #endif
     if (!unameOK) {
