configure: Improve the detection of OSS v4.
diff --git a/configure b/configure
index 7b19dd8..b742bfd 100755
--- a/configure
+++ b/configure
@@ -625,6 +625,7 @@
 PNGINCL
 FONTCONFIGINCL
 CUPSINCL
+OSS4INCL
 ALSALIBS
 GSTREAMER_INCL
 GSTREAMER_LIBS
@@ -2674,7 +2675,7 @@
 
 # Check whether --with-oss was given.
 if test "${with_oss+set}" = set; then :
-  withval=$with_oss; if test "x$withval" = "xno"; then ac_cv_header_soundcard_h=no; ac_cv_header_sys_soundcard_h=no; ac_cv_header_machine_soundcard_h=no; fi
+  withval=$with_oss;
 fi
 
 
@@ -5846,7 +5847,6 @@
 	mach/machine.h \
 	machine/cpu.h \
 	machine/limits.h \
-	machine/soundcard.h \
 	machine/sysarch.h \
 	mntent.h \
 	mpg123.h \
@@ -5869,7 +5869,6 @@
 	scsi/scsi.h \
 	scsi/scsi_ioctl.h \
 	scsi/sg.h \
-	soundcard.h \
 	stdbool.h \
 	stdint.h \
 	strings.h \
@@ -5904,7 +5903,6 @@
 	sys/socket.h \
 	sys/socketvar.h \
 	sys/sockio.h \
-	sys/soundcard.h \
 	sys/statvfs.h \
 	sys/strtio.h \
 	sys/syscall.h \
@@ -11027,28 +11025,34 @@
 
 fi
 
-if test "$ac_cv_header_sys_soundcard_h" = "yes" -o \
-        "$ac_cv_header_machine_soundcard_h" = "yes" -o \
-        "$ac_cv_header_soundcard_h" = "yes"
+if test "x$with_oss" != xno
 then
-    ac_fn_c_check_type "$LINENO" "oss_sysinfo" "ac_cv_type_oss_sysinfo" "#if defined(HAVE_SYS_SOUNDCARD_H)
-#include <sys/soundcard.h>
-#elif defined(HAVE_MACHINE_SOUNDCARD_H)
-#include <machine/soundcard.h>
-#elif defined(HAVE_SOUNDCARD_H)
-#include <soundcard.h>
-#endif
+    ac_save_CPPFLAGS="$CPPFLAGS"
+    if test -f /etc/oss.conf
+    then
+        . /etc/oss.conf
+    fi
+    ac_oss_incl="-I${OSSLIBDIR:-/usr/lib/oss}/include"
+    CPPFLAGS="$CPPFLAGS $ac_oss_incl"
+    ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :
+  ac_fn_c_check_member "$LINENO" "oss_sysinfo" "numaudioengines" "ac_cv_member_oss_sysinfo_numaudioengines" "#include <sys/soundcard.h>
 "
-if test "x$ac_cv_type_oss_sysinfo" = xyes; then :
+if test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_OSS_SYSINFO 1
+#define HAVE_OSS_SYSINFO_NUMAUDIOENGINES 1
 _ACEOF
 
+OSS4INCL="$ac_oss_incl"
 
 fi
 
-    if test "x$ac_cv_type_oss_sysinfo" != xyes
+fi
+
+
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    if test "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes
     then
         as_fn_append wine_notices "|OSS sound system found but too old (OSSv4 needed), OSS won't be supported."
     fi
@@ -12134,11 +12138,11 @@
 test -n "$NASLIBS" || enable_winenas_drv=${enable_winenas_drv:-no}
 test -n "$ESDLIBS" || enable_wineesd_drv=${enable_wineesd_drv:-no}
 test -n "$ac_cv_lib_soname_jack" || enable_winejack_drv=${enable_winejack_drv:-no}
-test "x$ac_cv_type_oss_sysinfo" = xyes || enable_wineoss_drv=${enable_wineoss_drv:-no}
+test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes || enable_wineoss_drv=${enable_wineoss_drv:-no}
 test "$ac_cv_header_linux_joystick_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no}
 
 if test "x$ALSALIBS$COREAUDIO$NASLIBS$ESDLIBS$ac_cv_lib_soname_jack" = "x" -a \
-        "x$ac_cv_type_oss_sysinfo" != xyes -a \
+        "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes -a \
         "x$with_alsa$with_coreaudio$with_nas$with_esd$with_jack$with_oss" != xnononononono
 then
     as_fn_append wine_warnings "|No sound system was found. Windows applications will be silent."