shithub: sox

Download patch

ref: ed6e41bccb569d38d0cba4dbf84304f5f8c6ed1f
parent: 033ff807d6e2f6a6742d8f48b74af232e09ae52e
author: cbagwell <cbagwell>
date: Tue Sep 21 18:15:39 EDT 2010

Enable waveaudio in cmake compiles

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,20 @@
   endif (${variable}1)
 endmacro(optional)
 
+macro(optional2 variable header library1 function1 library2 function2 source)
+  check_include_files(${header} ${variable}1)
+  if (${variable}1)
+    check_library_exists(${library1} ${function1} "" ${variable}2)
+    if (${variable}2)
+      check_library_exists(${library2} ${function2} "" ${variable})
+      if (${variable})
+	set(optional_srcs ${optional_srcs} ${source})
+	set(optional_libs ${optional_libs} ${library1} ${library2})
+      endif (${variable})
+    endif (${variable}2)
+  endif (${variable}1)
+endmacro(optional2)
+
 macro(optional3 variable header library1 function1 library2 function2 library3 function3 source)
   check_include_files(${header} ${variable}1)
   if (${variable}1)
@@ -30,6 +44,27 @@
     endif (${variable}2)
   endif (${variable}1)
 endmacro(optional3)
+
+macro(optional4 variable header library1 function1 library2 function2 library3 function3 library4 function4 source)
+  check_include_files(${header} ${variable}1)
+  if (${variable}1)
+    check_library_exists(${library1} ${function1} "" ${variable}2)
+    if (${variable}2)
+      check_library_exists(${library2} ${function2} "" ${variable}3)
+      if (${variable}3)
+	check_library_exists(${library3} ${function3} "" ${variable}4)
+	if (${variable}4)
+	  check_library_exists(${library4} ${function4} "" ${variable})
+	  if (${variable})
+	    set(optional_srcs ${optional_srcs} ${source})
+	    set(optional_libs ${optional_libs} ${library1} ${library2} ${library3} ${library4})
+	  endif (${variable})
+	endif (${variable}4)
+      endif (${variable}3)
+    endif (${variable}2)
+  endif (${variable}1)
+endmacro(optional4)
+
 project(sox)
 
 if(CMAKE_COMPILER_IS_GNUCC)
@@ -91,8 +126,14 @@
 endif (NOT HAVE_LAME_LAME_H)
 optional(HAVE_MAGIC magic.h magic magic_open "")
 #optional(HAVE_OGG_SPEEX speex/speex.h speex speex_decoder_init speex)
-optional(HAVE_PNG png.h png png_set_rows spectrogram)
-optional(HAVE_PULSEAUDIO pulse/simple.h pulse-simple pa_simple_new pulseaudio)
+optional2(HAVE_PNG png.h png png_set_rows z uncompress spectrogram)
+if (HAVE_PNG)
+  check_library_exists(z uncompress "" spectrogram1)
+  if (${spectrogram1})
+    set(optional_libs ${optional_libs} z)
+  endif (${spectrogram1})
+endif (HAVE_PNG)
+optional2(HAVE_PULSEAUDIO pulse/simple.h pulse-simple pa_simple_new pulse pa_strerror pulseaudio)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open sndfile)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open fap)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open mat4)
@@ -111,7 +152,8 @@
 if (NOT HAVE_SYS_SOUNDCARD_H)
   optional(HAVE_MACHINE_SOUNDCARD_H machine/soundcard.h ossaudio _oss_ioctl oss)
 endif (NOT HAVE_SYS_SOUNDCARD_H)
-optional3(HAVE_OGG_VORBIS vorbis/codec.h vorbis vorbis_analysis_headerout vorbisfile ov_clear vorbisenc vorbis_encode_init_vbr vorbis)
+optional(HAVE_WAVEAUDIO mmsystem.h winmm waveInGetDevCapsA waveaudio)
+optional4(HAVE_OGG_VORBIS vorbis/codec.h ogg ogg_stream_flush vorbis vorbis_analysis_headerout vorbisfile ov_clear vorbisenc vorbis_encode_init_vbr vorbis)
 optional3(HAVE_FFMPEG ffmpeg/avformat.h avformat av_open_input_file avutil av_rescale_q avcodec avcodec_decode_audio2 ffmpeg)
 optional(HAVE_WAVPACK wavpack/wavpack.h wavpack WavpackGetSampleRate wavpack)
 
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,7 +30,8 @@
 Internal improvements:
 
   o Distribute msvc9 project files that had been in CVS only. (cbagwell)
-
+  o cmake now compiles waveaudio driver under windows environment. (cbagwell)
+    [3072672]
 
 
 sox-14.3.1	2010-04-11
--- a/configure.ac
+++ b/configure.ac
@@ -591,7 +591,7 @@
 
 dnl Generate output files.
 AX_CREATE_STDINT_H(src/soxstdint.h)
-AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile sox.pc)
+AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile msvc9/Makefile sox.pc)
 AC_OUTPUT
 
 if test "$using_gsm" != "no"; then