sandbox: Rework how SDL is enabled / disabled

Given that we can use Kconfig logic directly to see if we have a program
available on the host or not, change from passing NO_SDL to instead
controlling CONFIG_SANDBOX_SDL in Kconfig directly. Introduce
CONFIG_HOST_HAS_SDL as the way to test for sdl2-config and default
CONFIG_SANDBOX_SDL on if we have that, or not.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 96b3402..0ce77de 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -47,6 +47,13 @@
 config HOST_64BIT
 	def_bool $(cc-define,_LP64)
 
+config HOST_HAS_SDL
+	def_bool $(success,sdl2-config --version)
+
+config SANDBOX_SDL
+	bool "Enable SDL2 support in sandbox"
+	default HOST_HAS_SDL
+
 config SANDBOX_CRASH_RESET
 	bool "Reset on crash"
 	help
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 3e2c7f9..1284ef3 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -8,9 +8,7 @@
 
 # Define this to avoid linking with SDL, which requires SDL libraries
 # This can solve 'sdl-config: Command not found' errors
-ifneq ($(NO_SDL),)
-PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
-else
+ifeq ($(CONFIG_SANDBOX_SDL),y)
 PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs)
 PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
 endif