--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,25 +29,28 @@
     fdmdv2_plot_spectrum.h
     fdmdv2_plot_waterfall.h
     hamlib.h
-    sox_biquad.h
-    sox/band.h
-    sox/biquad.c
-    sox/biquads.c
-    sox/biquad.h
-    sox/effects.c
-    sox/effects.h
-    sox/effects_i.c
-    sox/formats_i.c
-    sox/libsox.c
-    sox/sox.h
-    sox/sox_i.h
-    sox/soxomp.h
-    sox/util.h
-    sox/xmalloc.h
-    sox/xmalloc.c
     topFrame.h
     version.h
-)
+    )
+if(USE_STATIC_SOX)
+  list(APPEND FREEDV_SOURCES
+     sox_biquad.h
+     sox/band.h
+     sox/biquad.c
+     sox/biquads.c
+     sox/biquad.h
+     sox/effects.c
+     sox/effects.h
+     sox/effects_i.c
+     sox/formats_i.c
+     sox/libsox.c
+     sox/sox.h
+     sox/sox_i.h
+     sox/soxomp.h
+     sox/util.h
+     sox/xmalloc.h
+     sox/xmalloc.c )
+endif(USE_STATIC_SOX)
 
 # WIN32 is needed for Windows GUI apps and is ignored for UNIX like systems.
 add_executable(freedv WIN32 ${FREEDV_SOURCES} ${RES_FILES})
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,6 +96,8 @@
     "Download and build static codec2 instead of the system library.")
 set(USE_STATIC_SPEEXDSP TRUE CACHE BOOL
     "Download and build static speex instead of the system library.")
+set(USE_STATIC_SOX FALSE CACHE BOOL
+    "Use embedded build static sox instead of the system library.")
 set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL
     "Download and build static wxWidgets instead of the system library.")
 
@@ -104,6 +106,7 @@
     set(USE_STATIC_SNDFILE TRUE FORCE)
     set(USE_STATIC_SAMPLERATE TRUE FORCE)
     set(USE_STATIC_CODEC2 TRUE FORCE)
+    set(USE_STATIC_SOX TRUE FORCE)
 endif(USE_STATIC_DEPS)
 
 #
@@ -186,8 +189,10 @@
 add_definitions(-DHAVE_CONFIG_H)
 
 # Config file for bundled sox sources
-configure_file("${PROJECT_SOURCE_DIR}/cmake/soxconfig.h.in"
-               "${PROJECT_BINARY_DIR}/soxconfig.h")
+if(USE_STATIC_SOX)
+ configure_file("${PROJECT_SOURCE_DIR}/cmake/soxconfig.h.in"
+                "${PROJECT_BINARY_DIR}/soxconfig.h")
+endif(USE_STATIC_SOX)
 
 # Pthread Library
 find_package(Threads REQUIRED)
@@ -389,6 +394,26 @@
 endif()
 
 #
+# Find sox library
+#
+if(NOT USE_STATIC_SOX)
+    message(STATUS "Looking for sox library.")
+    find_path(SOX_INCLUDE_DIR NAMES sox.h)
+    find_library(SOX_LIBRARY sox)
+    message(STATUS "  sox headers: ${SOX_INCLUDE_DIR}")
+    message(STATUS "  sox library: ${SOX_LIBRARY}")
+    if(SOX_INCLUDE_DIR AND SOX_LIBRARY)
+        include_directories(${SOX_INCLUDE_DIR})
+        list(APPEND FREEDV_LINK_LIBS ${SOX_LIBRARY})
+    else(SOX_INCLUDE_DIR AND SOX_LIBRARY)
+        message(FATAL_ERROR "sox library not found!")
+    endif(SOX_INCLUDE_DIR AND SOX_LIBRARY)
+else()
+    message(STATUS "Will use embedded sox code.")
+    include_directories("${PROJECT_SOURCE_DIR}/sox")
+endif()
+
+#
 # Find libdl for dlopen/dlclose
 #
 if(UNIX)
--- a/src/sox_biquad.c
+++ b/src/sox_biquad.c
@@ -31,7 +31,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "sox/sox.h"
+#include <sox.h>
 
 #include "sox_biquad.h"
 
