tNetBSD support.  Thanks to Christoph Lohmann. - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5ba33c04daeca7f84d0d0148725e593a0c672343
 (DIR) parent be9e0e98579e6dec33814f1074d22943eb87ef2b
 (HTM) Author: rsc <devnull@localhost>
       Date:   Mon, 28 Mar 2005 15:58:14 +0000
       
       NetBSD support.  Thanks to Christoph Lohmann.
       
       Diffstat:
         M include/geometry.h                  |       7 ++++++-
         M include/u.h                         |       8 ++++++++
         M man/man3/quaternion.3               |       7 +++++++
         M src/libthread/mkfile                |       4 +++-
         M src/libthread/sysofiles.sh          |       3 +++
       
       5 files changed, 27 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/include/geometry.h b/include/geometry.h
       t@@ -59,7 +59,7 @@ Quaternion qadd(Quaternion, Quaternion);
        Quaternion qsub(Quaternion, Quaternion);
        Quaternion qneg(Quaternion);
        Quaternion qmul(Quaternion, Quaternion);
       -Quaternion qdiv(Quaternion, Quaternion);
       +Quaternion p9qdiv(Quaternion, Quaternion);
        Quaternion qunit(Quaternion);
        Quaternion qinv(Quaternion);
        double qlen(Quaternion);
       t@@ -94,6 +94,11 @@ Point3 xformpoint(Point3, Space *, Space *);
        Point3 xformpointd(Point3, Space *, Space *);
        Point3 xformplane(Point3, Space *, Space *);
        #define        radians(d)        ((d)*.01745329251994329572)
       +
       +#ifndef NOPLAN9DEFINES
       +#define        qdiv        p9qdiv        /* for NetBSD */
       +#endif
       +
        #if defined(__cplusplus)
        }
        #endif
 (DIR) diff --git a/include/u.h b/include/u.h
       t@@ -8,6 +8,7 @@ extern "C" {
        #define __EXTENSIONS__ 1 /* SunOS */
        /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
        #define _BSD_SOURCE 1
       +#define _NETBSD_SOURCE 1        /* NetBSD */
        #define _SVID_SOURCE 1
        #define _XOPEN_SOURCE 1000
        #define _XOPEN_SOURCE_EXTENDED 1
       t@@ -74,6 +75,13 @@ typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
        #        undef _NEEDUSHORT
        #        undef _NEEDUINT
        #        define _NEEDLL 1
       +#elif defined(__NetBSD__)
       +#        include <sched.h>
       +#        include <sys/types.h>
       +#        undef _NEEDUSHORT
       +#        undef _NEEDUINT
       +#        undef _NEEDULONG
       +#        undef PLAN9PORT_USING_PTHREADS
        #else
                /* No idea what system this is -- try some defaults */
        #        include <pthread.h>
 (DIR) diff --git a/man/man3/quaternion.3 b/man/man3/quaternion.3
       t@@ -150,3 +150,10 @@ This is just a rotation about the same axis by half the angle.
        .SH SEE ALSO
        .IR matrix (3),
        .IR qball (3)
       +.SH BUGS
       +To avoid name conflicts with NetBSD,
       +.I qdiv
       +is a preprocessor macro defined as 
       +.IR p9qdiv ;
       +see
       +.IR intro (3).
 (DIR) diff --git a/src/libthread/mkfile b/src/libthread/mkfile
       t@@ -24,7 +24,9 @@ tspawnloop: tspawnloop.$O
                9l -o $target $target.$O $PLAN9/lib/$LIB -l9 -lpthread
        
        %.$O: %.c
       -        9c -I. $stem.c
       +        $CC -I. $stem.c
       +
       +NetBSD.$O: Linux.c
        
        test:V: tprimes tspawn
                primes 1 10007 >p1.txt
 (DIR) diff --git a/src/libthread/sysofiles.sh b/src/libthread/sysofiles.sh
       t@@ -17,6 +17,9 @@ case "$tag" in
        *-FreeBSD-*)
                echo $SYSNAME.o ${SYSNAME}asm.o
                ;;
       +*-NetBSD-*)
       +        echo $SYSNAME.o ${SYSNAME}asm.o
       +        ;;
        *-Darwin-*)
                echo ${SYSNAME}-${OBJTYPE}-asm.o ${SYSNAME}-${OBJTYPE}.o pthread.o
                ;;