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>
- acinclude/alsa.m4, esd.m4: Ran through autoupdate to replace several
AC_TRY_[COMPILE|LINK|RUN] with corresponding AC_???_IFELSE , so that
autoconf-2.70 doesn't warn.
- sdl2.m4: Ditto.
- test/acinclude.m4 (sdl2): Ditto.
- remove HP/UX 9 (%@#!) support
- change fopen() mode from "a" to "w" in test code.
- bump its serial num to 2.
- test/acinclude.m4: same sdl2.m4 updates.
Stian Skjelstad
check if $sdl_framework is set, before checking if directory exists
Patch that was merged here https://hg.libsdl.org/SDL/rev/ad4968de54ec made it impossible for the SDL2 detection to fail, since one of the if statements fails to check if a variable is set or not.
if test -d $sdl_framework; then
can evaluate to true in some shells. I guess it falls into undefined behaviour when looking at the POSIX standard.
neoaggelos
It is common for Mac OS X to use the SDL2.framework instead of the classic UNIX dynamic lib.
Therefore, it makes sense for AM_PATH_SDL2() to be able to locate it. Attached is a patched sdl2.m4 (updated for that purpose).
Changes:
* look for SDL2.framework ONLY if pkg-config and sdl2-config tests failed (this is to ensure compatibility with the old behaviour)
* adds option ('--disable-sdlframework') to retreat to the old behaviour
* adds variable 'SDL2_FRAMEWORK' for the user to specify the exact path to SDL2.framework (e.g. if it is installed in a non-standard location)
Open to suggestions for further improvements
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().