SDL: sdl2.m4: Deprecate AM_PATH_SDL2 in favour of PKG_CHECK_MODULES

From a66cb8cf216536b4e5e35c98c3f114d1787131b1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Mon, 31 Oct 2022 11:44:32 +0000
Subject: [PATCH] sdl2.m4: Deprecate AM_PATH_SDL2 in favour of
 PKG_CHECK_MODULES

AM_PATH_SDL2 doesn't add much beyond PKG_CHECK_MODULES, and having a
special m4 macro for every library that you might depend on scales
poorly.

The macro does add special support for macOS frameworks, but that feature
was broken for around 6 years without anyone noticing (#6141), and is
likely to be only rarely useful according to comments on #6141.

Resolves: #6140
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 sdl2.m4 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sdl2.m4 b/sdl2.m4
index 75b60f6ea933..737a5e5e8611 100644
--- a/sdl2.m4
+++ b/sdl2.m4
@@ -10,7 +10,7 @@
 # * removed HP/UX 9 support.
 # * updated for newer autoconf.
 
-# serial 2
+# serial 3
 
 dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
@@ -19,6 +19,7 @@ AC_DEFUN([AM_PATH_SDL2],
 [dnl
 dnl Get the cflags and libraries from the sdl2-config script
 dnl
+AC_MSG_WARN([[$0 is deprecated, please use PKG_CHECK_MODULES([SDL], [sdl2 >= MINIMUM_VERSION]) instead]])
 AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
             sdl_prefix="$withval", sdl_prefix="")
 AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],