$NetBSD: patch-ap,v 1.1 2006/03/18 15:56:00 ben Exp $

--- configure.in.orig	2004-12-30 14:15:45.000000000 -0800
+++ configure.in
@@ -309,6 +309,28 @@ AC_CACHE_VAL(snes9x_cv_linux_os, [
   ], [], snes9x_cv_linux_os=yes, snes9x_cv_linux_os=no)])
 AC_MSG_RESULT($snes9x_cv_linux_os)
 
+AC_MSG_CHECKING(if the OS is NetBSD)
+AC_CACHE_VAL(snes9x_cv_netbsd_os, [
+  AC_TRY_COMPILE([
+#ifdef __NetBSD__
+/* */
+#else
+#error Not NetBSD.
+#endif
+  ], [], snes9x_cv_netbsd_os=yes, snes9x_cv_netbsd_os=no)])
+AC_MSG_RESULT($snes9x_cv_netbsd_os)
+
+AC_MSG_CHECKING(if the OS is DragonFly)
+AC_CACHE_VAL(snes9x_cv_dragonfly_os, [
+  AC_TRY_COMPILE([
+#ifdef __DragonFly__
+/* */
+#else
+#error Not DragonFly.
+#endif
+  ], [], snes9x_cv_dragonfly_os=yes, snes9x_cv_dragonfly_os=no)])
+AC_MSG_RESULT($snes9x_cv_dragonfly_os)
+
 AC_MSG_CHECKING(if the OS is HP-UX)
 AC_CACHE_VAL(snes9x_cv_hpux_os, [
   AC_TRY_COMPILE([
@@ -333,7 +355,7 @@ AC_MSG_RESULT($snes9x_cv_win32_os)
 
 
 dnl Enable assembler optimizations if CPU is x86
-AC_ARG_WITH(assembler,[  --with(out)-assembler   Use assembler cores if available (default: with)],[],[with_assembler=yes])
+AC_ARG_WITH(assembler,[  --with(out)-assembler   Use assembler cores if available (default: without)],[],[with_assembler=no])
 
 if test yes = "$with_assembler"; then
   dnl Set assembler to !nasm on Windows
@@ -359,7 +381,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'
@@ -373,10 +394,18 @@ else
   fi; fi
 fi
 
+dnl Enable MMX optimizations if CPU is x86
+AC_ARG_WITH(mmx,[  --with(out)-mmx   Use MMX if available (default: without)],[],[with_mmx=no])
+if test yes = "$with_mmx"; then
+  if test $NASM != "not_found"; then
+    ASMKREED='ASMKREED=1'
+  fi
+fi
+
 dnl Enable joystick support on Linux
 AC_ARG_WITH(joystick, [  --with(out)-joystick    Enable joystick support if available (default: with)],[],[with_joystick=yes])
 
-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"
@@ -527,7 +556,7 @@ if test xyes = x$no_x ; then
   dnl Maybe AC_MSG_ERROR?
   AC_MSG_WARN([X is normally required to build on Unix.])
 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"
@@ -540,7 +569,7 @@ AC_ADD_XFLAGS
 
 
 dnl See if X has the DGA and vidmode extensions.
-AC_ARG_WITH(extensions,[  --with(out)-extensions  Use DGA- and vidmode-extensions for X11 if avilable (default: with)],[],[with_extensions=yes])
+AC_ARG_WITH(extensions,[  --with(out)-extensions  Use DGA- and vidmode-extensions for X11 if avilable (default: without)],[],[with_extensions=no])
 
 if test yes = $with_extensions ; then
   AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
@@ -759,7 +788,7 @@ if test yes = "$with_sound" ; then
   AC_MSG_CHECKING(if sound is supported on this platform)
   AC_CACHE_VAL(snes9x_cv_sound, [
   AC_TRY_COMPILE([
-#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
