diff --git a/DEVELOPERS-HINTS b/DEVELOPERS-HINTS
index 76d517f33b897f4df5f2d787f74a858cdda6a638..1dd695e30bbd38e4496dd67c1c7cdddfc1c7c0fd 100644
--- a/DEVELOPERS-HINTS
+++ b/DEVELOPERS-HINTS
@@ -78,6 +78,7 @@ Other DLLs:
 		wing/		- WinG (for games) internface
 		winmm/		- multimedia (16 & 32 bit)
 			mciXXX/	- various MCI drivers
+			winearts/ - ARTS audio driver
 			wineoss/- MM driver for OSS systems
 			wavemap/- audio mapper
 			midimap/- midi mapper
diff --git a/configure b/configure
index 6635f37a51c680617d4b564976a9d7b5b59956ed..ad37288ab9a6892927c2b3712468a133fe9138ad 100755
--- a/configure
+++ b/configure
@@ -7107,7 +7107,112 @@ EOF
 
 fi
 
-echo "$as_me:7110: checking whether mmap64 works defined as mmap" >&5
+# Extract the first word of "artsc-config", so it can be a program name with args.
+set dummy artsc-config; ac_word=$2
+echo "$as_me:7112: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_ARTSCCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ARTSCCONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ARTSCCONFIG="$ARTSCCONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  if $as_executable_p "$ac_dir/$ac_word"; then
+   ac_cv_path_ARTSCCONFIG="$ac_dir/$ac_word"
+   echo "$as_me:7129: found $ac_dir/$ac_word" >&5
+   break
+fi
+done
+
+  ;;
+esac
+fi
+ARTSCCONFIG=$ac_cv_path_ARTSCCONFIG
+
+if test -n "$ARTSCCONFIG"; then
+  echo "$as_me:7140: result: $ARTSCCONFIG" >&5
+echo "${ECHO_T}$ARTSCCONFIG" >&6
+else
+  echo "$as_me:7143: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:7147: checking for aRts Sound server" >&5
+echo $ECHO_N "checking for aRts Sound server... $ECHO_C" >&6
+if test "${ac_cv_c_artsserver+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"';
+        then
+            ac_cv_c_artsserver=no
+        else
+            ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
+            ARTSC_LIBS=`$ARTSCCONFIG --libs`
+            ac_cv_c_artsserver=no
+            save_CFLAGS="$CFLAGS"
+            CFLAGS="$CFLAGS $ARTSC_CFLAGS"
+            cat >conftest.$ac_ext <<_ACEOF
+#line 7162 "configure"
+#include "confdefs.h"
+
+             #include <artsc.h>
+
+int
+main ()
+{
+
+             arts_stream_t stream;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7178: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:7181: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7184: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:7187: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+            ac_cv_c_artsserver=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+            CFLAGS="$save_CFLAGS"
+        fi
+fi
+echo "$as_me:7200: result: $ac_cv_c_artsserver" >&5
+echo "${ECHO_T}$ac_cv_c_artsserver" >&6
+
+if test "$ac_cv_c_artsserver" = "yes"
+then
+    ARTSLIBS=$ARTSC_LIBS
+
+    ARTSINCL=$ARTSC_CFLAGS
+
+cat >>confdefs.h <<\EOF
+#define HAVE_ARTS 1
+EOF
+
+fi
+
+echo "$as_me:7215: checking whether mmap64 works defined as mmap" >&5
 echo $ECHO_N "checking whether mmap64 works defined as mmap... $ECHO_C" >&6
 if test "${ac_cv_mmap64_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7116,7 +7221,7 @@ else
   ac_cv_mmap64_works="no"
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7119 "configure"
+#line 7224 "configure"
 #include "confdefs.h"
 
 		#define _FILE_OFFSET_BITS 64
@@ -7146,15 +7251,15 @@ else
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7149: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7254: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7152: \$? = $ac_status" >&5
+  echo "$as_me:7257: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7154: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7259: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7157: \$? = $ac_status" >&5
+  echo "$as_me:7262: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_mmap64_works="yes"
 else
@@ -7166,7 +7271,7 @@ fi
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:7169: result: $ac_cv_mmap64_works" >&5
+echo "$as_me:7274: result: $ac_cv_mmap64_works" >&5
 echo "${ECHO_T}$ac_cv_mmap64_works" >&6
 
 if test "$ac_cv_mmap64_works" = "yes"
@@ -7181,7 +7286,7 @@ fi
 if test "x${GCC}" = "xyes"
 then
   CFLAGS="$CFLAGS -Wall"
-  echo "$as_me:7184: checking for gcc strength-reduce bug" >&5
+  echo "$as_me:7289: checking for gcc strength-reduce bug" >&5
 echo $ECHO_N "checking for gcc strength-reduce bug... $ECHO_C" >&6
 if test "${ac_cv_c_gcc_strength_bug+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7190,7 +7295,7 @@ else
   ac_cv_c_gcc_strength_bug="yes"
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7193 "configure"
+#line 7298 "configure"
 #include "confdefs.h"
 
 int	L[4] = {0,1,2,3};
@@ -7206,15 +7311,15 @@ int main(void) {
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7209: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7314: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7212: \$? = $ac_status" >&5
+  echo "$as_me:7317: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7214: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7319: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7217: \$? = $ac_status" >&5
+  echo "$as_me:7322: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_gcc_strength_bug="no"
 else
@@ -7226,14 +7331,14 @@ fi
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:7229: result: $ac_cv_c_gcc_strength_bug" >&5
+echo "$as_me:7334: result: $ac_cv_c_gcc_strength_bug" >&5
 echo "${ECHO_T}$ac_cv_c_gcc_strength_bug" >&6
   if test "$ac_cv_c_gcc_strength_bug" = "yes"
   then
     CFLAGS="$CFLAGS -fno-strength-reduce"
   fi
 
-    echo "$as_me:7236: checking for gcc -mpreferred-stack-boundary=2 support" >&5
+    echo "$as_me:7341: checking for gcc -mpreferred-stack-boundary=2 support" >&5
 echo $ECHO_N "checking for gcc -mpreferred-stack-boundary=2 support... $ECHO_C" >&6
 if test "${ac_cv_c_gcc_stack_boundary+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7241,7 +7346,7 @@ else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
   cat >conftest.$ac_ext <<_ACEOF
-#line 7244 "configure"
+#line 7349 "configure"
 #include "confdefs.h"
 
 int
@@ -7253,16 +7358,16 @@ return 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7256: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7361: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7259: \$? = $ac_status" >&5
+  echo "$as_me:7364: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7262: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7367: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7265: \$? = $ac_status" >&5
+  echo "$as_me:7370: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_gcc_stack_boundary="yes"
 else
@@ -7274,7 +7379,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext
   CFLAGS=$saved_cflags
 
 fi
-echo "$as_me:7277: result: $ac_cv_c_gcc_stack_boundary" >&5
+echo "$as_me:7382: result: $ac_cv_c_gcc_stack_boundary" >&5
 echo "${ECHO_T}$ac_cv_c_gcc_stack_boundary" >&6
   if test "$ac_cv_c_gcc_stack_boundary" = "yes"
   then
@@ -7282,7 +7387,7 @@ echo "${ECHO_T}$ac_cv_c_gcc_stack_boundary" >&6
   fi
 fi
 
-echo "$as_me:7285: checking whether .type must sit inside a .def directive" >&5
+echo "$as_me:7390: checking whether .type must sit inside a .def directive" >&5
 echo $ECHO_N "checking whether .type must sit inside a .def directive... $ECHO_C" >&6
 if test "${ac_cv_c_type_in_def+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7296,7 +7401,7 @@ _ac_test:
 	.long 0
 EOF
 cat >conftest.$ac_ext <<_ACEOF
-#line 7299 "configure"
+#line 7404 "configure"
 #include "confdefs.h"
 
 int
@@ -7308,16 +7413,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7311: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7416: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7314: \$? = $ac_status" >&5
+  echo "$as_me:7419: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7317: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7422: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7320: \$? = $ac_status" >&5
+  echo "$as_me:7425: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_type_in_def="yes"
 else
@@ -7328,7 +7433,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$saved_libs
 fi
-echo "$as_me:7331: result: $ac_cv_c_type_in_def" >&5
+echo "$as_me:7436: result: $ac_cv_c_type_in_def" >&5
 echo "${ECHO_T}$ac_cv_c_type_in_def" >&6
 if test "$ac_cv_c_type_in_def" = "yes"
 then
@@ -7339,7 +7444,7 @@ EOF
 
 fi
 
-echo "$as_me:7342: checking whether external symbols need an underscore prefix" >&5
+echo "$as_me:7447: checking whether external symbols need an underscore prefix" >&5
 echo $ECHO_N "checking whether external symbols need an underscore prefix... $ECHO_C" >&6
 if test "${ac_cv_c_extern_prefix+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7352,7 +7457,7 @@ _ac_test:
 	.long 0
 EOF
 cat >conftest.$ac_ext <<_ACEOF
-#line 7355 "configure"
+#line 7460 "configure"
 #include "confdefs.h"
 extern int ac_test;
 int
@@ -7364,16 +7469,16 @@ if (ac_test) return 1
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7367: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7472: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7370: \$? = $ac_status" >&5
+  echo "$as_me:7475: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7373: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7478: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7376: \$? = $ac_status" >&5
+  echo "$as_me:7481: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_extern_prefix="yes"
 else
@@ -7384,7 +7489,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$saved_libs
 fi
-echo "$as_me:7387: result: $ac_cv_c_extern_prefix" >&5
+echo "$as_me:7492: result: $ac_cv_c_extern_prefix" >&5
 echo "${ECHO_T}$ac_cv_c_extern_prefix" >&6
 if test "$ac_cv_c_extern_prefix" = "yes"
 then
@@ -7395,7 +7500,7 @@ EOF
 
 fi
 
-echo "$as_me:7398: checking whether stdcall symbols need to be decorated" >&5
+echo "$as_me:7503: checking whether stdcall symbols need to be decorated" >&5
 echo $ECHO_N "checking whether stdcall symbols need to be decorated... $ECHO_C" >&6
 if test "${ac_cv_c_stdcall_decoration+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7415,7 +7520,7 @@ ac_test@0:
 EOF
 fi
 cat >conftest.$ac_ext <<_ACEOF
-#line 7418 "configure"
+#line 7523 "configure"
 #include "confdefs.h"
 extern void __attribute__((__stdcall__)) ac_test(void);
 int
@@ -7427,16 +7532,16 @@ ac_test(); return 0
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7430: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7535: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7433: \$? = $ac_status" >&5
+  echo "$as_me:7538: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7436: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7541: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7439: \$? = $ac_status" >&5
+  echo "$as_me:7544: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_stdcall_decoration="yes"
 else
@@ -7447,7 +7552,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$saved_libs
 fi
-echo "$as_me:7450: result: $ac_cv_c_stdcall_decoration" >&5
+echo "$as_me:7555: result: $ac_cv_c_stdcall_decoration" >&5
 echo "${ECHO_T}$ac_cv_c_stdcall_decoration" >&6
 if test "$ac_cv_c_stdcall_decoration" = "yes"
 then
@@ -7458,7 +7563,7 @@ EOF
 
 fi
 
-echo "$as_me:7461: checking whether assembler accepts .string" >&5
+echo "$as_me:7566: checking whether assembler accepts .string" >&5
 echo $ECHO_N "checking whether assembler accepts .string... $ECHO_C" >&6
 if test "${ac_cv_c_asm_string+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7469,7 +7574,7 @@ cat > conftest_asm.s <<EOF
 	.string "test"
 EOF
 cat >conftest.$ac_ext <<_ACEOF
-#line 7472 "configure"
+#line 7577 "configure"
 #include "confdefs.h"
 
 int
@@ -7481,16 +7586,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7484: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7589: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7487: \$? = $ac_status" >&5
+  echo "$as_me:7592: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7490: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7595: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7493: \$? = $ac_status" >&5
+  echo "$as_me:7598: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_asm_string="yes"
 else
@@ -7501,7 +7606,7 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$saved_libs
 fi
-echo "$as_me:7504: result: $ac_cv_c_asm_string" >&5
+echo "$as_me:7609: result: $ac_cv_c_asm_string" >&5
 echo "${ECHO_T}$ac_cv_c_asm_string" >&6
 if test "$ac_cv_c_asm_string" = "yes"
 then
@@ -7516,7 +7621,7 @@ LDSHARED=""
 LDDLLFLAGS=""
 if test "$LIBEXT" = "so"
 then
-  echo "$as_me:7519: checking whether we can build a GNU style ELF dll" >&5
+  echo "$as_me:7624: checking whether we can build a GNU style ELF dll" >&5
 echo $ECHO_N "checking whether we can build a GNU style ELF dll... $ECHO_C" >&6
 if test "${ac_cv_c_dll_gnuelf+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7524,7 +7629,7 @@ else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
   cat >conftest.$ac_ext <<_ACEOF
-#line 7527 "configure"
+#line 7632 "configure"
 #include "confdefs.h"
 
 int
@@ -7536,16 +7641,16 @@ return 1
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7539: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7644: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7542: \$? = $ac_status" >&5
+  echo "$as_me:7647: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7545: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7650: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7548: \$? = $ac_status" >&5
+  echo "$as_me:7653: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_dll_gnuelf="yes"
 else
@@ -7557,14 +7662,14 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
   CFLAGS=$saved_cflags
 
 fi
-echo "$as_me:7560: result: $ac_cv_c_dll_gnuelf" >&5
+echo "$as_me:7665: result: $ac_cv_c_dll_gnuelf" >&5
 echo "${ECHO_T}$ac_cv_c_dll_gnuelf" >&6
   if test "$ac_cv_c_dll_gnuelf" = "yes"
   then
     LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%)"
     LDDLLFLAGS="-Wl,-Bsymbolic"
   else
-    echo "$as_me:7567: checking whether we can build a UnixWare (Solaris) dll" >&5
+    echo "$as_me:7672: checking whether we can build a UnixWare (Solaris) dll" >&5
 echo $ECHO_N "checking whether we can build a UnixWare (Solaris) dll... $ECHO_C" >&6
 if test "${ac_cv_c_dll_unixware+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7572,7 +7677,7 @@ else
   saved_cflags=$CFLAGS
     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
     cat >conftest.$ac_ext <<_ACEOF
-#line 7575 "configure"
+#line 7680 "configure"
 #include "confdefs.h"
 
 int
@@ -7584,16 +7689,16 @@ return 1
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7587: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7692: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7590: \$? = $ac_status" >&5
+  echo "$as_me:7695: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7593: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7698: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7596: \$? = $ac_status" >&5
+  echo "$as_me:7701: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_dll_unixware="yes"
 else
@@ -7605,7 +7710,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     CFLAGS=$saved_cflags
 
 fi
-echo "$as_me:7608: result: $ac_cv_c_dll_unixware" >&5
+echo "$as_me:7713: result: $ac_cv_c_dll_unixware" >&5
 echo "${ECHO_T}$ac_cv_c_dll_unixware" >&6
     if test "$ac_cv_c_dll_unixware" = "yes"
     then
@@ -7618,7 +7723,7 @@ echo "${ECHO_T}$ac_cv_c_dll_unixware" >&6
     LIBEXT="a"
     # Extract the first word of "dllwrap", so it can be a program name with args.
 set dummy dllwrap; ac_word=$2
-echo "$as_me:7621: checking for $ac_word" >&5
+echo "$as_me:7726: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_DLLWRAP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7633,7 +7738,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_DLLWRAP="dllwrap"
-echo "$as_me:7636: found $ac_dir/$ac_word" >&5
+echo "$as_me:7741: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -7642,10 +7747,10 @@ fi
 fi
 DLLWRAP=$ac_cv_prog_DLLWRAP
 if test -n "$DLLWRAP"; then
-  echo "$as_me:7645: result: $DLLWRAP" >&5
+  echo "$as_me:7750: result: $DLLWRAP" >&5
 echo "${ECHO_T}$DLLWRAP" >&6
 else
-  echo "$as_me:7648: result: no" >&5
+  echo "$as_me:7753: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -7660,7 +7765,7 @@ fi
 fi
 
 if test "$LIBEXT" = "a"; then
-  { { echo "$as_me:7663: error: could not find a way to build shared libraries.
+  { { echo "$as_me:7768: error: could not find a way to build shared libraries.
 It is currently not possible to build Wine without shared library
 (.so) support to allow transparent switch between .so and .dll files.
 If you are using Linux, you will need a newer binutils.
@@ -7688,7 +7793,7 @@ fi
 
 wine_cv_libc_reentrant=no
 
-  echo "$as_me:7691: checking for reentrant libc: __errno_location" >&5
+  echo "$as_me:7796: checking for reentrant libc: __errno_location" >&5
 echo $ECHO_N "checking for reentrant libc: __errno_location... $ECHO_C" >&6
 if test "${wine_cv_libc_r___errno_location+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7697,7 +7802,7 @@ else
   wine_cv_libc_r___errno_location=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7700 "configure"
+#line 7805 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
@@ -7705,15 +7810,15 @@ int *__errno_location(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7708: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7813: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7711: \$? = $ac_status" >&5
+  echo "$as_me:7816: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7713: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7818: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7716: \$? = $ac_status" >&5
+  echo "$as_me:7821: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_libc_r___errno_location=yes
 else
@@ -7726,14 +7831,14 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 fi
-echo "$as_me:7729: result: $wine_cv_libc_r___errno_location" >&5
+echo "$as_me:7834: result: $wine_cv_libc_r___errno_location" >&5
 echo "${ECHO_T}$wine_cv_libc_r___errno_location" >&6
 if test "$wine_cv_libc_r___errno_location" = "yes"
 then
     wine_cv_libc_reentrant=__errno_location
 fi
 
-  echo "$as_me:7736: checking for reentrant libc: __error" >&5
+  echo "$as_me:7841: checking for reentrant libc: __error" >&5
 echo $ECHO_N "checking for reentrant libc: __error... $ECHO_C" >&6
 if test "${wine_cv_libc_r___error+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7742,7 +7847,7 @@ else
   wine_cv_libc_r___error=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7745 "configure"
+#line 7850 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
@@ -7750,15 +7855,15 @@ int *__error(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7753: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7858: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7756: \$? = $ac_status" >&5
+  echo "$as_me:7861: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7758: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7863: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7761: \$? = $ac_status" >&5
+  echo "$as_me:7866: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_libc_r___error=yes
 else
@@ -7771,14 +7876,14 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 fi
-echo "$as_me:7774: result: $wine_cv_libc_r___error" >&5
+echo "$as_me:7879: result: $wine_cv_libc_r___error" >&5
 echo "${ECHO_T}$wine_cv_libc_r___error" >&6
 if test "$wine_cv_libc_r___error" = "yes"
 then
     wine_cv_libc_reentrant=__error
 fi
 
-  echo "$as_me:7781: checking for reentrant libc: ___errno" >&5
+  echo "$as_me:7886: checking for reentrant libc: ___errno" >&5
 echo $ECHO_N "checking for reentrant libc: ___errno... $ECHO_C" >&6
 if test "${wine_cv_libc_r____errno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7787,7 +7892,7 @@ else
   wine_cv_libc_r____errno=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7790 "configure"
+#line 7895 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
@@ -7795,15 +7900,15 @@ int *___errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7798: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7903: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7801: \$? = $ac_status" >&5
+  echo "$as_me:7906: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7803: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7908: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7806: \$? = $ac_status" >&5
+  echo "$as_me:7911: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_libc_r____errno=yes
 else
@@ -7816,14 +7921,14 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 fi
-echo "$as_me:7819: result: $wine_cv_libc_r____errno" >&5
+echo "$as_me:7924: result: $wine_cv_libc_r____errno" >&5
 echo "${ECHO_T}$wine_cv_libc_r____errno" >&6
 if test "$wine_cv_libc_r____errno" = "yes"
 then
     wine_cv_libc_reentrant=___errno
 fi
 
-  echo "$as_me:7826: checking for reentrant libc: __thr_errno" >&5
+  echo "$as_me:7931: checking for reentrant libc: __thr_errno" >&5
 echo $ECHO_N "checking for reentrant libc: __thr_errno... $ECHO_C" >&6
 if test "${wine_cv_libc_r___thr_errno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7832,7 +7937,7 @@ else
   wine_cv_libc_r___thr_errno=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7835 "configure"
+#line 7940 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
@@ -7840,15 +7945,15 @@ int *__thr_errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7843: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7948: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7846: \$? = $ac_status" >&5
+  echo "$as_me:7951: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7848: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7953: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7851: \$? = $ac_status" >&5
+  echo "$as_me:7956: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_libc_r___thr_errno=yes
 else
@@ -7861,14 +7966,14 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 fi
-echo "$as_me:7864: result: $wine_cv_libc_r___thr_errno" >&5
+echo "$as_me:7969: result: $wine_cv_libc_r___thr_errno" >&5
 echo "${ECHO_T}$wine_cv_libc_r___thr_errno" >&6
 if test "$wine_cv_libc_r___thr_errno" = "yes"
 then
     wine_cv_libc_reentrant=__thr_errno
 fi
 
-  echo "$as_me:7871: checking for reentrant libc: __errno" >&5
+  echo "$as_me:7976: checking for reentrant libc: __errno" >&5
 echo $ECHO_N "checking for reentrant libc: __errno... $ECHO_C" >&6
 if test "${wine_cv_libc_r___errno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7877,7 +7982,7 @@ else
   wine_cv_libc_r___errno=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7880 "configure"
+#line 7985 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
@@ -7885,15 +7990,15 @@ int *__errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:7888: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7993: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7891: \$? = $ac_status" >&5
+  echo "$as_me:7996: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:7893: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7998: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7896: \$? = $ac_status" >&5
+  echo "$as_me:8001: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_libc_r___errno=yes
 else
@@ -7906,7 +8011,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 fi
-echo "$as_me:7909: result: $wine_cv_libc_r___errno" >&5
+echo "$as_me:8014: result: $wine_cv_libc_r___errno" >&5
 echo "${ECHO_T}$wine_cv_libc_r___errno" >&6
 if test "$wine_cv_libc_r___errno" = "yes"
 then
@@ -7924,7 +8029,7 @@ fi
 
 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
 then
-echo "$as_me:7927: checking for reentrant X libraries" >&5
+echo "$as_me:8032: checking for reentrant X libraries" >&5
 echo $ECHO_N "checking for reentrant X libraries... $ECHO_C" >&6
 if test "${wine_cv_x_reentrant+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7956,7 +8061,7 @@ else
 	fi
     fi
 fi
-echo "$as_me:7959: result: $wine_cv_x_reentrant" >&5
+echo "$as_me:8064: result: $wine_cv_x_reentrant" >&5
 echo "${ECHO_T}$wine_cv_x_reentrant" >&6
 else
     wine_cv_x_reentrant=no
@@ -7972,13 +8077,13 @@ fi
 
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
-echo "$as_me:7975: checking for working alloca.h" >&5
+echo "$as_me:8080: checking for working alloca.h" >&5
 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
 if test "${ac_cv_working_alloca_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7981 "configure"
+#line 8086 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int
@@ -7990,16 +8095,16 @@ char *p = (char *) alloca (2 * sizeof (int));
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7993: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8098: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7996: \$? = $ac_status" >&5
+  echo "$as_me:8101: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7999: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8104: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8002: \$? = $ac_status" >&5
+  echo "$as_me:8107: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_working_alloca_h=yes
 else
@@ -8009,7 +8114,7 @@ ac_cv_working_alloca_h=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8012: result: $ac_cv_working_alloca_h" >&5
+echo "$as_me:8117: result: $ac_cv_working_alloca_h" >&5
 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
 if test $ac_cv_working_alloca_h = yes; then
 
@@ -8019,13 +8124,13 @@ EOF
 
 fi
 
-echo "$as_me:8022: checking for alloca" >&5
+echo "$as_me:8127: checking for alloca" >&5
 echo $ECHO_N "checking for alloca... $ECHO_C" >&6
 if test "${ac_cv_func_alloca_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8028 "configure"
+#line 8133 "configure"
 #include "confdefs.h"
 #ifdef __GNUC__
 # define alloca __builtin_alloca
@@ -8057,16 +8162,16 @@ char *p = (char *) alloca (1);
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8060: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8165: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8063: \$? = $ac_status" >&5
+  echo "$as_me:8168: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8066: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8171: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8069: \$? = $ac_status" >&5
+  echo "$as_me:8174: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_alloca_works=yes
 else
@@ -8076,7 +8181,7 @@ ac_cv_func_alloca_works=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8079: result: $ac_cv_func_alloca_works" >&5
+echo "$as_me:8184: result: $ac_cv_func_alloca_works" >&5
 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
 
 if test $ac_cv_func_alloca_works = yes; then
@@ -8097,13 +8202,13 @@ cat >>confdefs.h <<\EOF
 #define C_ALLOCA 1
 EOF
 
-echo "$as_me:8100: checking whether \`alloca.c' needs Cray hooks" >&5
+echo "$as_me:8205: checking whether \`alloca.c' needs Cray hooks" >&5
 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
 if test "${ac_cv_os_cray+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8106 "configure"
+#line 8211 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -8121,18 +8226,18 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:8124: result: $ac_cv_os_cray" >&5
+echo "$as_me:8229: result: $ac_cv_os_cray" >&5
 echo "${ECHO_T}$ac_cv_os_cray" >&6
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:8129: checking for $ac_func" >&5
+echo "$as_me:8234: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8135 "configure"
+#line 8240 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -8163,16 +8268,16 @@ f = $ac_func;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8166: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8271: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8169: \$? = $ac_status" >&5
+  echo "$as_me:8274: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8172: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8277: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8175: \$? = $ac_status" >&5
+  echo "$as_me:8280: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -8182,7 +8287,7 @@ eval "$as_ac_var=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8185: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:8290: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
 
@@ -8196,7 +8301,7 @@ fi
   done
 fi
 
-echo "$as_me:8199: checking stack direction for C alloca" >&5
+echo "$as_me:8304: checking stack direction for C alloca" >&5
 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
 if test "${ac_cv_c_stack_direction+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8205,7 +8310,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8208 "configure"
+#line 8313 "configure"
 #include "confdefs.h"
 int
 find_stack_direction ()
@@ -8228,15 +8333,15 @@ main ()
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:8231: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8336: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8234: \$? = $ac_status" >&5
+  echo "$as_me:8339: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:8236: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8341: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8239: \$? = $ac_status" >&5
+  echo "$as_me:8344: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_stack_direction=1
 else
@@ -8248,7 +8353,7 @@ fi
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:8251: result: $ac_cv_c_stack_direction" >&5
+echo "$as_me:8356: result: $ac_cv_c_stack_direction" >&5
 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
 
 cat >>confdefs.h <<EOF
@@ -8304,13 +8409,13 @@ for ac_func in \
 
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:8307: checking for $ac_func" >&5
+echo "$as_me:8412: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8313 "configure"
+#line 8418 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -8341,16 +8446,16 @@ f = $ac_func;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8344: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8449: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8347: \$? = $ac_status" >&5
+  echo "$as_me:8452: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8350: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8455: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8353: \$? = $ac_status" >&5
+  echo "$as_me:8458: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -8360,7 +8465,7 @@ eval "$as_ac_var=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8363: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:8468: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -8432,23 +8537,23 @@ for ac_header in \
 
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:8435: checking for $ac_header" >&5
+echo "$as_me:8540: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8441 "configure"
+#line 8546 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:8445: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:8550: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:8451: \$? = $ac_status" >&5
+  echo "$as_me:8556: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -8467,7 +8572,7 @@ else
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:8470: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:8575: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -8477,13 +8582,13 @@ EOF
 fi
 done
 
-echo "$as_me:8480: checking whether stat file-mode macros are broken" >&5
+echo "$as_me:8585: checking whether stat file-mode macros are broken" >&5
 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6
 if test "${ac_cv_header_stat_broken+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8486 "configure"
+#line 8591 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -8522,7 +8627,7 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:8525: result: $ac_cv_header_stat_broken" >&5
+echo "$as_me:8630: result: $ac_cv_header_stat_broken" >&5
 echo "${ECHO_T}$ac_cv_header_stat_broken" >&6
 if test $ac_cv_header_stat_broken = yes; then
 
@@ -8532,7 +8637,7 @@ EOF
 
 fi
 
-echo "$as_me:8535: checking for $CC option to accept ANSI C" >&5
+echo "$as_me:8640: checking for $CC option to accept ANSI C" >&5
 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8540,7 +8645,7 @@ else
   ac_cv_prog_cc_stdc=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
-#line 8543 "configure"
+#line 8648 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -8589,16 +8694,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO
 do
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8592: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8697: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8595: \$? = $ac_status" >&5
+  echo "$as_me:8700: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8598: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8703: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8601: \$? = $ac_status" >&5
+  echo "$as_me:8706: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cc_stdc=$ac_arg
 break
@@ -8615,21 +8720,21 @@ fi
 
 case "x$ac_cv_prog_cc_stdc" in
   x|xno)
-    echo "$as_me:8618: result: none needed" >&5
+    echo "$as_me:8723: result: none needed" >&5
 echo "${ECHO_T}none needed" >&6 ;;
   *)
-    echo "$as_me:8621: result: $ac_cv_prog_cc_stdc" >&5
+    echo "$as_me:8726: result: $ac_cv_prog_cc_stdc" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
     CC="$CC $ac_cv_prog_cc_stdc" ;;
 esac
 
-echo "$as_me:8626: checking for an ANSI C-conforming const" >&5
+echo "$as_me:8731: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8632 "configure"
+#line 8737 "configure"
 #include "confdefs.h"
 
 int
@@ -8687,16 +8792,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8690: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8795: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8693: \$? = $ac_status" >&5
+  echo "$as_me:8798: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8696: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8801: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8699: \$? = $ac_status" >&5
+  echo "$as_me:8804: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
@@ -8706,7 +8811,7 @@ ac_cv_c_const=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8709: result: $ac_cv_c_const" >&5
+echo "$as_me:8814: result: $ac_cv_c_const" >&5
 echo "${ECHO_T}$ac_cv_c_const" >&6
 if test $ac_cv_c_const = no; then
 
@@ -8716,7 +8821,7 @@ EOF
 
 fi
 
-echo "$as_me:8719: checking for inline" >&5
+echo "$as_me:8824: checking for inline" >&5
 echo $ECHO_N "checking for inline... $ECHO_C" >&6
 if test "${ac_cv_c_inline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8724,7 +8829,7 @@ else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat >conftest.$ac_ext <<_ACEOF
-#line 8727 "configure"
+#line 8832 "configure"
 #include "confdefs.h"
 #ifndef __cplusplus
 static $ac_kw int static_foo () {return 0; }
@@ -8733,16 +8838,16 @@ $ac_kw int foo () {return 0; }
 
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8736: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8841: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8739: \$? = $ac_status" >&5
+  echo "$as_me:8844: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8742: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8847: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8745: \$? = $ac_status" >&5
+  echo "$as_me:8850: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_inline=$ac_kw; break
 else
@@ -8753,7 +8858,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext
 done
 
 fi
-echo "$as_me:8756: result: $ac_cv_c_inline" >&5
+echo "$as_me:8861: result: $ac_cv_c_inline" >&5
 echo "${ECHO_T}$ac_cv_c_inline" >&6
 case $ac_cv_c_inline in
   inline | yes) ;;
@@ -8768,13 +8873,13 @@ EOF
  ;;
 esac
 
-echo "$as_me:8771: checking for ANSI C header files" >&5
+echo "$as_me:8876: checking for ANSI C header files" >&5
 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8777 "configure"
+#line 8882 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -8782,13 +8887,13 @@ else
 #include <float.h>
 
 _ACEOF
-if { (eval echo "$as_me:8785: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:8890: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:8791: \$? = $ac_status" >&5
+  echo "$as_me:8896: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -8810,7 +8915,7 @@ rm -f conftest.err conftest.$ac_ext
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line 8813 "configure"
+#line 8918 "configure"
 #include "confdefs.h"
 #include <string.h>
 
@@ -8828,7 +8933,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line 8831 "configure"
+#line 8936 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 
@@ -8849,7 +8954,7 @@ if test $ac_cv_header_stdc = yes; then
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8852 "configure"
+#line 8957 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -8875,15 +8980,15 @@ main ()
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:8878: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8983: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8881: \$? = $ac_status" >&5
+  echo "$as_me:8986: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:8883: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8988: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8886: \$? = $ac_status" >&5
+  echo "$as_me:8991: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -8896,7 +9001,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 fi
-echo "$as_me:8899: result: $ac_cv_header_stdc" >&5
+echo "$as_me:9004: result: $ac_cv_header_stdc" >&5
 echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
 
@@ -8912,28 +9017,28 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
                   inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:8915: checking for $ac_header" >&5
+echo "$as_me:9020: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8921 "configure"
+#line 9026 "configure"
 #include "confdefs.h"
 $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8927: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9032: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8930: \$? = $ac_status" >&5
+  echo "$as_me:9035: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8933: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9038: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8936: \$? = $ac_status" >&5
+  echo "$as_me:9041: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
@@ -8943,7 +9048,7 @@ eval "$as_ac_Header=no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8946: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:9051: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -8953,13 +9058,13 @@ EOF
 fi
 done
 
-echo "$as_me:8956: checking for mode_t" >&5
+echo "$as_me:9061: checking for mode_t" >&5
 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
 if test "${ac_cv_type_mode_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8962 "configure"
+#line 9067 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -8974,16 +9079,16 @@ if (sizeof (mode_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8977: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9082: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8980: \$? = $ac_status" >&5
+  echo "$as_me:9085: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8983: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9088: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8986: \$? = $ac_status" >&5
+  echo "$as_me:9091: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_mode_t=yes
 else
@@ -8993,7 +9098,7 @@ ac_cv_type_mode_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8996: result: $ac_cv_type_mode_t" >&5
+echo "$as_me:9101: result: $ac_cv_type_mode_t" >&5
 echo "${ECHO_T}$ac_cv_type_mode_t" >&6
 if test $ac_cv_type_mode_t = yes; then
   :
@@ -9005,13 +9110,13 @@ EOF
 
 fi
 
-echo "$as_me:9008: checking for off_t" >&5
+echo "$as_me:9113: checking for off_t" >&5
 echo $ECHO_N "checking for off_t... $ECHO_C" >&6
 if test "${ac_cv_type_off_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9014 "configure"
+#line 9119 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9026,16 +9131,16 @@ if (sizeof (off_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9029: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9134: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9032: \$? = $ac_status" >&5
+  echo "$as_me:9137: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9035: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9140: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9038: \$? = $ac_status" >&5
+  echo "$as_me:9143: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_off_t=yes
 else
@@ -9045,7 +9150,7 @@ ac_cv_type_off_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9048: result: $ac_cv_type_off_t" >&5
+echo "$as_me:9153: result: $ac_cv_type_off_t" >&5
 echo "${ECHO_T}$ac_cv_type_off_t" >&6
 if test $ac_cv_type_off_t = yes; then
   :
@@ -9057,13 +9162,13 @@ EOF
 
 fi
 
-echo "$as_me:9060: checking for pid_t" >&5
+echo "$as_me:9165: checking for pid_t" >&5
 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
 if test "${ac_cv_type_pid_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9066 "configure"
+#line 9171 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9078,16 +9183,16 @@ if (sizeof (pid_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9081: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9186: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9084: \$? = $ac_status" >&5
+  echo "$as_me:9189: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9087: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9192: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9090: \$? = $ac_status" >&5
+  echo "$as_me:9195: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_pid_t=yes
 else
@@ -9097,7 +9202,7 @@ ac_cv_type_pid_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9100: result: $ac_cv_type_pid_t" >&5
+echo "$as_me:9205: result: $ac_cv_type_pid_t" >&5
 echo "${ECHO_T}$ac_cv_type_pid_t" >&6
 if test $ac_cv_type_pid_t = yes; then
   :
@@ -9109,13 +9214,13 @@ EOF
 
 fi
 
-echo "$as_me:9112: checking for size_t" >&5
+echo "$as_me:9217: checking for size_t" >&5
 echo $ECHO_N "checking for size_t... $ECHO_C" >&6
 if test "${ac_cv_type_size_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9118 "configure"
+#line 9223 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9130,16 +9235,16 @@ if (sizeof (size_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9133: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9238: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9136: \$? = $ac_status" >&5
+  echo "$as_me:9241: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9139: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9244: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9142: \$? = $ac_status" >&5
+  echo "$as_me:9247: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_size_t=yes
 else
@@ -9149,7 +9254,7 @@ ac_cv_type_size_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9152: result: $ac_cv_type_size_t" >&5
+echo "$as_me:9257: result: $ac_cv_type_size_t" >&5
 echo "${ECHO_T}$ac_cv_type_size_t" >&6
 if test $ac_cv_type_size_t = yes; then
   :
@@ -9161,13 +9266,13 @@ EOF
 
 fi
 
-echo "$as_me:9164: checking for long long" >&5
+echo "$as_me:9269: checking for long long" >&5
 echo $ECHO_N "checking for long long... $ECHO_C" >&6
 if test "${ac_cv_type_long_long+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9170 "configure"
+#line 9275 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9182,16 +9287,16 @@ if (sizeof (long long))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9185: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9290: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9188: \$? = $ac_status" >&5
+  echo "$as_me:9293: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9191: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9296: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9194: \$? = $ac_status" >&5
+  echo "$as_me:9299: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_long_long=yes
 else
@@ -9201,10 +9306,10 @@ ac_cv_type_long_long=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9204: result: $ac_cv_type_long_long" >&5
+echo "$as_me:9309: result: $ac_cv_type_long_long" >&5
 echo "${ECHO_T}$ac_cv_type_long_long" >&6
 
-echo "$as_me:9207: checking size of long long" >&5
+echo "$as_me:9312: checking size of long long" >&5
 echo $ECHO_N "checking size of long long... $ECHO_C" >&6
 if test "${ac_cv_sizeof_long_long+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9213,7 +9318,7 @@ else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
 cat >conftest.$ac_ext <<_ACEOF
-#line 9216 "configure"
+#line 9321 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9225,21 +9330,21 @@ int _array_ [1 - 2 * !((sizeof (long long)) >= 0)]
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9228: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9333: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9231: \$? = $ac_status" >&5
+  echo "$as_me:9336: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9234: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9339: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9237: \$? = $ac_status" >&5
+  echo "$as_me:9342: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_lo=0 ac_mid=0
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
-#line 9242 "configure"
+#line 9347 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9251,16 +9356,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) <= $ac_mid)]
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9254: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9359: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9257: \$? = $ac_status" >&5
+  echo "$as_me:9362: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9260: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9365: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9263: \$? = $ac_status" >&5
+  echo "$as_me:9368: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_hi=$ac_mid; break
 else
@@ -9276,7 +9381,7 @@ cat conftest.$ac_ext >&5
 ac_hi=-1 ac_mid=-1
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
-#line 9279 "configure"
+#line 9384 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9288,16 +9393,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) >= $ac_mid)]
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9291: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9396: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9294: \$? = $ac_status" >&5
+  echo "$as_me:9399: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9297: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9402: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9300: \$? = $ac_status" >&5
+  echo "$as_me:9405: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_lo=$ac_mid; break
 else
@@ -9313,7 +9418,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
   cat >conftest.$ac_ext <<_ACEOF
-#line 9316 "configure"
+#line 9421 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9325,16 +9430,16 @@ int _array_ [1 - 2 * !((sizeof (long long)) <= $ac_mid)]
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9328: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9433: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9331: \$? = $ac_status" >&5
+  echo "$as_me:9436: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9334: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9439: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9337: \$? = $ac_status" >&5
+  echo "$as_me:9442: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_hi=$ac_mid
 else
@@ -9347,12 +9452,12 @@ done
 ac_cv_sizeof_long_long=$ac_lo
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:9350: error: cannot run test program while cross compiling" >&5
+  { { echo "$as_me:9455: error: cannot run test program while cross compiling" >&5
 echo "$as_me: error: cannot run test program while cross compiling" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9355 "configure"
+#line 9460 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -9368,15 +9473,15 @@ fclose (f);
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:9371: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9476: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9374: \$? = $ac_status" >&5
+  echo "$as_me:9479: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:9376: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9481: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9379: \$? = $ac_status" >&5
+  echo "$as_me:9484: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_long_long=`cat conftest.val`
 else
@@ -9392,19 +9497,19 @@ else
   ac_cv_sizeof_long_long=0
 fi
 fi
-echo "$as_me:9395: result: $ac_cv_sizeof_long_long" >&5
+echo "$as_me:9500: result: $ac_cv_sizeof_long_long" >&5
 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
 cat >>confdefs.h <<EOF
 #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
 EOF
 
-echo "$as_me:9401: checking whether linux/input.h is for real" >&5
+echo "$as_me:9506: checking whether linux/input.h is for real" >&5
 echo $ECHO_N "checking whether linux/input.h is for real... $ECHO_C" >&6
 if test "${wine_cv_linux_input_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9407 "configure"
+#line 9512 "configure"
 #include "confdefs.h"
 
 	    #include <linux/input.h>
@@ -9422,16 +9527,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9425: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9530: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9428: \$? = $ac_status" >&5
+  echo "$as_me:9533: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9431: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9536: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9434: \$? = $ac_status" >&5
+  echo "$as_me:9539: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_linux_input_h=yes
 else
@@ -9442,7 +9547,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9445: result: $wine_cv_linux_input_h" >&5
+echo "$as_me:9550: result: $wine_cv_linux_input_h" >&5
 echo "${ECHO_T}$wine_cv_linux_input_h" >&6
     if test "$wine_cv_linux_input_h" = "yes"
     then
@@ -9453,13 +9558,13 @@ EOF
 
     fi
 
-echo "$as_me:9456: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
+echo "$as_me:9561: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
 echo $ECHO_N "checking whether we can use re-entrant gethostbyname_r Linux style... $ECHO_C" >&6
 if test "${wine_cv_linux_gethostbyname_r_6+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9462 "configure"
+#line 9567 "configure"
 #include "confdefs.h"
 
 #include <netdb.h>
@@ -9485,16 +9590,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9488: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9593: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9491: \$? = $ac_status" >&5
+  echo "$as_me:9596: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9494: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9599: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9497: \$? = $ac_status" >&5
+  echo "$as_me:9602: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_linux_gethostbyname_r_6=yes
 else
@@ -9506,7 +9611,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9509: result: $wine_cv_linux_gethostbyname_r_6" >&5
+echo "$as_me:9614: result: $wine_cv_linux_gethostbyname_r_6" >&5
 echo "${ECHO_T}$wine_cv_linux_gethostbyname_r_6" >&6
    if test "$wine_cv_linux_gethostbyname_r_6" = "yes"
    then
@@ -9519,13 +9624,13 @@ EOF
 
 if test "$ac_cv_header_linux_joystick_h" = "yes"
 then
-   echo "$as_me:9522: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
+   echo "$as_me:9627: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
 echo $ECHO_N "checking whether linux/joystick.h uses the Linux 2.2+ API... $ECHO_C" >&6
 if test "${wine_cv_linux_joystick_22_api+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9528 "configure"
+#line 9633 "configure"
 #include "confdefs.h"
 
 	#include <sys/ioctl.h>
@@ -9545,16 +9650,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9548: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9653: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9551: \$? = $ac_status" >&5
+  echo "$as_me:9656: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9554: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9659: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9557: \$? = $ac_status" >&5
+  echo "$as_me:9662: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_linux_joystick_22_api=yes
 else
@@ -9565,7 +9670,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9568: result: $wine_cv_linux_joystick_22_api" >&5
+echo "$as_me:9673: result: $wine_cv_linux_joystick_22_api" >&5
 echo "${ECHO_T}$wine_cv_linux_joystick_22_api" >&6
    if test "$wine_cv_linux_joystick_22_api" = "yes"
    then
@@ -9579,13 +9684,13 @@ fi
 
 if test "$ac_cv_header_sys_vfs_h" = "yes"
 then
-    echo "$as_me:9582: checking whether sys/vfs.h defines statfs" >&5
+    echo "$as_me:9687: checking whether sys/vfs.h defines statfs" >&5
 echo $ECHO_N "checking whether sys/vfs.h defines statfs... $ECHO_C" >&6
 if test "${wine_cv_sys_vfs_has_statfs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9588 "configure"
+#line 9693 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -9607,16 +9712,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9610: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9715: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9613: \$? = $ac_status" >&5
+  echo "$as_me:9718: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9616: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9721: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9619: \$? = $ac_status" >&5
+  echo "$as_me:9724: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_sys_vfs_has_statfs=yes
 else
@@ -9628,7 +9733,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9631: result: $wine_cv_sys_vfs_has_statfs" >&5
+echo "$as_me:9736: result: $wine_cv_sys_vfs_has_statfs" >&5
 echo "${ECHO_T}$wine_cv_sys_vfs_has_statfs" >&6
     if test "$wine_cv_sys_vfs_has_statfs" = "yes"
     then
@@ -9642,13 +9747,13 @@ fi
 
 if test "$ac_cv_header_sys_statfs_h" = "yes"
 then
-    echo "$as_me:9645: checking whether sys/statfs.h defines statfs" >&5
+    echo "$as_me:9750: checking whether sys/statfs.h defines statfs" >&5
 echo $ECHO_N "checking whether sys/statfs.h defines statfs... $ECHO_C" >&6
 if test "${wine_cv_sys_statfs_has_statfs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9651 "configure"
+#line 9756 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -9668,16 +9773,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9671: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9776: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9674: \$? = $ac_status" >&5
+  echo "$as_me:9779: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9677: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9782: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9680: \$? = $ac_status" >&5
+  echo "$as_me:9785: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_sys_statfs_has_statfs=yes
 else
@@ -9689,7 +9794,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9692: result: $wine_cv_sys_statfs_has_statfs" >&5
+echo "$as_me:9797: result: $wine_cv_sys_statfs_has_statfs" >&5
 echo "${ECHO_T}$wine_cv_sys_statfs_has_statfs" >&6
     if test "$wine_cv_sys_statfs_has_statfs" = "yes"
     then
@@ -9703,13 +9808,13 @@ fi
 
 if test "$ac_cv_header_sys_mount_h" = "yes"
 then
-    echo "$as_me:9706: checking whether sys/mount.h defines statfs" >&5
+    echo "$as_me:9811: checking whether sys/mount.h defines statfs" >&5
 echo $ECHO_N "checking whether sys/mount.h defines statfs... $ECHO_C" >&6
 if test "${wine_cv_sys_mount_has_statfs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9712 "configure"
+#line 9817 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -9729,16 +9834,16 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9732: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9837: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9735: \$? = $ac_status" >&5
+  echo "$as_me:9840: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9738: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9843: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9741: \$? = $ac_status" >&5
+  echo "$as_me:9846: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   wine_cv_sys_mount_has_statfs=yes
 else
@@ -9750,7 +9855,7 @@ fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9753: result: $wine_cv_sys_mount_has_statfs" >&5
+echo "$as_me:9858: result: $wine_cv_sys_mount_has_statfs" >&5
 echo "${ECHO_T}$wine_cv_sys_mount_has_statfs" >&6
     if test "$wine_cv_sys_mount_has_statfs" = "yes"
     then
@@ -9762,13 +9867,13 @@ EOF
     fi
 fi
 
-echo "$as_me:9765: checking for f_bfree in struct statfs" >&5
+echo "$as_me:9870: checking for f_bfree in struct statfs" >&5
 echo $ECHO_N "checking for f_bfree in struct statfs... $ECHO_C" >&6
 if test "${ac_cv_c_statfs_f_bfree+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9771 "configure"
+#line 9876 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -9794,16 +9899,16 @@ struct statfs s; s.f_bfree = 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9797: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9902: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9800: \$? = $ac_status" >&5
+  echo "$as_me:9905: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9803: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9908: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9806: \$? = $ac_status" >&5
+  echo "$as_me:9911: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_statfs_f_bfree="yes"
 else
@@ -9813,7 +9918,7 @@ ac_cv_c_statfs_f_bfree="no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9816: result: $ac_cv_c_statfs_f_bfree" >&5
+echo "$as_me:9921: result: $ac_cv_c_statfs_f_bfree" >&5
 echo "${ECHO_T}$ac_cv_c_statfs_f_bfree" >&6
 if  test "x$ac_cv_c_statfs_f_bfree" = "xyes"; then
 
@@ -9823,13 +9928,13 @@ EOF
 
 fi
 
-echo "$as_me:9826: checking for f_bavail in struct statfs" >&5
+echo "$as_me:9931: checking for f_bavail in struct statfs" >&5
 echo $ECHO_N "checking for f_bavail in struct statfs... $ECHO_C" >&6
 if test "${ac_cv_c_statfs_f_bavail+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9832 "configure"
+#line 9937 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -9855,16 +9960,16 @@ struct statfs s; s.f_bavail = 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9858: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9963: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9861: \$? = $ac_status" >&5
+  echo "$as_me:9966: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9864: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9969: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9867: \$? = $ac_status" >&5
+  echo "$as_me:9972: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_statfs_f_bavail="yes"
 else
@@ -9874,7 +9979,7 @@ ac_cv_c_statfs_f_bavail="no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9877: result: $ac_cv_c_statfs_f_bavail" >&5
+echo "$as_me:9982: result: $ac_cv_c_statfs_f_bavail" >&5
 echo "${ECHO_T}$ac_cv_c_statfs_f_bavail" >&6
 if  test "x$ac_cv_c_statfs_f_bavail" = "xyes"; then
 
@@ -9884,13 +9989,13 @@ EOF
 
 fi
 
-echo "$as_me:9887: checking for msg_accrights in struct msghdr" >&5
+echo "$as_me:9992: checking for msg_accrights in struct msghdr" >&5
 echo $ECHO_N "checking for msg_accrights in struct msghdr... $ECHO_C" >&6
 if test "${ac_cv_c_msghdr_msg_accrights+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9893 "configure"
+#line 9998 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -9903,16 +10008,16 @@ struct msghdr s; s.msg_accrights = 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9906: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10011: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9909: \$? = $ac_status" >&5
+  echo "$as_me:10014: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9912: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10017: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9915: \$? = $ac_status" >&5
+  echo "$as_me:10020: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_msghdr_msg_accrights="yes"
 else
@@ -9922,7 +10027,7 @@ ac_cv_c_msghdr_msg_accrights="no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9925: result: $ac_cv_c_msghdr_msg_accrights" >&5
+echo "$as_me:10030: result: $ac_cv_c_msghdr_msg_accrights" >&5
 echo "${ECHO_T}$ac_cv_c_msghdr_msg_accrights" >&6
 if  test "x$ac_cv_c_msghdr_msg_accrights" = "xyes"; then
 
@@ -9932,13 +10037,13 @@ EOF
 
 fi
 
-echo "$as_me:9935: checking for sa_len in struct sockaddr" >&5
+echo "$as_me:10040: checking for sa_len in struct sockaddr" >&5
 echo $ECHO_N "checking for sa_len in struct sockaddr... $ECHO_C" >&6
 if test "${ac_cv_c_sockaddr_sa_len+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9941 "configure"
+#line 10046 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -9951,16 +10056,16 @@ struct sockaddr s; s.sa_len = 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9954: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10059: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9957: \$? = $ac_status" >&5
+  echo "$as_me:10062: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9960: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10065: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9963: \$? = $ac_status" >&5
+  echo "$as_me:10068: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_sockaddr_sa_len="yes"
 else
@@ -9970,7 +10075,7 @@ ac_cv_c_sockaddr_sa_len="no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:9973: result: $ac_cv_c_sockaddr_sa_len" >&5
+echo "$as_me:10078: result: $ac_cv_c_sockaddr_sa_len" >&5
 echo "${ECHO_T}$ac_cv_c_sockaddr_sa_len" >&6
 if  test "x$ac_cv_c_sockaddr_sa_len" = "xyes"; then
 
@@ -9980,13 +10085,13 @@ EOF
 
 fi
 
-echo "$as_me:9983: checking for sun_len in struct sockaddr_un" >&5
+echo "$as_me:10088: checking for sun_len in struct sockaddr_un" >&5
 echo $ECHO_N "checking for sun_len in struct sockaddr_un... $ECHO_C" >&6
 if test "${ac_cv_c_sockaddr_un_sun_len+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9989 "configure"
+#line 10094 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -10000,16 +10105,16 @@ struct sockaddr_un s; s.sun_len = 0
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10003: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10108: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10006: \$? = $ac_status" >&5
+  echo "$as_me:10111: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10009: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10114: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10012: \$? = $ac_status" >&5
+  echo "$as_me:10117: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_sockaddr_un_sun_len="yes"
 else
@@ -10019,7 +10124,7 @@ ac_cv_c_sockaddr_un_sun_len="no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10022: result: $ac_cv_c_sockaddr_un_sun_len" >&5
+echo "$as_me:10127: result: $ac_cv_c_sockaddr_un_sun_len" >&5
 echo "${ECHO_T}$ac_cv_c_sockaddr_un_sun_len" >&6
 if  test "x$ac_cv_c_sockaddr_un_sun_len" = "xyes"; then
 
@@ -10031,13 +10136,13 @@ fi
 
 case $target_cpu in
   *i345678986* )
-    echo "$as_me:10034: checking whether we need to define __i386__" >&5
+    echo "$as_me:10139: checking whether we need to define __i386__" >&5
 echo $ECHO_N "checking whether we need to define __i386__... $ECHO_C" >&6
 if test "${ac_cv_cpp_def_i386+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10040 "configure"
+#line 10145 "configure"
 #include "confdefs.h"
 #ifndef __i386__
 yes
@@ -10052,7 +10157,7 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:10055: result: $ac_cv_cpp_def_i386" >&5
+echo "$as_me:10160: result: $ac_cv_cpp_def_i386" >&5
 echo "${ECHO_T}$ac_cv_cpp_def_i386" >&6
     ;;
 esac
@@ -10106,7 +10211,7 @@ MAKE_DLL_RULES=dlls/Makedll.rules
 
 MAKE_PROG_RULES=programs/Makeprog.rules
 
-ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules programs/Makeprog.rules Makefile console/Makefile controls/Makefile debugger/Makefile dlls/Makefile dlls/advapi32/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/gdi/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/netapi32/Makefile dlls/ntdll/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/user/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winspool/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile files/Makefile graphics/Makefile graphics/enhmetafiledrv/Makefile graphics/metafiledrv/Makefile graphics/win16drv/Makefile graphics/x11drv/Makefile if1632/Makefile include/Makefile library/Makefile libtest/Makefile loader/Makefile loader/ne/Makefile memory/Makefile misc/Makefile miscemu/Makefile msdos/Makefile objects/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regtest/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineconsole/Makefile programs/winemine/Makefile programs/winetest/Makefile programs/winhelp/Makefile programs/winver/Makefile relay32/Makefile scheduler/Makefile server/Makefile tools/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wrc/Makefile tsx11/Makefile unicode/Makefile win32/Makefile windows/Makefile windows/x11drv/Makefile"
+ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules programs/Makeprog.rules Makefile console/Makefile controls/Makefile debugger/Makefile dlls/Makefile dlls/advapi32/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/gdi/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/netapi32/Makefile dlls/ntdll/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/user/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winspool/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile files/Makefile graphics/Makefile graphics/enhmetafiledrv/Makefile graphics/metafiledrv/Makefile graphics/win16drv/Makefile graphics/x11drv/Makefile if1632/Makefile include/Makefile library/Makefile libtest/Makefile loader/Makefile loader/ne/Makefile memory/Makefile misc/Makefile miscemu/Makefile msdos/Makefile objects/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regtest/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineconsole/Makefile programs/winemine/Makefile programs/winetest/Makefile programs/winhelp/Makefile programs/winver/Makefile relay32/Makefile scheduler/Makefile server/Makefile tools/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wrc/Makefile tsx11/Makefile unicode/Makefile win32/Makefile windows/Makefile windows/x11drv/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -10187,7 +10292,7 @@ DEFS=-DHAVE_CONFIG_H
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:10190: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:10295: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -10363,7 +10468,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:10366: error: ambiguous option: $1
+    { { echo "$as_me:10471: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -10382,7 +10487,7 @@ Try \`$0 --help' for more information." >&2;}
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:10385: error: unrecognized option: $1
+  -*) { { echo "$as_me:10490: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -10508,6 +10613,7 @@ do
   "dlls/winmm/mciwave/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mciwave/Makefile" ;;
   "dlls/winmm/midimap/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/midimap/Makefile" ;;
   "dlls/winmm/wavemap/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/wavemap/Makefile" ;;
+  "dlls/winmm/winearts/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/winearts/Makefile" ;;
   "dlls/winmm/wineoss/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/wineoss/Makefile" ;;
   "dlls/winnls/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winnls/Makefile" ;;
   "dlls/winsock/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winsock/Makefile" ;;
@@ -10587,7 +10693,7 @@ do
   "programs/winetest/tests" ) CONFIG_COMMANDS="$CONFIG_COMMANDS programs/winetest/tests" ;;
   "include/wine/version.h" ) CONFIG_COMMANDS="$CONFIG_COMMANDS include/wine/version.h" ;;
   "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
-  *) { { echo "$as_me:10590: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:10696: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -10725,6 +10831,9 @@ s,@ft_devel@,$ft_devel,;t t
 s,@ft_devel2@,$ft_devel2,;t t
 s,@FREETYPELIBS@,$FREETYPELIBS,;t t
 s,@FREETYPEINCL@,$FREETYPEINCL,;t t
+s,@ARTSCCONFIG@,$ARTSCCONFIG,;t t
+s,@ARTSLIBS@,$ARTSLIBS,;t t
+s,@ARTSINCL@,$ARTSINCL,;t t
 s,@DLLWRAP@,$DLLWRAP,;t t
 s,@DLLFLAGS@,$DLLFLAGS,;t t
 s,@DLLEXT@,$DLLEXT,;t t
@@ -10853,7 +10962,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:10856: creating $ac_file" >&5
+    { echo "$as_me:10965: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -10871,7 +10980,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:10874: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:10983: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -10884,7 +10993,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:10887: error: cannot find input file: $f" >&5
+           { { echo "$as_me:10996: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -10945,7 +11054,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:10948: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:11057: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -10956,7 +11065,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:10959: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:11068: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -10969,7 +11078,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:10972: error: cannot find input file: $f" >&5
+           { { echo "$as_me:11081: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -11086,7 +11195,7 @@ cat >>$CONFIG_STATUS <<\EOF
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:11089: $ac_file is unchanged" >&5
+      { echo "$as_me:11198: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
@@ -11137,50 +11246,50 @@ for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
   ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
 
   case $ac_dest in
-    dlls/ddraw/d3ddevice ) test -d "dlls/ddraw/d3ddevice" || ({ echo "$as_me:11140: creating dlls/ddraw/d3ddevice" >&5
+    dlls/ddraw/d3ddevice ) test -d "dlls/ddraw/d3ddevice" || ({ echo "$as_me:11249: creating dlls/ddraw/d3ddevice" >&5
 echo "$as_me: creating dlls/ddraw/d3ddevice" >&6;} && mkdir "dlls/ddraw/d3ddevice") ;;
-    dlls/ddraw/dclipper ) test -d "dlls/ddraw/dclipper" || ({ echo "$as_me:11142: creating dlls/ddraw/dclipper" >&5
+    dlls/ddraw/dclipper ) test -d "dlls/ddraw/dclipper" || ({ echo "$as_me:11251: creating dlls/ddraw/dclipper" >&5
 echo "$as_me: creating dlls/ddraw/dclipper" >&6;} && mkdir "dlls/ddraw/dclipper") ;;
-    dlls/ddraw/ddraw ) test -d "dlls/ddraw/ddraw" || ({ echo "$as_me:11144: creating dlls/ddraw/ddraw" >&5
+    dlls/ddraw/ddraw ) test -d "dlls/ddraw/ddraw" || ({ echo "$as_me:11253: creating dlls/ddraw/ddraw" >&5
 echo "$as_me: creating dlls/ddraw/ddraw" >&6;} && mkdir "dlls/ddraw/ddraw") ;;
-    dlls/ddraw/direct3d ) test -d "dlls/ddraw/direct3d" || ({ echo "$as_me:11146: creating dlls/ddraw/direct3d" >&5
+    dlls/ddraw/direct3d ) test -d "dlls/ddraw/direct3d" || ({ echo "$as_me:11255: creating dlls/ddraw/direct3d" >&5
 echo "$as_me: creating dlls/ddraw/direct3d" >&6;} && mkdir "dlls/ddraw/direct3d") ;;
-    dlls/ddraw/dpalette ) test -d "dlls/ddraw/dpalette" || ({ echo "$as_me:11148: creating dlls/ddraw/dpalette" >&5
+    dlls/ddraw/dpalette ) test -d "dlls/ddraw/dpalette" || ({ echo "$as_me:11257: creating dlls/ddraw/dpalette" >&5
 echo "$as_me: creating dlls/ddraw/dpalette" >&6;} && mkdir "dlls/ddraw/dpalette") ;;
-    dlls/ddraw/dsurface ) test -d "dlls/ddraw/dsurface" || ({ echo "$as_me:11150: creating dlls/ddraw/dsurface" >&5
+    dlls/ddraw/dsurface ) test -d "dlls/ddraw/dsurface" || ({ echo "$as_me:11259: creating dlls/ddraw/dsurface" >&5
 echo "$as_me: creating dlls/ddraw/dsurface" >&6;} && mkdir "dlls/ddraw/dsurface") ;;
-    dlls/dinput/joystick ) test -d "dlls/dinput/joystick" || ({ echo "$as_me:11152: creating dlls/dinput/joystick" >&5
+    dlls/dinput/joystick ) test -d "dlls/dinput/joystick" || ({ echo "$as_me:11261: creating dlls/dinput/joystick" >&5
 echo "$as_me: creating dlls/dinput/joystick" >&6;} && mkdir "dlls/dinput/joystick") ;;
-    dlls/dinput/keyboard ) test -d "dlls/dinput/keyboard" || ({ echo "$as_me:11154: creating dlls/dinput/keyboard" >&5
+    dlls/dinput/keyboard ) test -d "dlls/dinput/keyboard" || ({ echo "$as_me:11263: creating dlls/dinput/keyboard" >&5
 echo "$as_me: creating dlls/dinput/keyboard" >&6;} && mkdir "dlls/dinput/keyboard") ;;
-    dlls/dinput/mouse ) test -d "dlls/dinput/mouse" || ({ echo "$as_me:11156: creating dlls/dinput/mouse" >&5
+    dlls/dinput/mouse ) test -d "dlls/dinput/mouse" || ({ echo "$as_me:11265: creating dlls/dinput/mouse" >&5
 echo "$as_me: creating dlls/dinput/mouse" >&6;} && mkdir "dlls/dinput/mouse") ;;
-    dlls/kernel/messages ) test -d "dlls/kernel/messages" || ({ echo "$as_me:11158: creating dlls/kernel/messages" >&5
+    dlls/kernel/messages ) test -d "dlls/kernel/messages" || ({ echo "$as_me:11267: creating dlls/kernel/messages" >&5
 echo "$as_me: creating dlls/kernel/messages" >&6;} && mkdir "dlls/kernel/messages") ;;
-    dlls/kernel/tests ) test -d "dlls/kernel/tests" || ({ echo "$as_me:11160: creating dlls/kernel/tests" >&5
+    dlls/kernel/tests ) test -d "dlls/kernel/tests" || ({ echo "$as_me:11269: creating dlls/kernel/tests" >&5
 echo "$as_me: creating dlls/kernel/tests" >&6;} && mkdir "dlls/kernel/tests") ;;
-    dlls/user/dde ) test -d "dlls/user/dde" || ({ echo "$as_me:11162: creating dlls/user/dde" >&5
+    dlls/user/dde ) test -d "dlls/user/dde" || ({ echo "$as_me:11271: creating dlls/user/dde" >&5
 echo "$as_me: creating dlls/user/dde" >&6;} && mkdir "dlls/user/dde") ;;
-    dlls/user/resources ) test -d "dlls/user/resources" || ({ echo "$as_me:11164: creating dlls/user/resources" >&5
+    dlls/user/resources ) test -d "dlls/user/resources" || ({ echo "$as_me:11273: creating dlls/user/resources" >&5
 echo "$as_me: creating dlls/user/resources" >&6;} && mkdir "dlls/user/resources") ;;
-    dlls/user/tests ) test -d "dlls/user/tests" || ({ echo "$as_me:11166: creating dlls/user/tests" >&5
+    dlls/user/tests ) test -d "dlls/user/tests" || ({ echo "$as_me:11275: creating dlls/user/tests" >&5
 echo "$as_me: creating dlls/user/tests" >&6;} && mkdir "dlls/user/tests") ;;
-    dlls/wineps/data ) test -d "dlls/wineps/data" || ({ echo "$as_me:11168: creating dlls/wineps/data" >&5
+    dlls/wineps/data ) test -d "dlls/wineps/data" || ({ echo "$as_me:11277: creating dlls/wineps/data" >&5
 echo "$as_me: creating dlls/wineps/data" >&6;} && mkdir "dlls/wineps/data") ;;
-    include/wine ) test -d "include/wine" || ({ echo "$as_me:11170: creating include/wine" >&5
+    include/wine ) test -d "include/wine" || ({ echo "$as_me:11279: creating include/wine" >&5
 echo "$as_me: creating include/wine" >&6;} && mkdir "include/wine") ;;
-    programs/regapi/tests ) test -d "programs/regapi/tests" || ({ echo "$as_me:11172: creating programs/regapi/tests" >&5
+    programs/regapi/tests ) test -d "programs/regapi/tests" || ({ echo "$as_me:11281: creating programs/regapi/tests" >&5
 echo "$as_me: creating programs/regapi/tests" >&6;} && mkdir "programs/regapi/tests") ;;
-    programs/winetest/tests ) test -d "programs/winetest/tests" || ({ echo "$as_me:11174: creating programs/winetest/tests" >&5
+    programs/winetest/tests ) test -d "programs/winetest/tests" || ({ echo "$as_me:11283: creating programs/winetest/tests" >&5
 echo "$as_me: creating programs/winetest/tests" >&6;} && mkdir "programs/winetest/tests") ;;
-    include/wine/version.h ) { echo "$as_me:11176: creating include/wine/version.h" >&5
+    include/wine/version.h ) { echo "$as_me:11285: creating include/wine/version.h" >&5
 echo "$as_me: creating include/wine/version.h" >&6;}
 cat >$tmp/version.h <<CEOF
 /* Generated automatically by configure; DO NOT EDIT! */
 #define WINE_RELEASE_INFO "Wine version $wine_version"
 CEOF
 if cmp -s $tmp/version.h include/wine/version.h 2>/dev/null; then
-  { echo "$as_me:11183: include/wine/version.h is unchanged" >&5
+  { echo "$as_me:11292: include/wine/version.h is unchanged" >&5
 echo "$as_me: include/wine/version.h is unchanged" >&6;}
   rm -f $tmp/version.h
 else
diff --git a/configure.ac b/configure.ac
index 3007ac25b9ae1495da75ee2d2ec286dddf511306..3c247be8db0a12d096c5e7321052de58578481d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,6 +510,37 @@ then
     AC_DEFINE(HAVE_OSS_MIDI, 1, [Define if you have the Open Sound system (MIDI interface)])
 fi
 
+dnl **** Check for aRts Sound Server ****
+AC_PATH_PROG(ARTSCCONFIG, artsc-config)
+AC_CACHE_CHECK([for aRts Sound server],
+        ac_cv_c_artsserver,
+        if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"';
+        then
+            ac_cv_c_artsserver=no
+        else
+            ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
+            ARTSC_LIBS=`$ARTSCCONFIG --libs`
+            ac_cv_c_artsserver=no
+            save_CFLAGS="$CFLAGS"
+            CFLAGS="$CFLAGS $ARTSC_CFLAGS"
+            AC_TRY_COMPILE([
+             #include <artsc.h>
+            ],[
+             arts_stream_t stream;
+            ],[
+            ac_cv_c_artsserver=yes
+            ])
+            CFLAGS="$save_CFLAGS"
+        fi)
+
+if test "$ac_cv_c_artsserver" = "yes"
+then
+    AC_SUBST(ARTSLIBS, $ARTSC_LIBS)
+    AC_SUBST(ARTSINCL, $ARTSC_CFLAGS)
+
+    AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])
+fi
+
 dnl **** Check for broken glibc mmap64 ****
 
 AC_CACHE_CHECK( [whether mmap64 works defined as mmap], ac_cv_mmap64_works,
@@ -1317,6 +1348,7 @@ dlls/winmm/mciseq/Makefile
 dlls/winmm/mciwave/Makefile
 dlls/winmm/midimap/Makefile
 dlls/winmm/wavemap/Makefile
+dlls/winmm/winearts/Makefile
 dlls/winmm/wineoss/Makefile
 dlls/winnls/Makefile
 dlls/winsock/Makefile
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 64e530853fff6a8d5cb9bd1e4c2a269a0077a9ac..f14982bcdba1287a38626038a5bf7c54793c4afd 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -87,6 +87,7 @@ SUBDIRS = \
 	winmm/mciwave \
 	winmm/midimap \
 	winmm/wavemap \
+	winmm/winearts \
 	winmm/wineoss \
 	winnls \
 	winsock \
@@ -207,6 +208,7 @@ all: \
 	win87em.dll$(DLLEXT) \
 	winaspi.dll$(DLLEXT) \
 	windebug.dll$(DLLEXT) \
+	winearts.drv$(DLLEXT) \
 	winedos.dll$(DLLEXT) \
 	wineoss.drv$(DLLEXT) \
 	wineps.dll$(DLLEXT) \
@@ -440,6 +442,9 @@ version.dll$(DLLEXT) ver.dll$(DLLEXT): version/version.dll$(DLLEXT)
 w32skrnl.dll$(DLLEXT) w32sys.dll$(DLLEXT) win32s16.dll$(DLLEXT): win32s/w32skrnl.dll$(DLLEXT)
 	$(RM) $@ && $(LN_S) win32s/w32skrnl.dll$(DLLEXT) $@
 
+winearts.drv$(DLLEXT): winmm/winearts/winearts.drv$(DLLEXT)
+	$(RM) $@ && $(LN_S) winmm/winearts/winearts.drv$(DLLEXT) $@
+
 winedos.dll$(DLLEXT): winedos/winedos.dll$(DLLEXT)
 	$(RM) $@ && $(LN_S) winedos/winedos.dll$(DLLEXT) $@
 
@@ -753,6 +758,10 @@ winmm/wavemap/msacm.drv$(DLLEXT): dummy msacm32.dll$(DLLEXT) winmm.dll$(DLLEXT)
   user32.dll$(DLLEXT) kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
 	@cd winmm/wavemap && $(MAKE) msacm.drv$(DLLEXT)
 
+winmm/winearts/winearts.drv$(DLLEXT): dummy winmm.dll$(DLLEXT) user32.dll$(DLLEXT) \
+  kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
+	@cd winmm/winearts && $(MAKE) winearts.drv$(DLLEXT)
+
 winmm/wineoss/wineoss.drv$(DLLEXT): dummy winmm.dll$(DLLEXT) user32.dll$(DLLEXT) \
   kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
 	@cd winmm/wineoss && $(MAKE) wineoss.drv$(DLLEXT)
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index 25448d64d189e7863ed66ee049929c01ecaa1d9c..3ba4aca8fc5c7cedcd9bf31655876062742e33c9 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -294,7 +294,7 @@ HRESULT WINAPI DirectSoundEnumerateA(
 
 #ifdef HAVE_OSS
 	if (lpDSEnumCallback != NULL)
-		lpDSEnumCallback(NULL,"WINE DirectSound using Open Sound System",
+		lpDSEnumCallback(NULL,"WINE DirectSound",
 		    "sound",lpContext);
 #endif
 
diff --git a/dlls/winmm/winearts/.cvsignore b/dlls/winmm/winearts/.cvsignore
new file mode 100644
index 0000000000000000000000000000000000000000..3a5385a27913f984e70b5fa0bfa9b0e205297041
--- /dev/null
+++ b/dlls/winmm/winearts/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+winearts.drv.spec.c
diff --git a/dlls/winmm/winearts/Makefile.in b/dlls/winmm/winearts/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..1f1538ca7d8ad8432c8720b1550db65098156dee
--- /dev/null
+++ b/dlls/winmm/winearts/Makefile.in
@@ -0,0 +1,18 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = winearts.drv
+EXTRADEFS = @ARTSINCL@
+EXTRALIBS = @ARTSLIBS@
+
+LDDLLFLAGS = @LDDLLFLAGS@
+SYMBOLFILE = $(MODULE).tmp.o
+
+C_SRCS = \
+	arts.c \
+	audio.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
diff --git a/dlls/winmm/winearts/arts.c b/dlls/winmm/winearts/arts.c
new file mode 100644
index 0000000000000000000000000000000000000000..f49ceb3e4278d4400e3573671eaae409a40ee1b2
--- /dev/null
+++ b/dlls/winmm/winearts/arts.c
@@ -0,0 +1,93 @@
+/* -*- tab-width: 8; c-basic-offset: 4 -*- */
+/*				   
+ * Wine Driver for aRts Sound Server
+ *   http://www.arts-project.org
+ *
+ * Copyright 2002 Chris Morgan<cmorgan@alum.wpi.edu>
+ * Code massively copied from Eric Pouech's OSS driver
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "mmddk.h"
+#include "arts.h"
+
+#ifdef HAVE_ARTS
+static		int arts = 0;
+
+/**************************************************************************
+ * 				ARTS_drvOpen			[internal]	
+ */
+static	DWORD	ARTS_drvOpen(LPSTR str)
+{
+    if (arts)
+	return 0;
+    
+    /* I know, this is ugly, but who cares... */
+    arts = 1;
+    return 1;
+}
+
+/**************************************************************************
+ * 				ARTS_drvClose			[internal]	
+ */
+static	DWORD	ARTS_drvClose(DWORD dwDevID)
+{
+    if (arts) {
+	arts = 0;
+	return 1;
+    }
+    return 0;
+}
+#endif /* #ifdef HAVE_ARTS */
+
+
+/**************************************************************************
+ * 				DriverProc (WINEARTS.@)
+ */
+LONG CALLBACK	ARTS_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, 
+			       DWORD dwParam1, DWORD dwParam2)
+{
+/* EPP     TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n",  */
+/* EPP 	  dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
+    
+    switch(wMsg) {
+#ifdef HAVE_ARTS
+    case DRV_LOAD:		ARTS_WaveInit();
+/*    				ARTS_MidiInit(); FIXME: no midi 
+support in artsc so we don't have any in the arts driver */
+				return 1;
+    case DRV_FREE:	        return ARTS_CloseDevice();
+    case DRV_OPEN:		return ARTS_drvOpen((LPSTR)dwParam1);
+    case DRV_CLOSE:		return ARTS_drvClose(dwDevID);
+    case DRV_ENABLE:		return 1;
+    case DRV_DISABLE:		return 1;
+    case DRV_QUERYCONFIGURE:	return 1;
+    case DRV_CONFIGURE:		MessageBoxA(0, "aRts MultiMedia Driver!", "aRts Driver", MB_OK);	return 1;
+    case DRV_INSTALL:		return DRVCNF_RESTART;
+    case DRV_REMOVE:		return DRVCNF_RESTART;
+#endif
+    default:
+	return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
+    }
+}
+
+
diff --git a/dlls/winmm/winearts/arts.h b/dlls/winmm/winearts/arts.h
new file mode 100644
index 0000000000000000000000000000000000000000..b090053bfd75b5c8cf0d3dfaeb3f7b2985e7d807
--- /dev/null
+++ b/dlls/winmm/winearts/arts.h
@@ -0,0 +1,34 @@
+/* Definition for aRts drivers : wine multimedia system
+ *
+ * Copyright 2002 Chris Morgan<cmorgan@alum.wpi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __WINE_ARTS_H
+#define __WINE_ARTS_H
+
+#ifndef __WINE_CONFIG_H
+# error You must include config.h to use this header
+#endif
+
+#ifdef HAVE_SYS_ERRNO_H
+#include <sys/errno.h>
+#endif
+
+extern LONG ARTS_WaveInit(void);
+extern LONG ARTS_CloseDevice(void);
+
+#endif  /* __WINE_ARTS_H */
diff --git a/dlls/winmm/winearts/audio.c b/dlls/winmm/winearts/audio.c
new file mode 100644
index 0000000000000000000000000000000000000000..80ba610296a32cd78ed4ba56085e0ced3db67a63
--- /dev/null
+++ b/dlls/winmm/winearts/audio.c
@@ -0,0 +1,1429 @@
+/* -*- tab-width: 8; c-basic-offset: 4 -*- */
+/*				   
+ * Wine Driver for aRts Sound Server
+ *   http://www.arts-project.org
+ *
+ * Copyright 1994 Martin Ayotte
+ *           1999 Eric Pouech (async playing in waveOut/waveIn)
+ *	     2000 Eric Pouech (loops in waveOut)
+ *	     2002 Chris Morgan (aRts version of this file)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/*
+ * FIXME:
+ *	pause in waveOut does not work correctly in loop mode
+ *
+ * TODO:
+ *	implement wave-in support with artsc
+ *      only one sound card is currently supported, add more
+ */
+
+/*#define EMULATE_SB16*/
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "windef.h"
+#include "wingdi.h"
+#include "winerror.h"
+#include "wine/winuser16.h"
+#include "mmddk.h"
+#include "dsound.h"
+#include "dsdriver.h"
+#include "arts.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wave);
+
+/* Allow 1% deviation for sample rates (some ES137x cards) */
+#define NEAR_MATCH(rate1,rate2) (((100*((int)(rate1)-(int)(rate2)))/(rate1))==0)
+
+#ifdef HAVE_ARTS
+
+#include <artsc.h>
+
+#define	BUFFER_SIZE		16 * 1024
+#define SPACE_THRESHOLD 	5 * 1024
+
+#define MAX_WAVEOUTDRV 	(1)
+
+/* state diagram for waveOut writing:
+ *
+ * +---------+-------------+---------------+---------------------------------+
+ * |  state  |  function   |     event     |            new state	     |
+ * +---------+-------------+---------------+---------------------------------+
+ * |	     | open()	   |		   | STOPPED		       	     |
+ * | PAUSED  | write()	   | 		   | PAUSED		       	     |
+ * | STOPPED | write()	   | <thrd create> | PLAYING		  	     |
+ * | PLAYING | write()	   | HEADER        | PLAYING		  	     |
+ * | (other) | write()	   | <error>       |		       		     |
+ * | (any)   | pause()	   | PAUSING	   | PAUSED		       	     |
+ * | PAUSED  | restart()   | RESTARTING    | PLAYING (if no thrd => STOPPED) |
+ * | (any)   | reset()	   | RESETTING     | STOPPED		      	     |
+ * | (any)   | close()	   | CLOSING	   | CLOSED		      	     |
+ * +---------+-------------+---------------+---------------------------------+
+ */
+
+/* states of the playing device */
+#define	WINE_WS_PLAYING		0
+#define	WINE_WS_PAUSED		1
+#define	WINE_WS_STOPPED		2
+#define WINE_WS_CLOSED		3
+
+/* events to be send to device */
+enum win_wm_message {
+    WINE_WM_PAUSING = WM_USER + 1, WINE_WM_RESTARTING, WINE_WM_RESETTING, WINE_WM_HEADER,
+    WINE_WM_UPDATE, WINE_WM_BREAKLOOP, WINE_WM_CLOSING
+};
+
+typedef struct {
+    enum win_wm_message 	msg;	/* message identifier */
+    DWORD	                param;  /* parameter for this message */
+    HANDLE	                hEvent;	/* if message is synchronous, handle of event for synchro */
+} RING_MSG;
+
+/* implement an in-process message ring for better performance 
+ * (compared to passing thru the server)
+ * this ring will be used by the input (resp output) record (resp playback) routine
+ */
+typedef struct {
+#define ARTS_RING_BUFFER_SIZE	30
+    RING_MSG			messages[ARTS_RING_BUFFER_SIZE];
+    int				msg_tosave;
+    int				msg_toget;
+    HANDLE			msg_event;
+    CRITICAL_SECTION		msg_crst;
+} ARTS_MSG_RING;
+
+typedef struct {
+    volatile int		state;			/* one of the WINE_WS_ manifest constants */
+    WAVEOPENDESC		waveDesc;
+    WORD			wFlags;
+    PCMWAVEFORMAT		format;
+    WAVEOUTCAPSA		caps;
+
+    /* arts information */
+    arts_stream_t 		play_stream;		/* the stream structure we get from arts when opening a stream for playing */
+    DWORD                       dwBufferSize;           /* size of whole buffer in bytes */
+
+    char*			sound_buffer;
+    long			buffer_size;
+
+
+    DWORD			volume_left;		/* volume control information */
+    DWORD			volume_right;
+
+    LPWAVEHDR			lpQueuePtr;		/* start of queued WAVEHDRs (waiting to be notified) */
+    LPWAVEHDR			lpPlayPtr;		/* start of not yet fully played buffers */
+    DWORD			dwPartialOffset;	/* Offset of not yet written bytes in lpPlayPtr */
+
+    LPWAVEHDR			lpLoopPtr;              /* pointer of first buffer in loop, if any */
+    DWORD			dwLoops;		/* private copy of loop counter */
+    
+    DWORD			dwPlayedTotal;		/* number of bytes actually played since opening */
+    DWORD                       dwWrittenTotal;         /* number of bytes written to the audio device since opening */
+
+    /* synchronization stuff */
+    HANDLE			hStartUpEvent;
+    HANDLE			hThread;
+    DWORD			dwThreadID;
+    ARTS_MSG_RING		msgRing;
+} WINE_WAVEOUT;
+
+static WINE_WAVEOUT	WOutDev   [MAX_WAVEOUTDRV];
+
+static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv);
+ 
+/* These strings used only for tracing */
+static const char *wodPlayerCmdString[] = {
+    "WINE_WM_PAUSING",
+    "WINE_WM_RESTARTING",
+    "WINE_WM_RESETTING",
+    "WINE_WM_HEADER",
+    "WINE_WM_UPDATE",
+    "WINE_WM_BREAKLOOP",
+    "WINE_WM_CLOSING",
+};
+
+/*======================================================================*
+ *                  Low level WAVE implementation			*
+ *======================================================================*/
+
+/* Volume functions derived from Alsaplayer source */
+/* length is the number of 16 bit samples */
+void volume_effect16(void *bufin, void* bufout, int length, int left,
+		int right, int 	nChannels)
+{
+  short *d_out = (short *)bufout;
+  short *d_in = (short *)bufin;
+  int i, v;
+
+/*
+  TRACE("length == %d, nChannels == %d\n", length, nChannels);
+*/
+
+  if (right == -1) right = left;
+                 
+  for(i = 0; i < length; i+=(nChannels))
+  {
+    v = (int) ((*(d_in++) * left) / 100);
+    *(d_out++) = (v>32767) ? 32767 : ((v<-32768) ? -32768 : v);
+    if(nChannels == 2)
+    {
+      v = (int) ((*(d_in++) * right) / 100);
+      *(d_out++) = (v>32767) ? 32767 : ((v<-32768) ? -32768 : v);
+    }
+  }
+}
+
+/* length is the number of 8 bit samples */
+void volume_effect8(void *bufin, void* bufout, int length, int left,
+		int right, int 	nChannels)
+{
+  char *d_out = (char *)bufout;
+  char *d_in = (char *)bufin;
+  int i, v;
+
+/*
+  TRACE("length == %d, nChannels == %d\n", length, nChannels);
+*/
+                        
+  if (right == -1) right = left;
+                 
+  for(i = 0; i < length; i+=(nChannels))
+  {
+    v = (char) ((*(d_in++) * left) / 100);
+    *(d_out++) = (v>127) ? 127 : ((v<-128) ? -128 : v);
+    if(nChannels == 2)
+    {
+      v = (char) ((*(d_in++) * right) / 100);
+      *(d_out++) = (v>127) ? 127 : ((v<-128) ? -128 : v);
+    }
+  }
+}
+
+/******************************************************************
+ *		ARTS_OpenDevice
+ */
+static int	ARTS_OpenDevice(void)
+{
+  return arts_init();  /* initialize arts and return errorcode */
+}
+
+/******************************************************************
+ *		ARTS_CloseDevice
+ *
+ */
+LONG	ARTS_CloseDevice(void)
+{
+    arts_free();    /* free up arts */
+    return 1;
+}
+
+/******************************************************************
+ *		ARTS_WaveInit
+ *
+ * Initialize internal structures from ARTS server info
+ */
+LONG ARTS_WaveInit(void)
+{
+    int 	i;
+    int		errorcode;
+
+    TRACE("called\n");
+    
+    /* start with output device */
+
+    /* initialize all device handles to -1 */
+    for (i = 0; i < MAX_WAVEOUTDRV; ++i)
+	WOutDev[i].play_stream = (arts_stream_t*)-1;
+
+    /* FIXME: only one device is supported */
+    memset(&WOutDev[0].caps, 0, sizeof(WOutDev[0].caps));
+
+    if ((errorcode = ARTS_OpenDevice()) < 0)
+    {
+	ERR("arts_init() failed (%d)\n", errorcode);
+         return -1;
+    }
+
+    /* FIXME: some programs compare this string against the content of the registry
+     * for MM drivers. The names have to match in order for the program to work 
+     * (e.g. MS win9x mplayer.exe)
+     */
+#ifdef EMULATE_SB16
+    WOutDev[0].caps.wMid = 0x0002;
+    WOutDev[0].caps.wPid = 0x0104;
+    strcpy(WOutDev[0].caps.szPname, "SB16 Wave Out");
+#else
+    WOutDev[0].caps.wMid = 0x00FF; 	/* Manufac ID */
+    WOutDev[0].caps.wPid = 0x0001; 	/* Product ID */
+    /*    strcpy(WOutDev[0].caps.szPname, "OpenSoundSystem WAVOUT Driver");*/
+    strcpy(WOutDev[0].caps.szPname, "CS4236/37/38");
+#endif
+    WOutDev[0].caps.vDriverVersion = 0x0100;
+    WOutDev[0].caps.dwFormats = 0x00000000;
+    WOutDev[0].caps.dwSupport = WAVECAPS_VOLUME;
+    
+    WOutDev[0].caps.wChannels = 2;
+    WOutDev[0].caps.dwSupport |= WAVECAPS_LRVOLUME;
+
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4S08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4S16;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_4M16;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2M08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2S08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2M16;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_2S16;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1M08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1S08;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1M16;
+    WOutDev[0].caps.dwFormats |= WAVE_FORMAT_1S16;
+
+    return 0;
+}
+
+/******************************************************************
+ *		ARTS_InitRingMessage
+ *
+ * Initialize the ring of messages for passing between driver's caller and playback/record
+ * thread
+ */
+static int ARTS_InitRingMessage(ARTS_MSG_RING* mr)
+{
+    mr->msg_toget = 0;
+    mr->msg_tosave = 0;
+    mr->msg_event = CreateEventA(NULL, FALSE, FALSE, NULL);
+    memset(mr->messages, 0, sizeof(RING_MSG) * ARTS_RING_BUFFER_SIZE);
+    InitializeCriticalSection(&mr->msg_crst);
+    return 0;
+}
+
+/******************************************************************
+ *		ARTS_DestroyRingMessage
+ *
+ */
+static int ARTS_DestroyRingMessage(ARTS_MSG_RING* mr)
+{
+    CloseHandle(mr->msg_event);
+    DeleteCriticalSection(&mr->msg_crst);
+    return 0;
+}
+
+/******************************************************************
+ *		ARTS_AddRingMessage
+ *
+ * Inserts a new message into the ring (should be called from DriverProc derivated routines)
+ */
+static int ARTS_AddRingMessage(ARTS_MSG_RING* mr, enum win_wm_message msg, DWORD param, BOOL wait)
+{
+    HANDLE      hEvent = INVALID_HANDLE_VALUE;
+        
+    EnterCriticalSection(&mr->msg_crst);
+    if ((mr->msg_toget == ((mr->msg_tosave + 1) % ARTS_RING_BUFFER_SIZE))) /* buffer overflow? */
+    {
+        ERR("buffer overflow !?\n");
+        LeaveCriticalSection(&mr->msg_crst);
+        return 0;
+    }
+    if (wait)
+    {
+        hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
+        if (hEvent == INVALID_HANDLE_VALUE)
+        {
+            ERR("can't create event !?\n");
+            LeaveCriticalSection(&mr->msg_crst);
+            return 0;
+        }
+        if (mr->msg_toget != mr->msg_tosave && mr->messages[mr->msg_toget].msg != WINE_WM_HEADER)
+            FIXME("two fast messages in the queue!!!!\n");
+     
+        /* fast messages have to be added at the start of the queue */
+        mr->msg_toget = (mr->msg_toget + ARTS_RING_BUFFER_SIZE - 1) % ARTS_RING_BUFFER_SIZE;
+
+        mr->messages[mr->msg_toget].msg = msg;
+        mr->messages[mr->msg_toget].param = param;
+        mr->messages[mr->msg_toget].hEvent = hEvent;
+    }
+    else
+    {
+        mr->messages[mr->msg_tosave].msg = msg;
+        mr->messages[mr->msg_tosave].param = param;
+        mr->messages[mr->msg_tosave].hEvent = INVALID_HANDLE_VALUE;
+        mr->msg_tosave = (mr->msg_tosave + 1) % ARTS_RING_BUFFER_SIZE;
+    }
+
+    LeaveCriticalSection(&mr->msg_crst);
+
+    SetEvent(mr->msg_event);    /* signal a new message */
+
+    if (wait)
+    {
+        /* wait for playback/record thread to have processed the message */
+        WaitForSingleObject(hEvent, INFINITE);
+        CloseHandle(hEvent);
+    }
+
+    return 1;
+}
+
+/******************************************************************
+ *		ARTS_RetrieveRingMessage
+ *
+ * Get a message from the ring. Should be called by the playback/record thread.
+ */
+static int ARTS_RetrieveRingMessage(ARTS_MSG_RING* mr, 
+                                   enum win_wm_message *msg, DWORD *param, HANDLE *hEvent)
+{
+    EnterCriticalSection(&mr->msg_crst);
+
+    if (mr->msg_toget == mr->msg_tosave) /* buffer empty ? */
+    {
+        LeaveCriticalSection(&mr->msg_crst);
+	return 0;
+    }
+	
+    *msg = mr->messages[mr->msg_toget].msg;
+    mr->messages[mr->msg_toget].msg = 0;
+    *param = mr->messages[mr->msg_toget].param;
+    *hEvent = mr->messages[mr->msg_toget].hEvent;
+    mr->msg_toget = (mr->msg_toget + 1) % ARTS_RING_BUFFER_SIZE;
+    LeaveCriticalSection(&mr->msg_crst);
+    return 1;
+}
+
+/*======================================================================*
+ *                  Low level WAVE OUT implementation			*
+ *======================================================================*/
+
+/**************************************************************************
+ * 			wodNotifyClient			[internal]
+ */
+static DWORD wodNotifyClient(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dwParam1, DWORD dwParam2)
+{
+    TRACE("wMsg = 0x%04x dwParm1 = %04lX dwParam2 = %04lX\n", wMsg, dwParam1, dwParam2);
+    
+    switch (wMsg) {
+    case WOM_OPEN:
+    case WOM_CLOSE:
+    case WOM_DONE:
+	if (wwo->wFlags != DCB_NULL && 
+	    !DriverCallback(wwo->waveDesc.dwCallback, wwo->wFlags, wwo->waveDesc.hWave, 
+			    wMsg, wwo->waveDesc.dwInstance, dwParam1, dwParam2)) {
+	    WARN("can't notify client !\n");
+	    return MMSYSERR_ERROR;
+	}
+	break;
+    default:
+	FIXME("Unknown callback message %u\n", wMsg);
+        return MMSYSERR_INVALPARAM;
+    }
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodUpdatePlayedTotal	[internal]
+ *
+ */
+static BOOL wodUpdatePlayedTotal(WINE_WAVEOUT* wwo)
+{
+    /* total played is the bytes written less the bytes to write ;-) */
+    wwo->dwPlayedTotal = wwo->dwWrittenTotal - 
+	(wwo->dwBufferSize - 
+	arts_stream_get(wwo->play_stream, ARTS_P_BUFFER_SPACE));
+    return TRUE;
+}
+
+/**************************************************************************
+ * 				wodPlayer_BeginWaveHdr          [internal]
+ *
+ * Makes the specified lpWaveHdr the currently playing wave header.
+ * If the specified wave header is a begin loop and we're not already in
+ * a loop, setup the loop.
+ */
+static void wodPlayer_BeginWaveHdr(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
+{
+    wwo->lpPlayPtr = lpWaveHdr;
+
+    if (!lpWaveHdr) return;
+
+    if (lpWaveHdr->dwFlags & WHDR_BEGINLOOP) {
+	if (wwo->lpLoopPtr) {
+	    WARN("Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr);
+	    TRACE("Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr);
+	} else {
+	    TRACE("Starting loop (%ldx) with %p\n", lpWaveHdr->dwLoops, lpWaveHdr);
+	    wwo->lpLoopPtr = lpWaveHdr;
+	    /* Windows does not touch WAVEHDR.dwLoops,
+	     * so we need to make an internal copy */
+	    wwo->dwLoops = lpWaveHdr->dwLoops;
+	}
+    }
+    wwo->dwPartialOffset = 0;
+}
+
+/**************************************************************************
+ * 				wodPlayer_PlayPtrNext	        [internal]
+ *
+ * Advance the play pointer to the next waveheader, looping if required.
+ */
+static LPWAVEHDR wodPlayer_PlayPtrNext(WINE_WAVEOUT* wwo)
+{
+    LPWAVEHDR lpWaveHdr = wwo->lpPlayPtr;
+
+    wwo->dwPartialOffset = 0;
+    if ((lpWaveHdr->dwFlags & WHDR_ENDLOOP) && wwo->lpLoopPtr) {
+	/* We're at the end of a loop, loop if required */
+	if (--wwo->dwLoops > 0) {
+	    wwo->lpPlayPtr = wwo->lpLoopPtr;
+	} else {
+	    /* Handle overlapping loops correctly */
+	    if (wwo->lpLoopPtr != lpWaveHdr && (lpWaveHdr->dwFlags & WHDR_BEGINLOOP)) {
+		FIXME("Correctly handled case ? (ending loop buffer also starts a new loop)\n");
+		/* shall we consider the END flag for the closing loop or for
+		 * the opening one or for both ???
+		 * code assumes for closing loop only
+		 */
+	    } else {
+                lpWaveHdr = lpWaveHdr->lpNext;
+            }
+            wwo->lpLoopPtr = NULL;
+            wodPlayer_BeginWaveHdr(wwo, lpWaveHdr);
+	}
+    } else {
+	/* We're not in a loop.  Advance to the next wave header */
+	wodPlayer_BeginWaveHdr(wwo, lpWaveHdr = lpWaveHdr->lpNext);
+    }
+
+    return lpWaveHdr;
+}
+
+/**************************************************************************
+ * 			     wodPlayer_DSPWait			[internal]
+ * Returns the number of milliseconds to wait for the DSP buffer to clear.
+ * This is based on the number of fragments we want to be clear before
+ * writing and the number of free fragments we already have.
+ */
+static DWORD wodPlayer_DSPWait(const WINE_WAVEOUT *wwo)
+{
+	int waitvalue = (wwo->dwBufferSize - arts_stream_get(wwo->play_stream, 
+		ARTS_P_BUFFER_SPACE)) / ((wwo->format.wf.nSamplesPerSec * 
+		wwo->format.wBitsPerSample * wwo->format.wf.nChannels) 
+		/1000);
+
+	/* FIXME: this is a hack since the waitvalue we calculate is too 
+large for some reason.... */
+	waitvalue/=4;
+
+	TRACE("wait value of %d\n", waitvalue);
+
+        /* return the time left to play the buffer */
+	return waitvalue;
+}
+
+/**************************************************************************
+ * 			     wodPlayer_NotifyWait               [internal]
+ * Returns the number of milliseconds to wait before attempting to notify
+ * completion of the specified wavehdr.
+ * This is based on the number of bytes remaining to be written in the
+ * wave.
+ */
+static DWORD wodPlayer_NotifyWait(const WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
+{
+    DWORD dwMillis;    
+
+    if(lpWaveHdr->reserved < wwo->dwPlayedTotal)
+    {
+	dwMillis = 1;
+    }
+    else
+    {
+        dwMillis = (lpWaveHdr->reserved - wwo->dwPlayedTotal) * 1000 / wwo->format.wf.nAvgBytesPerSec;
+	if(!dwMillis) dwMillis = 1;
+    }
+
+    TRACE("dwMillis = %ld\n", dwMillis);
+
+    return dwMillis;
+}
+
+
+/**************************************************************************
+ * 			     wodPlayer_WriteMaxFrags            [internal]
+ * Writes the maximum number of bytes possible to the DSP and returns
+ * the number of bytes written.
+ */
+static int wodPlayer_WriteMaxFrags(WINE_WAVEOUT* wwo, DWORD* bytes)
+{
+    /* Only attempt to write to free bytes */
+    DWORD dwLength = wwo->lpPlayPtr->dwBufferLength - wwo->dwPartialOffset;
+    int toWrite = min(dwLength, *bytes);
+    int written;
+
+    TRACE("Writing wavehdr %p.%lu[%lu]\n", 
+          wwo->lpPlayPtr, wwo->dwPartialOffset, wwo->lpPlayPtr->dwBufferLength);
+
+    /* see if our buffer isn't large enough for the data we are writing */
+    if(wwo->buffer_size < toWrite)
+    {
+      if(wwo->sound_buffer)
+        HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
+    }
+
+    /* if we don't have a buffer then get one */
+    if(!wwo->sound_buffer)
+    {
+      /* allocate some memory for the buffer */
+      wwo->sound_buffer = HeapAlloc(GetProcessHeap(), 0, toWrite);
+      wwo->buffer_size = toWrite;
+    }
+
+    /* if we don't have a buffer then error out */
+    if(!wwo->sound_buffer)
+    {
+      ERR("error allocating sound_buffer memory\n");
+      return 0;
+    }
+
+    TRACE("toWrite == %d\n", toWrite);
+
+    /* apply volume to the bits */
+    /* for single channel audio streams we only use the LEFT volume */
+    if(wwo->format.wBitsPerSample == 16)
+    {
+      /* apply volume to the buffer we are about to send */
+      /* divide toWrite(bytes) by 2 as volume processes by 16 bits */
+      volume_effect16(wwo->lpPlayPtr->lpData + wwo->dwPartialOffset, 
+                wwo->sound_buffer, toWrite>>1, wwo->volume_left, 
+		wwo->volume_right, wwo->format.wf.nChannels);
+    } else if(wwo->format.wBitsPerSample == 8)
+    {
+      /* apply volume to the buffer we are about to send */
+      volume_effect8(wwo->lpPlayPtr->lpData + wwo->dwPartialOffset, 
+                wwo->sound_buffer, toWrite>>1, wwo->volume_left, 
+		wwo->volume_right, wwo->format.wf.nChannels);
+    } else
+    {
+      FIXME("unsupported wwo->format.wBitsPerSample of %d\n", 
+        wwo->format.wBitsPerSample);
+    }
+
+    /* send the audio data to arts for playing */
+    written = arts_write(wwo->play_stream, wwo->sound_buffer, toWrite);
+
+    TRACE("written = %d\n", written);
+
+    if (written <= 0) return written; /* if we wrote nothing just return */
+
+    if (written >= dwLength)
+        wodPlayer_PlayPtrNext(wwo);   /* If we wrote all current wavehdr, skip to the next one */
+    else
+        wwo->dwPartialOffset += written;    /* Remove the amount written */
+
+    *bytes -= written;
+    wwo->dwWrittenTotal += written; /* update stats on this wave device */
+
+    return written; /* return the number of bytes written */
+}
+
+
+/**************************************************************************
+ * 				wodPlayer_NotifyCompletions	[internal]
+ *
+ * Notifies and remove from queue all wavehdrs which have been played to
+ * the speaker (ie. they have cleared the audio device).  If force is true,
+ * we notify all wavehdrs and remove them all from the queue even if they
+ * are unplayed or part of a loop.
+ */
+static DWORD wodPlayer_NotifyCompletions(WINE_WAVEOUT* wwo, BOOL force)
+{
+    LPWAVEHDR		lpWaveHdr;
+
+    /* Start from lpQueuePtr and keep notifying until:
+     * - we hit an unwritten wavehdr
+     * - we hit the beginning of a running loop
+     * - we hit a wavehdr which hasn't finished playing
+     */
+    while ((lpWaveHdr = wwo->lpQueuePtr) && 
+           (force || 
+            (lpWaveHdr != wwo->lpPlayPtr &&
+             lpWaveHdr != wwo->lpLoopPtr &&
+             lpWaveHdr->reserved <= wwo->dwPlayedTotal))) {
+
+	wwo->lpQueuePtr = lpWaveHdr->lpNext;
+
+	lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
+	lpWaveHdr->dwFlags |= WHDR_DONE;
+
+	wodNotifyClient(wwo, WOM_DONE, (DWORD)lpWaveHdr, 0);
+    }
+    return  (lpWaveHdr && lpWaveHdr != wwo->lpPlayPtr && lpWaveHdr != wwo->lpLoopPtr) ? 
+        wodPlayer_NotifyWait(wwo, lpWaveHdr) : INFINITE;
+}
+
+/**************************************************************************
+ * 				wodPlayer_Reset			[internal]
+ *
+ * wodPlayer helper. Resets current output stream.
+ */
+static	void	wodPlayer_Reset(WINE_WAVEOUT* wwo, BOOL reset)
+{
+    wodUpdatePlayedTotal(wwo);
+
+    /* updates current notify list */
+    wodPlayer_NotifyCompletions(wwo, FALSE);
+
+    /* flush all possible output */
+    /* close and open the stream to end the playback and prepare for 
+		new playback */
+    arts_close_stream(wwo->play_stream);
+    wwo->play_stream = arts_play_stream(wwo->format.wf.nSamplesPerSec, 
+	wwo->format.wBitsPerSample, wwo->format.wf.nChannels, "winearts");
+
+    if (reset) {
+        enum win_wm_message     msg;
+        DWORD                   param;
+        HANDLE                  ev;
+
+	/* remove any buffer */
+	wodPlayer_NotifyCompletions(wwo, TRUE);
+
+	wwo->lpPlayPtr = wwo->lpQueuePtr = wwo->lpLoopPtr = NULL;
+	wwo->state = WINE_WS_STOPPED;
+	wwo->dwPlayedTotal = wwo->dwWrittenTotal = 0;
+
+        wwo->dwPartialOffset = 0;        /* Clear partial wavehdr */
+
+        /* remove any existing message in the ring */
+        EnterCriticalSection(&wwo->msgRing.msg_crst);
+
+        /* return all pending headers in queue */
+        while (ARTS_RetrieveRingMessage(&wwo->msgRing, &msg, &param, &ev))
+        {
+	    TRACE("flushing msg\n");
+            if (msg != WINE_WM_HEADER)
+            {
+                FIXME("shouldn't have headers left\n");
+                SetEvent(ev);
+                continue;
+            }
+            ((LPWAVEHDR)param)->dwFlags &= ~WHDR_INQUEUE;
+            ((LPWAVEHDR)param)->dwFlags |= WHDR_DONE;
+        
+            wodNotifyClient(wwo, WOM_DONE, param, 0);
+        }
+        ResetEvent(wwo->msgRing.msg_event);
+        LeaveCriticalSection(&wwo->msgRing.msg_crst);  
+    } else {
+        if (wwo->lpLoopPtr) {
+            /* complicated case, not handled yet (could imply modifying the loop counter */
+            FIXME("Pausing while in loop isn't correctly handled yet, except strange results\n");
+            wwo->lpPlayPtr = wwo->lpLoopPtr;
+            wwo->dwPartialOffset = 0;
+            wwo->dwWrittenTotal = wwo->dwPlayedTotal; /* this is wrong !!! */
+        } else {
+            LPWAVEHDR   ptr;
+            DWORD       sz = wwo->dwPartialOffset;
+
+            /* reset all the data as if we had written only up to lpPlayedTotal bytes */
+            /* compute the max size playable from lpQueuePtr */
+            for (ptr = wwo->lpQueuePtr; ptr != wwo->lpPlayPtr; ptr = ptr->lpNext) {
+                sz += ptr->dwBufferLength;
+            }
+            /* because the reset lpPlayPtr will be lpQueuePtr */
+            if (wwo->dwWrittenTotal > wwo->dwPlayedTotal + sz) ERR("grin\n");
+            wwo->dwPartialOffset = sz - (wwo->dwWrittenTotal - wwo->dwPlayedTotal);
+            wwo->dwWrittenTotal = wwo->dwPlayedTotal;
+            wwo->lpPlayPtr = wwo->lpQueuePtr;
+        }
+	wwo->state = WINE_WS_PAUSED;
+    }
+}
+
+/**************************************************************************
+ * 		      wodPlayer_ProcessMessages			[internal]
+ */
+static void wodPlayer_ProcessMessages(WINE_WAVEOUT* wwo)
+{
+    LPWAVEHDR           lpWaveHdr;
+    enum win_wm_message	msg;
+    DWORD		param;
+    HANDLE		ev;
+
+    while (ARTS_RetrieveRingMessage(&wwo->msgRing, &msg, &param, &ev)) {
+	TRACE("Received %s %lx\n", wodPlayerCmdString[msg - WM_USER - 1], param);
+	switch (msg) {
+	case WINE_WM_PAUSING:
+	    wodPlayer_Reset(wwo, FALSE);
+	    SetEvent(ev);
+	    break;
+	case WINE_WM_RESTARTING:
+	    wwo->state = WINE_WS_PLAYING;
+	    SetEvent(ev);
+	    break;
+	case WINE_WM_HEADER:
+	    lpWaveHdr = (LPWAVEHDR)param;
+	    
+	    /* insert buffer at the end of queue */
+	    {
+		LPWAVEHDR*	wh;
+		for (wh = &(wwo->lpQueuePtr); *wh; wh = &((*wh)->lpNext));
+		*wh = lpWaveHdr;
+	    }
+            if (!wwo->lpPlayPtr)
+                wodPlayer_BeginWaveHdr(wwo,lpWaveHdr);
+	    if (wwo->state == WINE_WS_STOPPED)
+		wwo->state = WINE_WS_PLAYING;
+	    break;
+	case WINE_WM_RESETTING:
+	    wodPlayer_Reset(wwo, TRUE);
+	    SetEvent(ev);
+	    break;
+        case WINE_WM_UPDATE:
+            wodUpdatePlayedTotal(wwo);
+	    SetEvent(ev);
+            break;
+        case WINE_WM_BREAKLOOP:
+            if (wwo->state == WINE_WS_PLAYING && wwo->lpLoopPtr != NULL) {
+                /* ensure exit at end of current loop */
+                wwo->dwLoops = 1;
+            }
+	    SetEvent(ev);
+            break;
+	case WINE_WM_CLOSING:
+	    /* sanity check: this should not happen since the device must have been reset before */
+	    if (wwo->lpQueuePtr || wwo->lpPlayPtr) ERR("out of sync\n");
+	    wwo->hThread = 0;
+	    wwo->state = WINE_WS_CLOSED;
+	    SetEvent(ev);
+	    ExitThread(0);
+	    /* shouldn't go here */
+	default:
+	    FIXME("unknown message %d\n", msg);
+	    break;
+	}
+    }
+}
+
+/**************************************************************************
+ * 			     wodPlayer_FeedDSP			[internal]
+ * Feed as much sound data as we can into the DSP and return the number of
+ * milliseconds before it will be necessary to feed the DSP again.
+ */
+static DWORD wodPlayer_FeedDSP(WINE_WAVEOUT* wwo)
+{
+    DWORD       availInQ;
+
+    wodUpdatePlayedTotal(wwo);
+    availInQ = arts_stream_get(wwo->play_stream, ARTS_P_BUFFER_SPACE);
+    TRACE("availInQ = %ld\n", availInQ);
+
+    /* input queue empty and output buffer with no space */
+    if (!wwo->lpPlayPtr && availInQ) {
+        TRACE("Run out of wavehdr:s... flushing\n");
+        wwo->dwPlayedTotal = wwo->dwWrittenTotal;
+        return INFINITE;
+    }
+
+    /* no more room... no need to try to feed */
+    if(!availInQ)
+    {
+	TRACE("no more room, no need to try to feed\n");
+	return wodPlayer_DSPWait(wwo);
+    }
+
+    /* Feed from partial wavehdr */
+    if (wwo->lpPlayPtr && wwo->dwPartialOffset != 0)
+    {
+        TRACE("feeding from partial wavehdr\n");
+        wodPlayer_WriteMaxFrags(wwo, &availInQ);
+    }
+
+    /* Feed wavehdrs until we run out of wavehdrs or DSP space */
+    if (!wwo->dwPartialOffset)
+    {
+ 	 while(wwo->lpPlayPtr && availInQ > SPACE_THRESHOLD)
+	 {
+	        TRACE("feeding waveheaders until we run out of space\n");
+		/* note the value that dwPlayedTotal will return when this wave finishes playing */
+		wwo->lpPlayPtr->reserved = wwo->dwWrittenTotal + wwo->lpPlayPtr->dwBufferLength;
+		wodPlayer_WriteMaxFrags(wwo, &availInQ);
+	    }
+    }
+
+    return wodPlayer_DSPWait(wwo);
+}
+
+
+/**************************************************************************
+ * 				wodPlayer			[internal]
+ */
+static	DWORD	CALLBACK	wodPlayer(LPVOID pmt)
+{
+    WORD	  uDevID = (DWORD)pmt;
+    WINE_WAVEOUT* wwo = (WINE_WAVEOUT*)&WOutDev[uDevID];
+    DWORD         dwNextFeedTime = INFINITE;   /* Time before DSP needs feeding */
+    DWORD         dwNextNotifyTime = INFINITE; /* Time before next wave completion */
+    DWORD         dwSleepTime;
+
+    wwo->state = WINE_WS_STOPPED;
+    SetEvent(wwo->hStartUpEvent);
+
+    for (;;) {
+        /** Wait for the shortest time before an action is required.  If there
+         *  are no pending actions, wait forever for a command.
+         */
+        dwSleepTime = min(dwNextFeedTime, dwNextNotifyTime);
+        TRACE("waiting %lums (%lu,%lu)\n", dwSleepTime, dwNextFeedTime, dwNextNotifyTime);
+        WaitForSingleObject(wwo->msgRing.msg_event, dwSleepTime);
+	wodPlayer_ProcessMessages(wwo);
+	if (wwo->state == WINE_WS_PLAYING) {
+	    dwNextFeedTime = wodPlayer_FeedDSP(wwo);
+	    dwNextNotifyTime = wodPlayer_NotifyCompletions(wwo, FALSE);
+	} else {
+	    dwNextFeedTime = dwNextNotifyTime = INFINITE;
+	}
+    }
+}
+
+/**************************************************************************
+ * 			wodGetDevCaps				[internal]
+ */
+static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPSA lpCaps, DWORD dwSize)
+{
+    TRACE("(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
+    
+    if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
+    
+    if (wDevID >= MAX_WAVEOUTDRV) {
+	TRACE("MAX_WAVOUTDRV reached !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+
+    memcpy(lpCaps, &WOutDev[wDevID].caps, min(dwSize, sizeof(*lpCaps)));
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodOpen				[internal]
+ */
+static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
+{
+    WINE_WAVEOUT*	wwo;
+
+    TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
+    if (lpDesc == NULL) {
+	WARN("Invalid Parameter !\n");
+	return MMSYSERR_INVALPARAM;
+    }
+    if (wDevID >= MAX_WAVEOUTDRV) {
+	TRACE("MAX_WAVOUTDRV reached !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+
+    /* only PCM format is supported so far... */
+    if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM ||
+	lpDesc->lpFormat->nChannels == 0 ||
+	lpDesc->lpFormat->nSamplesPerSec == 0) {
+	WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n", 
+	     lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
+	     lpDesc->lpFormat->nSamplesPerSec);
+	return WAVERR_BADFORMAT;
+    }
+
+    if (dwFlags & WAVE_FORMAT_QUERY) {
+	TRACE("Query format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n", 
+	     lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
+	     lpDesc->lpFormat->nSamplesPerSec);
+	return MMSYSERR_NOERROR;
+    }
+
+    wwo = &WOutDev[wDevID];
+
+    /* direct sound not supported, ignore the flag */
+    dwFlags &= ~WAVE_DIRECTSOUND;
+
+    wwo->wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
+    
+    memcpy(&wwo->waveDesc, lpDesc, 	     sizeof(WAVEOPENDESC));
+    memcpy(&wwo->format,   lpDesc->lpFormat, sizeof(PCMWAVEFORMAT));
+    
+    if (wwo->format.wBitsPerSample == 0) {
+	WARN("Resetting zeroed wBitsPerSample\n");
+	wwo->format.wBitsPerSample = 8 *
+	    (wwo->format.wf.nAvgBytesPerSec /
+	     wwo->format.wf.nSamplesPerSec) /
+	    wwo->format.wf.nChannels;
+    }
+
+    wwo->play_stream = arts_play_stream(wwo->format.wf.nSamplesPerSec, 
+	wwo->format.wBitsPerSample, wwo->format.wf.nChannels, "winearts");
+
+    /* clear these so we don't have any confusion ;-) */
+    wwo->sound_buffer = 0;
+    wwo->buffer_size = 0;
+
+    arts_stream_set(wwo->play_stream, ARTS_P_BLOCKING, 0);    /* disable blocking on this stream */
+
+    if(!wwo->play_stream) return MMSYSERR_ALLOCATED;
+
+    /* Try to set buffer size from constant and store the value that it 
+	was set to for future use */
+    wwo->dwBufferSize = arts_stream_set(wwo->play_stream, 
+		ARTS_P_BUFFER_SIZE, BUFFER_SIZE);
+    TRACE("Tried to set BUFFER_SIZE of %d, wwo->dwBufferSize is actually 
+	%ld\n", BUFFER_SIZE, wwo->dwBufferSize);
+    wwo->dwPlayedTotal = 0;
+    wwo->dwWrittenTotal = 0;
+
+    ARTS_InitRingMessage(&wwo->msgRing);
+
+    /* create player thread */
+    if (!(dwFlags & WAVE_DIRECTSOUND)) {
+	wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
+	wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
+	WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
+	CloseHandle(wwo->hStartUpEvent);
+    } else {
+	wwo->hThread = INVALID_HANDLE_VALUE;
+	wwo->dwThreadID = 0;
+    }
+    wwo->hStartUpEvent = INVALID_HANDLE_VALUE;
+
+    TRACE("stream=0x%lx, dwBufferSize=%ld\n", 
+	  (long)wwo->play_stream, wwo->dwBufferSize);
+
+    TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u nBlockAlign=%u!\n", 
+	  wwo->format.wBitsPerSample, wwo->format.wf.nAvgBytesPerSec, 
+	  wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels,
+	  wwo->format.wf.nBlockAlign);
+    
+    return wodNotifyClient(wwo, WOM_OPEN, 0L, 0L);
+}
+
+/**************************************************************************
+ * 				wodClose			[internal]
+ */
+static DWORD wodClose(WORD wDevID)
+{
+    DWORD		ret = MMSYSERR_NOERROR;
+    WINE_WAVEOUT*	wwo;
+
+    TRACE("(%u);\n", wDevID);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream  == 
+	(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    wwo = &WOutDev[wDevID];
+    if (wwo->lpQueuePtr) {
+	WARN("buffers still playing !\n");
+	ret = WAVERR_STILLPLAYING;
+    } else {
+	TRACE("imhere[3-close]\n");
+	if (wwo->hThread != INVALID_HANDLE_VALUE) {
+	    ARTS_AddRingMessage(&wwo->msgRing, WINE_WM_CLOSING, 0, TRUE);
+	}
+
+        ARTS_DestroyRingMessage(&wwo->msgRing);
+
+	arts_close_stream(wwo->play_stream); 	/* close the arts stream */
+
+        /* free up the buffer we use for volume and reset the size */
+        if(wwo->sound_buffer)
+	        HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
+        wwo->buffer_size = 0;
+
+	wwo->play_stream = (arts_stream_t*)-1;
+	ret = wodNotifyClient(wwo, WOM_CLOSE, 0L, 0L);
+    }
+    return ret;
+}
+
+/**************************************************************************
+ * 				wodWrite			[internal]
+ * 
+ */
+static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
+{
+    TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
+    
+    /* first, do the sanity checks... */
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+		(arts_stream_t*)-1)
+    {
+        WARN("bad dev ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    if (lpWaveHdr->lpData == NULL || !(lpWaveHdr->dwFlags & WHDR_PREPARED)) 
+    {
+	TRACE("unprepared\n");
+	return WAVERR_UNPREPARED;
+    }
+    
+    if (lpWaveHdr->dwFlags & WHDR_INQUEUE) 
+    {
+	TRACE("still playing\n");
+	return WAVERR_STILLPLAYING;
+    }
+
+    lpWaveHdr->dwFlags &= ~WHDR_DONE;
+    lpWaveHdr->dwFlags |= WHDR_INQUEUE;
+    lpWaveHdr->lpNext = 0;
+
+    TRACE("adding ring message\n");
+    ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_HEADER, (DWORD)lpWaveHdr, FALSE);
+
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodPrepare			[internal]
+ */
+static DWORD wodPrepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
+{
+    TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
+    
+    if (wDevID >= MAX_WAVEOUTDRV) {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
+	return WAVERR_STILLPLAYING;
+    
+    lpWaveHdr->dwFlags |= WHDR_PREPARED;
+    lpWaveHdr->dwFlags &= ~WHDR_DONE;
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodUnprepare			[internal]
+ */
+static DWORD wodUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
+{
+    TRACE("(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
+    
+    if (wDevID >= MAX_WAVEOUTDRV) {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
+	return WAVERR_STILLPLAYING;
+    
+    lpWaveHdr->dwFlags &= ~WHDR_PREPARED;
+    lpWaveHdr->dwFlags |= WHDR_DONE;
+    
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 			wodPause				[internal]
+ */
+static DWORD wodPause(WORD wDevID)
+{
+    TRACE("(%u);!\n", wDevID);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+		(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    TRACE("imhere[3-PAUSING]\n");
+    ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_PAUSING, 0, TRUE);
+    
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 			wodRestart				[internal]
+ */
+static DWORD wodRestart(WORD wDevID)
+{
+    TRACE("(%u);\n", wDevID);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+		(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    if (WOutDev[wDevID].state == WINE_WS_PAUSED) {
+	TRACE("imhere[3-RESTARTING]\n");
+	ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESTARTING, 0, TRUE);
+    }
+    
+    /* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
+    /* FIXME: Myst crashes with this ... hmm -MM
+       return wodNotifyClient(wwo, WOM_DONE, 0L, 0L);
+    */
+    
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 			wodReset				[internal]
+ */
+static DWORD wodReset(WORD wDevID)
+{
+    TRACE("(%u);\n", wDevID);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+	(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    TRACE("imhere[3-RESET]\n");
+    ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_RESETTING, 0, TRUE);
+    
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodGetPosition			[internal]
+ */
+static DWORD wodGetPosition(WORD wDevID, LPMMTIME lpTime, DWORD uSize)
+{
+    int			time;
+    DWORD		val;
+    WINE_WAVEOUT*	wwo;
+
+    TRACE("(%u, %p, %lu);\n", wDevID, lpTime, uSize);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+	(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    
+    if (lpTime == NULL)	return MMSYSERR_INVALPARAM;
+
+    wwo = &WOutDev[wDevID];
+    ARTS_AddRingMessage(&wwo->msgRing, WINE_WM_UPDATE, 0, TRUE);
+    val = wwo->dwPlayedTotal;
+
+    TRACE("wType=%04X wBitsPerSample=%u nSamplesPerSec=%lu nChannels=%u nAvgBytesPerSec=%lu\n", 
+	  lpTime->wType, wwo->format.wBitsPerSample, 
+	  wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels, 
+	  wwo->format.wf.nAvgBytesPerSec); 
+    TRACE("dwPlayedTotal=%lu\n", val);
+    
+    switch (lpTime->wType) {
+    case TIME_BYTES:
+	lpTime->u.cb = val;
+	TRACE("TIME_BYTES=%lu\n", lpTime->u.cb);
+	break;
+    case TIME_SAMPLES:
+	lpTime->u.sample = val * 8 / wwo->format.wBitsPerSample /wwo->format.wf.nChannels;
+	TRACE("TIME_SAMPLES=%lu\n", lpTime->u.sample);
+	break;
+    case TIME_SMPTE:
+	time = val / (wwo->format.wf.nAvgBytesPerSec / 1000);
+	lpTime->u.smpte.hour = time / 108000;
+	time -= lpTime->u.smpte.hour * 108000;
+	lpTime->u.smpte.min = time / 1800;
+	time -= lpTime->u.smpte.min * 1800;
+	lpTime->u.smpte.sec = time / 30;
+	time -= lpTime->u.smpte.sec * 30;
+	lpTime->u.smpte.frame = time;
+	lpTime->u.smpte.fps = 30;
+	TRACE("TIME_SMPTE=%02u:%02u:%02u:%02u\n",
+	      lpTime->u.smpte.hour, lpTime->u.smpte.min,
+	      lpTime->u.smpte.sec, lpTime->u.smpte.frame);
+	break;
+    default:
+	FIXME("Format %d not supported ! use TIME_MS !\n", lpTime->wType);
+	lpTime->wType = TIME_MS;
+    case TIME_MS:
+	lpTime->u.ms = val / (wwo->format.wf.nAvgBytesPerSec / 1000);
+	TRACE("TIME_MS=%lu\n", lpTime->u.ms);
+	break;
+    }
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodBreakLoop			[internal]
+ */
+static DWORD wodBreakLoop(WORD wDevID)
+{
+    TRACE("(%u);\n", wDevID);
+    
+    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].play_stream == 
+		(arts_stream_t*)-1)
+    {
+	WARN("bad device ID !\n");
+	return MMSYSERR_BADDEVICEID;
+    }
+    ARTS_AddRingMessage(&WOutDev[wDevID].msgRing, WINE_WM_BREAKLOOP, 0, TRUE);
+    return MMSYSERR_NOERROR;
+}
+    
+/**************************************************************************
+ * 				wodGetVolume			[internal]
+ */
+static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol)
+{
+    DWORD left, right;
+
+    left = WOutDev[wDevID].volume_left;
+    right = WOutDev[wDevID].volume_right;
+
+    TRACE("(%u, %p);\n", wDevID, lpdwVol);
+
+    *lpdwVol = ((left * 0xFFFFl) / 100) + (((right * 0xFFFFl) / 100) << 
+		16);
+
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodSetVolume			[internal]
+ */
+static DWORD wodSetVolume(WORD wDevID, DWORD dwParam)
+{
+    DWORD left, right;
+
+    left  = (LOWORD(dwParam) * 100) / 0xFFFFl;
+    right = (HIWORD(dwParam) * 100) / 0xFFFFl;   
+
+    TRACE("(%u, %08lX);\n", wDevID, dwParam);
+
+    WOutDev[wDevID].volume_left = left;
+    WOutDev[wDevID].volume_right = right;
+
+    return MMSYSERR_NOERROR;
+}
+
+/**************************************************************************
+ * 				wodGetNumDevs			[internal]
+ */
+static	DWORD	wodGetNumDevs(void)
+{
+    DWORD	ret = 1;
+
+    /* FIXME: For now, only one sound device (SOUND_DEV) is allowed */
+    return ret;
+}
+
+/**************************************************************************
+ * 				wodMessage (WINEARTS.@)
+ */
+DWORD WINAPI ARTS_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser, 
+			    DWORD dwParam1, DWORD dwParam2)
+{
+    TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
+	  wDevID, wMsg, dwUser, dwParam1, dwParam2);
+    
+    switch (wMsg) {
+    case DRVM_INIT:
+    case DRVM_EXIT:
+    case DRVM_ENABLE:
+    case DRVM_DISABLE:
+	/* FIXME: Pretend this is supported */
+	return 0;
+    case WODM_OPEN:	 	return wodOpen		(wDevID, (LPWAVEOPENDESC)dwParam1,	dwParam2);
+    case WODM_CLOSE:	 	return wodClose		(wDevID);
+    case WODM_WRITE:	 	return wodWrite		(wDevID, (LPWAVEHDR)dwParam1,		dwParam2);
+    case WODM_PAUSE:	 	return wodPause		(wDevID);
+    case WODM_GETPOS:	 	return wodGetPosition	(wDevID, (LPMMTIME)dwParam1, 		dwParam2);
+    case WODM_BREAKLOOP: 	return wodBreakLoop     (wDevID);
+    case WODM_PREPARE:	 	return wodPrepare	(wDevID, (LPWAVEHDR)dwParam1, 		dwParam2);
+    case WODM_UNPREPARE: 	return wodUnprepare	(wDevID, (LPWAVEHDR)dwParam1, 		dwParam2);
+    case WODM_GETDEVCAPS:	return wodGetDevCaps	(wDevID, (LPWAVEOUTCAPSA)dwParam1,	dwParam2);
+    case WODM_GETNUMDEVS:	return wodGetNumDevs	();
+    case WODM_GETPITCH:	 	return MMSYSERR_NOTSUPPORTED;
+    case WODM_SETPITCH:	 	return MMSYSERR_NOTSUPPORTED;
+    case WODM_GETPLAYBACKRATE:	return MMSYSERR_NOTSUPPORTED;
+    case WODM_SETPLAYBACKRATE:	return MMSYSERR_NOTSUPPORTED;
+    case WODM_GETVOLUME:	return wodGetVolume	(wDevID, (LPDWORD)dwParam1);
+    case WODM_SETVOLUME:	return wodSetVolume	(wDevID, dwParam1);
+    case WODM_RESTART:		return wodRestart	(wDevID);
+    case WODM_RESET:		return wodReset		(wDevID);
+
+    case DRV_QUERYDSOUNDIFACE:	return wodDsCreate(wDevID, (PIDSDRIVER*)dwParam1);
+    default:
+	FIXME("unknown message %d!\n", wMsg);
+    }
+    return MMSYSERR_NOTSUPPORTED;
+}
+
+/*======================================================================*
+ *                  Low level DSOUND implementation			*
+ *======================================================================*/
+
+typedef struct IDsDriverImpl IDsDriverImpl;
+typedef struct IDsDriverBufferImpl IDsDriverBufferImpl;
+
+struct IDsDriverImpl
+{
+    /* IUnknown fields */
+    ICOM_VFIELD(IDsDriver);
+    DWORD		ref;
+    /* IDsDriverImpl fields */
+    UINT		wDevID;
+    IDsDriverBufferImpl*primary;
+};
+
+struct IDsDriverBufferImpl
+{
+    /* IUnknown fields */
+    ICOM_VFIELD(IDsDriverBuffer);
+    DWORD		ref;
+    /* IDsDriverBufferImpl fields */
+    IDsDriverImpl*	drv;
+    DWORD		buflen;
+};
+
+static DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv)
+{
+    /* we can't perform memory mapping as we don't have a file stream 
+	interface with arts like we do with oss */
+    MESSAGE("This sound card's driver does not support direct access\n");
+    MESSAGE("The (slower) DirectSound HEL mode will be used instead.\n");
+    return MMSYSERR_NOTSUPPORTED;
+}
+
+#else /* !HAVE_ARTS */
+
+/**************************************************************************
+ * 				wodMessage (WINEARTS.@)
+ */
+DWORD WINAPI ARTS_wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
+			    DWORD dwParam1, DWORD dwParam2)
+{
+    FIXME("(%u, %04X, %08lX, %08lX, %08lX):stub\n", wDevID, wMsg, dwUser, dwParam1, dwParam2);
+    return MMSYSERR_NOTENABLED;
+}
+
+#endif /* HAVE_ARTS */
diff --git a/dlls/winmm/winearts/winearts.drv.spec b/dlls/winmm/winearts/winearts.drv.spec
new file mode 100644
index 0000000000000000000000000000000000000000..80ffa582b64af7b46bd29c3ee928754eb941eb83
--- /dev/null
+++ b/dlls/winmm/winearts/winearts.drv.spec
@@ -0,0 +1,13 @@
+name winearts
+file winearts.drv
+type win32
+
+import winmm.dll
+import user32.dll
+import kernel32.dll
+import ntdll.dll
+
+debug_channels (wave)
+
+@ stdcall DriverProc(long long long long long) ARTS_DriverProc
+@ stdcall wodMessage(long long long long long) ARTS_wodMessage
diff --git a/documentation/samples/config b/documentation/samples/config
index 1b70823c29fe51e846eebbb9bef6be5abc612d45..4baa1d5d7fa7e111ba8b29771e50e0c6d9450f0d 100644
--- a/documentation/samples/config
+++ b/documentation/samples/config
@@ -238,6 +238,7 @@ WINE REGISTRY Version 2
 
 [WinMM]
 "Drivers" = "wineoss.drv"
+#"Drivers" = "winearts.drv"
 "WaveMapper" = "msacm.drv"
 "MidiMapper" = "midimap.drv"
 
diff --git a/include/config.h.in b/include/config.h.in
index ec06242e56b07d987d00dfa5f09d4ad45a24b077..f40a528d867a443b084ab39e038b4689cd3508bb 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -25,6 +25,9 @@
 /* Define if you have the <arpa/nameser.h> header file. */
 #undef HAVE_ARPA_NAMESER_H
 
+/* Define if you have ARTS sound server */
+#undef HAVE_ARTS
+
 /* Define to use .string instead of .ascii */
 #undef HAVE_ASM_STRING