diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ee5bea..de1d7ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ set(ANALYZE CACHE BOOL "Run static analysis on the code, requires cppcheck and c
 set(WARNINGS "-Wall -Wextra -Wuninitialized ")
 set(WARNINGS "${WARNINGS} -Wshadow -Wunsafe-loop-optimizations -Wpedantic -Wcast-align -Wwrite-strings")
 set(WARNINGS "${WARNINGS} -Wmissing-declarations -Wvla")
-set(CMAKE_CXX_FLAGS "-g ${WARNINGS} --std=c++11 -mtune=native -ffast-math")
+set(CMAKE_CXX_FLAGS "-g ${WARNINGS} --std=c++11 -stdlib=libc++ -mtune=native -ffast-math -mavx")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3")
 
 # seems like asan doesn't play well with OpenCL so don't enable by default in debug modes
@@ -32,7 +32,7 @@ find_package(PkgConfig)
 pkg_check_modules(GTKMM REQUIRED gtkmm-3.0)
 pkg_check_modules(SIGCXX REQUIRED sigc++-2.0)
 find_package(FFTS)
-find_package(OpenCL)
+#find_package(OpenCL)
 include(FindOpenMP)
 
 # Configure and enable OpenMP
Submodule lib contains modified content
diff --git a/lib/scopehal/CMakeLists.txt b/lib/scopehal/CMakeLists.txt
index 57faf08..f5017bd 100644
--- a/lib/scopehal/CMakeLists.txt
+++ b/lib/scopehal/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${GTKMM_INCLUDE_DIRS} ${SIGCXX_INCLUDE_DIRS})
+include_directories(${GTKMM_INCLUDE_DIRS} ${SIGCXX_INCLUDE_DIRS} ${OPENCL_INCLUDE_DIR})
 link_directories(${GTKMM_LIBRARY_DIRS} ${SIGCXX_LIBRARY_DIRS})
 
 find_library(LXI_LIB lxi)
diff --git a/lib/scopehal/LeCroyOscilloscope.cpp b/lib/scopehal/LeCroyOscilloscope.cpp
index 2591779..f1eca5b 100644
--- a/lib/scopehal/LeCroyOscilloscope.cpp
+++ b/lib/scopehal/LeCroyOscilloscope.cpp
@@ -31,7 +31,6 @@
 #include "LeCroyOscilloscope.h"
 #include "base64.h"
 #include <locale>
-#include <omp.h>
 
 #include "DropoutTrigger.h"
 #include "EdgeTrigger.h"
diff --git a/lib/scopehal/PeakDetectionFilter.cpp b/lib/scopehal/PeakDetectionFilter.cpp
index b6285f9..36c3ea9 100644
--- a/lib/scopehal/PeakDetectionFilter.cpp
+++ b/lib/scopehal/PeakDetectionFilter.cpp
@@ -34,6 +34,9 @@
 
 using namespace std;
 
+#define min(a,b) (((a)<(b))?(a):(b))
+#define max(a,b) (((a)>(b))?(a):(b))
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // PeakDetector
 
diff --git a/lib/scopehal/SiglentSCPIOscilloscope.cpp b/lib/scopehal/SiglentSCPIOscilloscope.cpp
index d6d51bf..428a0aa 100644
--- a/lib/scopehal/SiglentSCPIOscilloscope.cpp
+++ b/lib/scopehal/SiglentSCPIOscilloscope.cpp
@@ -50,7 +50,6 @@
 #include "base64.h"
 #include <locale>
 #include <stdarg.h>
-#include <omp.h>
 #include <thread>
 #include <chrono>
 
Submodule xptools contains modified content
diff --git a/lib/xptools/Socket.cpp b/lib/xptools/Socket.cpp
index 06ec999..86dcbb4 100644
--- a/lib/xptools/Socket.cpp
+++ b/lib/xptools/Socket.cpp
@@ -601,7 +601,7 @@ bool Socket::DisableNagle()
  */
 bool Socket::DisableDelayedACK()
 {
-#ifndef _WIN32
+#ifdef TCP_QUICKACK
 	int flag = 1;
 	if(0 != setsockopt((int)m_socket, IPPROTO_TCP, TCP_QUICKACK, (char*)&flag, sizeof(flag)))
 		return false;
diff --git a/lib/xptools/UART.cpp b/lib/xptools/UART.cpp
index a764d3c..ef1dcde 100644
--- a/lib/xptools/UART.cpp
+++ b/lib/xptools/UART.cpp
@@ -41,12 +41,16 @@
 #ifndef _WIN32
 #include <fcntl.h>
 #include <unistd.h>
+#ifdef linux
 #include <asm/termios.h>
 
 //asm/termios.h seems to conflict with sys/ioctl.h and termios.h
 //so just pull these by hand
 extern "C" int tcflush (int __fd, int __queue_selector) __THROW;
 extern "C" int ioctl (int __fd, unsigned long int __request, ...) __THROW;
+#else
+#include <termios.h>
+#endif
 
 #endif
 
@@ -126,10 +130,21 @@ bool UART::Connect(const std::string& devfile, int baud)
 		}
 
 		//Set flags
+#ifdef linux
 		termios2 flags;
+#else
+		termios flags;
+#endif
 		memset(&flags, 0, sizeof(flags));
+#ifdef linux
 		ioctl(m_fd, TCGETS2, &flags);
-		flags.c_cflag = CS8 | CLOCAL | CREAD | BOTHER;
+#else
+		tcgetattr(m_fd, &flags);
+#endif
+		flags.c_cflag = CS8 | CLOCAL | CREAD;
+#ifdef BOTHER
+		flags.c_cflag |= BOTHER;
+#endif
 		flags.c_iflag = IGNBRK | IGNPAR;
 		flags.c_oflag = 0;
 		flags.c_cc[VMIN] = 1;
@@ -140,7 +155,11 @@ bool UART::Connect(const std::string& devfile, int baud)
 			LogError("Fail to flush tty\n");
 			return false;
 		}
+#ifdef linux 
 		if(0 != ioctl(m_fd, TCSETS2, &flags))
+#else
+		if (0 != tcsetattr(m_fd, TCSANOW, &flags))
+#endif
 		{
 			LogError("Fail to set attr\n");
 			return false;
diff --git a/src/glscopeclient/FileSystem.cpp b/src/glscopeclient/FileSystem.cpp
index 9ca7d8c..f3a19eb 100644
--- a/src/glscopeclient/FileSystem.cpp
+++ b/src/glscopeclient/FileSystem.cpp
@@ -78,7 +78,12 @@ vector<string> Glob(const string& pathPattern, bool onlyDirectories)
 	}
 #else
 	glob_t globResult{ };
+#ifdef GLOB_ONLYDIR
 	glob(pathPattern.c_str(), onlyDirectories ? GLOB_ONLYDIR : 0, NULL, &globResult);
+#else
+	// XXX: need to emulate GLOB_ONLYDIR
+	glob(pathPattern.c_str(), 0, NULL, &globResult);
+#endif
 
 	if(globResult.gl_pathc > 0)
 	{
diff --git a/src/glscopeclient/WaveformArea.cpp b/src/glscopeclient/WaveformArea.cpp
index d22381c..bc0f64e 100644
--- a/src/glscopeclient/WaveformArea.cpp
+++ b/src/glscopeclient/WaveformArea.cpp
@@ -528,7 +528,7 @@ void WaveformArea::on_realize()
 			LogDebug("    GL_ARB_gpu_shader_int64     = not supported\n");
 
 		//Check for GL 4.2 (required for glBindImageTexture)
-		if(!GLEW_VERSION_4_2)
+		if(0 && !GLEW_VERSION_4_2)
 		{
 			string err =
 				"Your graphics card or driver does not appear to support OpenGL 4.2.\n"
diff --git a/src/glscopeclient/main.cpp b/src/glscopeclient/main.cpp
index 9126dc1..c8a9812 100644
--- a/src/glscopeclient/main.cpp
+++ b/src/glscopeclient/main.cpp
@@ -300,9 +300,9 @@ double GetTime()
 
 void ScopeThread(Oscilloscope* scope)
 {
-	#ifndef _WIN32
+#if defined(__FreeBSD__) || defined(__linux__)
 	pthread_setname_np(pthread_self(), "ScopeThread");
-	#endif
+#endif
 
 	auto sscope = dynamic_cast<SCPIOscilloscope*>(scope);
 
