Check for headers for Windows APIs (except ASIO)
[rtaudio.git] / configure.ac
index 7d48af2bb893a10bd9316a82c5f86509e7112a99..33634a0214f88e9c8bb044c4ce0e587ab68b38af 100644 (file)
@@ -169,11 +169,21 @@ AS_IF([test "x$systems" = "x"],
     [*-mingw32*],    [systems="asio ds wasapi jack"]
   ))
 
+# If any were specifically requested disabled, do it.
+AS_IF([test "x$with_jack"   = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v jack`])
+AS_IF([test "x$with_alsa"   = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v alsa`])
+AS_IF([test "x$with_pulse"  = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v pulse`])
+AS_IF([test "x$with_oss"    = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v oss`])
+AS_IF([test "x$with_core"   = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v core`])
+AS_IF([test "x$with_asio"   = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v asio`])
+AS_IF([test "x$with_dsound" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v dsound`])
+AS_IF([test "x$with_wasapi" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v wasapi`])
+systems=" `echo $systems|tr \\\\n ' '` "
+
 # For each audio system, check if it is selected and found.
 # Note: Order specified above is not necessarily respected. However,
 # *actual* priority is set at run-time, see RtAudio::openRtApi.
 # One AS_CASE per system, since they are not mutually-exclusive.
-systems=" $systems "
 
 AS_CASE(["$systems"], [*" alsa "*], [
   AC_CHECK_LIB(asound, snd_pcm_open,
@@ -206,12 +216,17 @@ AS_CASE(["$systems"], [*" oss "*], [
     AS_CASE(["$required"], [*" oss "*],
       AS_IF([test "x$need_ossaudio" = xyes],
         AC_MSG_WARN([RtAudio may require the ossaudio library]))))
-  AC_CHECK_HEADER(sys/soundcard.h,
+
+  # linux systems may have soundcard.h but *not* have OSS4 installed,
+  # we have to actually check if it exports OSS4 symbols
+  AC_CHECK_DECL(SNDCTL_SYSINFO,
     [api="$api -D__LINUX_OSS__"
      need_pthread=yes
      found="$found OSS"],
-    AS_CASE(["$required"], [*" oss "*],
-      AC_MSG_ERROR([sys/soundcard.h not found])))
+     AS_CASE(["$required"], [*" oss "*],
+       AC_MSG_ERROR([sys/soundcard.h not found]))
+    [],
+    [#include <sys/soundcard.h>])
 ])
 
 AS_CASE(["$systems"], [*" jack "*], [
@@ -244,18 +259,20 @@ AS_CASE(["$systems"], [*" asio "*], [
 ])
 
 AS_CASE(["$systems"], [*" ds "*], [
-  api="$api -D__WINDOWS_DS__"
-  need_ole32=yes
-  found="$found DirectSound"
-  LIBS="-ldsound -lwinmm $LIBS"
+  AC_CHECK_HEADERS(mmsystem.h mmreg.h dsound.h,
+    [api="$api -D__WINDOWS_DS__"
+     need_ole32=yes
+     found="$found DirectSound"
+     LIBS="-ldsound -lwinmm $LIBS"])
 ])
 
 AS_CASE(["$systems"], [*" wasapi "*], [
-  api="$api -D__WINDOWS_WASAPI__"
-  CPPFLAGS="-I$srcdir/include $CPPFLAGS"
-  need_ole32=yes
-  found="$found WASAPI"
-  LIBS="-lwinmm -luuid -lksuser $LIBS"
+  AC_CHECK_HEADERS(windows.h audioclient.h avrt.h mmdeviceapi.h,
+    [api="$api -D__WINDOWS_WASAPI__"
+     CPPFLAGS="-I$srcdir/include $CPPFLAGS"
+     need_ole32=yes
+     found="$found WASAPI"
+     LIBS="-lwinmm -luuid -lksuser $LIBS"])
 ])
 
 AS_IF([test -n "$need_ole32"], [LIBS="-lole32 $LIBS"])