$NetBSD: patch-aa,v 1.25 2010/09/16 18:56:12 wiz Exp $

--- configure.orig	2010-09-04 09:39:21.000000000 +0000
+++ configure
@@ -1471,6 +1471,9 @@ if test -z "$_target" ; then
    powerpc) # Darwin returns 'powerpc'
      host_arch=ppc
      ;;
+   mipseb|mipsel) # NetBSD
+     host_arch=mips
+     ;;
    *) # uname -p on Linux returns 'unknown' for the processor type,
       # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
 
@@ -1645,7 +1648,7 @@ else
       cc_name=$cc_name_tmp
       echocheck "$_cc version"
       cc_vendor=gnu
-      cc_version=$($_cc -dumpversion 2>&1)
+      cc_version=$( ( $_cc -dumpversion | sed -e 's/-nb[0-9]//' ) 2>&1 )
       case $cc_version in
         2.96*)
           cc_fail=yes
@@ -1763,7 +1766,7 @@ if x86 ; then
   # gather more CPU information
   pname=$($_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1)
   pvendor=$($_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2  | cut -d ' ' -f 2 | head -n 1)
-  pfamily=$($_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
+  pfamily=$($_cpuinfo | grep -i 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
   pmodel=$($_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
   pstepping=$($_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
 
@@ -3710,7 +3713,6 @@ test "$_w32threads" = yes && def_threads
 echores "$_w32threads"
 
 echocheck "rpath"
-netbsd &&_rpath=yes
 if test "$_rpath" = yes ; then
   for I in $(echo $extra_ldflags | sed 's/-L//g') ; do
     tmp="$tmp $(echo $I | sed 's/.*/ -L& -Wl,-R&/')"
@@ -3975,7 +3977,6 @@ echores "$_vsscanf"
 
 echocheck "swab()"
 cat > $TMPC << EOF
-#define _XOPEN_SOURCE 600
 #include <unistd.h>
 int main(void) { swab(0, 0, 0); return 0; }
 EOF
@@ -4456,7 +4457,11 @@ EOF
            -L/usr/X11/lib -L/usr/lib32 -L/usr/openwin/lib -L/usr/local/lib64 -L/usr/X11R6/lib64 \
            -L/usr/lib ; do
     if netbsd; then
-      _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R$(echo $I | sed s/^-L//)"
+      if test -n "$I" ; then
+        _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R$(echo $I | sed s/^-L//)"
+      else
+        _ld_tmp="-lXext -lX11 $_ld_pthread"
+      fi
     else
       _ld_tmp="$I -lXext -lX11 $_ld_pthread"
     fi
@@ -5591,8 +5596,13 @@ if test "$_ivtv" = auto ; then
   cat > $TMPC << EOF
 #include <stdlib.h>
 #include <inttypes.h>
++#ifdef __linux__
 #include <linux/types.h>
 #include <linux/videodev2.h>
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+#include <sys/types.h>
+#include <sys/videoio.h>
+#endif
 #include <linux/ivtv.h>
 #include <sys/ioctl.h>
 int main(void) {
@@ -8052,7 +8062,7 @@ echores "$_tv_v4l1"
 echocheck "Video 4 Linux 2 TV interface"
 if test "$_tv_v4l2" = auto ; then
   _tv_v4l2=no
-  if test "$_tv" = yes && linux ; then
+  if test "$_tv" = yes && (linux || netbsd || openbsd) ; then
     header_check linux/videodev2.h && _tv_v4l2=yes
   fi
 fi
