--- CMakeLists.txt.orig	2013-03-20 18:05:37.000000000 +0100
+++ CMakeLists.txt	2013-03-20 18:21:02.000000000 +0100
@@ -302,51 +302,81 @@
 		message("OpenMP parallelization disabled")
 	endif()
 
-	include(FindALSA OPTIONAL)
-	if(ALSA_FOUND)
-		add_definitions(-DHAVE_ALSA=1)
-		message("ALSA found, enabling ALSA sound backend")
+	option(DISABLE_ALSA "Disable ALSA sound backend" OFF)
+	if(NOT DISABLE_ALSA)
+		include(FindALSA OPTIONAL)
+		if(ALSA_FOUND)
+			add_definitions(-DHAVE_ALSA=1)
+			message("ALSA found, enabling ALSA sound backend")
+		else()
+			add_definitions(-DHAVE_ALSA=0)
+			message("ALSA NOT found, disabling ALSA sound backend")
+		endif(ALSA_FOUND)
 	else()
 		add_definitions(-DHAVE_ALSA=0)
-		message("ALSA NOT found, disabling ALSA sound backend")
-	endif(ALSA_FOUND)
+		message("ALSA sound backend disabled")
+	endif()
 
-	check_lib(AO ao QUIET)
-	if(AO_FOUND)
-		add_definitions(-DHAVE_AO=1)
-		message("ao found, enabling ao sound backend")
+	option(DISABLE_AO "Disable ao sound backend" OFF)
+	if(NOT DISABLE_AO)
+		check_lib(AO ao QUIET)
+		if(AO_FOUND)
+			add_definitions(-DHAVE_AO=1)
+			message("ao found, enabling ao sound backend")
+		else()
+			add_definitions(-DHAVE_AO=0)
+			message("ao NOT found, disabling ao sound backend")
+		endif(AO_FOUND)
 	else()
 		add_definitions(-DHAVE_AO=0)
-		message("ao NOT found, disabling ao sound backend")
-	endif(AO_FOUND)
+		message("ao sound backend disabled")
+	endif()
 
-	check_lib(BLUEZ bluez QUIET)
-	if(BLUEZ_FOUND)
-		add_definitions(-DHAVE_BLUEZ=1)
-		message("bluez found, enabling bluetooth support")
+	option(DISABLE_BLUEZ "Disable bluez (bluetooth) support" OFF)
+	if(NOT DISABLE_BLUEZ)
+		check_lib(BLUEZ bluez QUIET)
+		if(BLUEZ_FOUND)
+			add_definitions(-DHAVE_BLUEZ=1)
+			message("bluez found, enabling bluetooth support")
+		else()
+			add_definitions(-DHAVE_BLUEZ=0)
+			message("bluez NOT found, disabling bluetooth support")
+		endif(BLUEZ_FOUND)
 	else()
 		add_definitions(-DHAVE_BLUEZ=0)
-		message("bluez NOT found, disabling bluetooth support")
-	endif(BLUEZ_FOUND)
+		message("bluez (bluetooth) support disabled")
+	endif()
 
-	check_lib(PULSEAUDIO libpulse-simple QUIET)
-	if(PULSEAUDIO_FOUND)
-		add_definitions(-DHAVE_PULSEAUDIO=1)
-		message("PulseAudio found, enabling PulseAudio sound backend")
+	option(DISABLE_PULSEAUDIO "Disable PulseAudio sound backend" OFF)
+	if(NOT DISABLE_PULSEAUDIO)
+		check_lib(PULSEAUDIO libpulse-simple QUIET)
+		if(PULSEAUDIO_FOUND)
+			add_definitions(-DHAVE_PULSEAUDIO=1)
+			message("PulseAudio found, enabling PulseAudio sound backend")
+		else()
+			add_definitions(-DHAVE_PULSEAUDIO=0)
+			message("PulseAudio NOT found, disabling PulseAudio sound backend")
+		endif(PULSEAUDIO_FOUND)
 	else()
 		add_definitions(-DHAVE_PULSEAUDIO=0)
-		message("PulseAudio NOT found, disabling PulseAudio sound backend")
-	endif(PULSEAUDIO_FOUND)
+		message("PulseAudio sound backend disabled")
+	endif()
 
-	include(FindOpenAL OPTIONAL)
-	if(OPENAL_FOUND)
-		add_definitions(-DHAVE_OPENAL=1)
-		include_directories(${OPENAL_INCLUDE_DIR})
-		message("OpenAL found, enabling OpenAL sound backend")
+	option(DISABLE_OPENAL "Disable OpenAL sound backend" OFF)
+	if(NOT DISABLE_OPENAL)
+		include(FindOpenAL OPTIONAL)
+		if(OPENAL_FOUND)
+			add_definitions(-DHAVE_OPENAL=1)
+			include_directories(${OPENAL_INCLUDE_DIR})
+			message("OpenAL found, enabling OpenAL sound backend")
+		else()
+			add_definitions(-DHAVE_OPENAL=0)
+			message("OpenAL NOT found, disabling OpenAL sound backend")
+		endif(OPENAL_FOUND)
 	else()
 		add_definitions(-DHAVE_OPENAL=0)
-		message("OpenAL NOT found, disabling OpenAL sound backend")
-	endif(OPENAL_FOUND)
+		message("OpenAL sound backend disabled")
+	endif()
 
 # Note: We do not need to explicitly check for X11 as it is done in the cmake
 # FindOpenGL module on linux.
@@ -375,22 +405,33 @@
 		check_libav()
 	endif()
 
-	include(CheckCXXSourceRuns)
-	set(CMAKE_REQUIRED_LIBRARIES portaudio)
-	CHECK_CXX_SOURCE_RUNS(
-		"#include <portaudio.h>
-		int main(int argc, char **argv)
-		{ if(Pa_GetVersion() >= 1890) return 0; else return 1; }"
-		PORTAUDIO)
-	if(PORTAUDIO)
-		message("PortAudio found, enabling mic support")
-		add_definitions(-DHAVE_PORTAUDIO=1)
-		set(PORTAUDIO_FOUND TRUE)
+	option(DISABLE_PORTAUDIO "Disable PortAudio (mic) support" OFF)
+	if(NOT DISABLE_PORTAUDIO)
+		include(CheckCXXSourceRuns)
+		include_directories(BEFORE ${CMAKE_INSTALL_PREFIX}/include/portaudio2)
+		link_directories(${CMAKE_INSTALL_PREFIX}/lib/portaudio2)
+		set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INSTALL_PREFIX}/include/portaudio2)
+		set(CMAKE_REQUIRED_FLAGS -L${CMAKE_INSTALL_PREFIX}/lib/portaudio2)
+		set(CMAKE_REQUIRED_LIBRARIES portaudio)
+		CHECK_CXX_SOURCE_RUNS(
+			"#include <portaudio.h>
+			int main(int argc, char **argv)
+			{ if(Pa_GetVersion() >= 1890) return 0; else return 1; }"
+			PORTAUDIO)
+		if(PORTAUDIO)
+			message("PortAudio found, enabling mic support")
+			add_definitions(-DHAVE_PORTAUDIO=1)
+			set(PORTAUDIO_FOUND TRUE)
+		else()
+			message("PortAudio not found, disabling mic support")
+			add_definitions(-DHAVE_PORTAUDIO=0)
+			set(PORTAUDIO_FOUND FALSE)
+		endif(PORTAUDIO)
 	else()
-		message("PortAudio not found, disabling mic support")
+		message("PortAudio (mic) support disabled")
 		add_definitions(-DHAVE_PORTAUDIO=0)
 		set(PORTAUDIO_FOUND FALSE)
-	endif(PORTAUDIO)
+	endif()
 
 	if(OPROFILING)
 		check_lib(OPROFILE opagent opagent.h)
@@ -668,10 +709,13 @@
 	install(DIRECTORY Data/User/ DESTINATION ${datadir}/user PATTERN)
 	install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN)
 endif()
-include(FindGettext)
-if(GETTEXT_FOUND AND NOT DISABLE_WX)
-	file(GLOB LINGUAS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Languages/po/*.po) 
-	GETTEXT_CREATE_TRANSLATIONS(Languages/po/dolphin-emu.pot ALL ${LINGUAS})
+option(DISABLE_NLS "Disable native language support (NLS)" OFF)
+if(NOT DISABLE_NLS)
+	include(FindGettext)
+	if(GETTEXT_FOUND AND NOT DISABLE_WX)
+		file(GLOB LINGUAS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Languages/po/*.po)
+		GETTEXT_CREATE_TRANSLATIONS(Languages/po/dolphin-emu.pot ALL ${LINGUAS})
+	endif()
 endif()
 if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin"))
 	install(FILES Data/license.txt DESTINATION ${datadir})
