$NetBSD$

--- configure.orig	2004-12-30 22:15:48.000000000 +0000
+++ configure
@@ -23,7 +23,9 @@ ac_help="$ac_help
 ac_help="$ac_help
   --with(out)-aido        Use a shared memory area for output (default: without)"
 ac_help="$ac_help
-  --with(out)-assembler   Use assembler cores if available (default: with)"
+  --with(out)-assembler   Use assembler cores if available (default: without)"
+ac_help="$ac_help
+  --with(out)-mmx         Use MMX if available (default: without)"
 ac_help="$ac_help
   --with(out)-joystick    Enable joystick support if available (default: with)"
 ac_help="$ac_help
@@ -45,7 +47,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   --with-x                use the X Window System"
 ac_help="$ac_help
-  --with(out)-extensions  Use DGA- and vidmode-extensions for X11 if avilable (default: with)"
+  --with(out)-extensions  Use DGA- and vidmode-extensions for X11 if avilable (default: without)"
 ac_help="$ac_help
   --with(out)-sound       Enable sound if available (default: with)"
 
@@ -2995,6 +2997,74 @@ fi
 
 echo "$ac_t""$snes9x_cv_linux_os" 1>&6
 
+echo $ac_n "checking if the OS is NetBSD""... $ac_c" 1>&6
+echo "configure:2966: checking if the OS is NetBSD" >&5
+if eval "test \"`echo '$''{'snes9x_cv_netbsd_os'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  cat > conftest.$ac_ext <<EOF
+#line 2972 "configure"
+#include "confdefs.h"
+
+#ifdef __NetBSD__
+/* */
+#else
+#error Not NetBSD.
+#endif
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  snes9x_cv_netbsd_os=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  snes9x_cv_netbsd_os=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$snes9x_cv_netbsd_os" 1>&6
+
+echo $ac_n "checking if the OS is DragonFly""... $ac_c" 1>&6
+echo "configure:2966: checking if the OS is DragonFly" >&5
+if eval "test \"`echo '$''{'snes9x_cv_dragonfly_os'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  cat > conftest.$ac_ext <<EOF
+#line 2972 "configure"
+#include "confdefs.h"
+
+#ifdef __DragonFly__
+/* */
+#else
+#error Not DragonFly.
+#endif
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  snes9x_cv_dragonfly_os=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  snes9x_cv_dragonfly_os=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$snes9x_cv_dragonfly_os" 1>&6
+
 echo $ac_n "checking if the OS is HP-UX""... $ac_c" 1>&6
 echo "configure:3000: checking if the OS is HP-UX" >&5
 if eval "test \"`echo '$''{'snes9x_cv_hpux_os'+set}'`\" = set"; then
@@ -3069,7 +3139,7 @@ if test "${with_assembler+set}" = set; t
   withval="$with_assembler"
   :
 else
-  with_assembler=yes
+  with_assembler=no
 fi
 
 
@@ -3141,7 +3211,6 @@ if test $NASM != "not_found"; then
   ZSNESFX='ZSNESFX=1'
   ZSNESC4='ZSNESC4=1'
   ASMCPU='ASMCPU=1'
-  ASMKREED='ASMKREED=1'
 #  SPC700ASM='SPC700ASM=1'
   I386SPC='i386/SPC.O'
   CPUINC='-Ii386'
@@ -3172,6 +3241,21 @@ EOF
   fi; fi
 fi
 
+# Check whether --with-mmx or --without-mmx was given.
+if test "${with_mmx+set}" = set; then
+  withval="$with_mmx"
+  :
+else
+  with_mmx=no
+fi
+
+
+if test yes = "$with_mmx"; then
+  if test $NASM != "not_found"; then
+    ASMKREED='ASMKREED=1'
+  fi
+fi
+
 # Check whether --with-joystick or --without-joystick was given.
 if test "${with_joystick+set}" = set; then
   withval="$with_joystick"
@@ -3181,7 +3265,7 @@ else
 fi
 
 
-if test yes = "$snes9x_cv_linux_os" -a yes = "$with_joystick"; then
+if test \( yes = "$snes9x_cv_linux_os" -o yes = "$snes9x_cv_netbsd_os" -o yes = "$snes9x_cv_dragonfly_os" \) -a yes = "$with_joystick"; then
    JOYDEFINES=' -DJOYSTICK_SUPPORT'
 else
    with_joystick="no"
@@ -4000,8 +4084,10 @@ cat > conftest.$ac_ext <<EOF
 #line 4001 "configure"
 #include "confdefs.h"
 
+#include <X11/Intrinsic.h>
+
 int main() {
-${x_direct_test_function}()
+${x_direct_test_function}(0)
 ; return 0; }
 EOF
 if { (eval echo configure:4008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -4093,7 +4179,7 @@ fi
 if test xyes = x$no_x ; then
     echo "configure: warning: X is normally required to build on Unix." 1>&2
 else
-  X_LDFLAGS="-L$x_libraries"
+  X_LDFLAGS="-L$x_libraries -Wl,-R$x_libraries"
   X_LIBS="-lX11 -lXext"
   LIBS="$LIBS $X_LIBS"
   SYSLIBS="$SYSLIBS $X_LDFLAGS $X_LIBS"
@@ -4113,7 +4199,7 @@ if test "${with_extensions+set}" = set; 
   withval="$with_extensions"
   :
 else
-  with_extensions=yes
+  with_extensions=no
 fi
 
 
@@ -4648,7 +4734,7 @@ else
 #line 4649 "configure"
 #include "confdefs.h"
 
-#if defined(__linux) || defined(__sun) || defined(__sgi)
+#if defined(__linux) || defined(__sun) || defined(__sgi) || defined(__NetBSD__) || defined(__DragonFly__)
 /* */
 #else
 #error No sound for this platform
