- AC_CHECK_HEADERS([sys/soundcard.h],,
- [DISABLED_CONTRIB="$DISABLED_CONTRIB mmedia"])
+ dnl it's not enough to check for just the header because OSS under NetBSD
+ dnl redefines ioctl as oss_ioctrl inside it and so we also need to test
+ dnl whether we need -lossaudio at link-time
+ AC_CACHE_CHECK([for ioctl() in sys/soundcard.h], ac_cv_header_sys_soundcard, [
+ AC_TRY_LINK([
+ #include <sys/soundcard.h>
+ ],
+ [
+ ioctl(0, SNDCTL_DSP_SYNC, 0);
+ ],
+ ac_cv_header_sys_soundcard=yes,
+ [
+ saveLibs="$LIBS"
+ LIBS="$saveLibs -lossaudio"
+ AC_TRY_LINK([
+ #include <sys/soundcard.h>
+ ],
+ [
+ ioctl(0, SNDCTL_DSP_SYNC, 0);
+ ],
+ ac_cv_header_sys_soundcard=yes,
+ [
+ LIBS="$saveLibs"
+ ac_cv_header_sys_soundcard=no
+ ]
+ )
+ ]
+ )
+ ])
+
+ if test "$ac_cv_header_sys_soundcard" = "yes"; then
+ AC_DEFINE(HAVE_SYS_SOUNDCARD_H)
+ else
+ DISABLED_CONTRIB="$DISABLED_CONTRIB mmedia"
+ fi