Description: Use system librtaudio instead of embedded copy
 Edit the cmake script to use the system installed librtaudio instead of
 the embedded copy. Additionally sabotage the embedded copy to make
 sure it doesn't accidentally end up in the build.
Author: Andreas Bombe <aeb@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,9 @@
 
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
 
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(RTAUDIO REQUIRED rtaudio)
+
 option(USE_HAMLIB OFF "Support hamlib for radio control functions.")
 
 if (USE_HAMLIB)
@@ -33,7 +36,7 @@
 # list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/RtAudio)
+include_directories(${RTAUDIO_INCLUDE_DIRS})
 
 #enable c++11 features
 if(CMAKE_COMPILER_IS_GNUCXX)
@@ -84,7 +87,8 @@
 	ENDIF(USE_AUDIO_DS)    
 ENDIF (WIN32)
 
-IF (UNIX AND NOT APPLE)
+# disabled audio library checks for embedded RtAudio copy
+IF (0 AND UNIX AND NOT APPLE)
     SET(USE_AUDIO_PULSE ON CACHE BOOL "Support Pulse Audio")
     SET(USE_AUDIO_JACK OFF CACHE BOOL "Support Jack Audio")
     SET(USE_AUDIO_ALSA OFF CACHE BOOL "Support ALSA Audio")
@@ -123,7 +127,7 @@
             -D__LINUX_OSS__
        )
     ENDIF(USE_AUDIO_OSS)
-ENDIF(UNIX AND NOT APPLE)
+ENDIF(0 AND UNIX AND NOT APPLE)
 
 IF (APPLE)
  ADD_DEFINITIONS(
@@ -150,9 +154,8 @@
         Registation.cpp
         Settings.cpp
         Streaming.cpp
-        RtAudio/RtAudio.cpp
-        RtAudio/RtAudio.h        
         ${HAMLIB_SOURCES}
     LIBRARIES
         ${AUDIO_LIBS}
+        ${RTAUDIO_LIBRARIES}
 )
--- a/RtAudio/RtAudio.h
+++ b/RtAudio/RtAudio.h
@@ -1,3 +1,6 @@
+#error "Embedded copy of RtAudio is not supposed to be used in Debian build"
+
+
 /************************************************************************/
 /*! \class RtAudio
     \brief Realtime audio i/o C++ classes.
