diff --git a/configure b/configure
index aa87ac7279c4d8b63ac60be89af1d9c9caf44ca8..4e91e318b09bb988e1eddf7b52d07a587c282626 100755
--- a/configure
+++ b/configure
@@ -4871,13 +4871,9 @@ if enabled nvenc; then
     require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
 fi
 
-# SDL is "special" and adds some CFLAGS that should not pollute anything else.
-if enabled avplay; then
-    CFLAGS_SAVE=$CFLAGS
-    check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent &&
-    sdl_cflags=$pkg_cflags
-    CFLAGS=$CFLAGS_SAVE
-fi
+# SDL adds some CFLAGS that should not be part of the general CFLAGS.
+enabled avplay &&
+    test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
 
 ! disabled pod2man   && check_cmd pod2man --help     && enable pod2man   || disable pod2man
 ! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html