Fixed bug 4544 - SDL2.m4 SDL2.framework patch made it impossible to fail detection
authorSam Lantinga <slouken@libsdl.org>
Sat, 16 Mar 2019 18:45:10 -0700
changeset 12647fa75f0fb9e96
parent 12644 7c643f1c1887
child 12648 a4824cbecd16
Fixed bug 4544 - SDL2.m4 SDL2.framework patch made it impossible to fail detection

Stian Skjelstad

check if $sdl_framework is set, before checking if directory exists

Patch that was merged here https://hg.libsdl.org/SDL/rev/9befd0acb9ef 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.
sdl2.m4
     1.1 --- a/sdl2.m4	Sat Mar 16 18:34:33 2019 -0700
     1.2 +++ b/sdl2.m4	Sat Mar 16 18:45:10 2019 -0700
     1.3 @@ -74,7 +74,7 @@
     1.4          done
     1.5        fi
     1.6  
     1.7 -      if test -d $sdl_framework; then
     1.8 +      if test x"$sdl_framework" != x && test -d "$sdl_framework"; then
     1.9          AC_MSG_RESULT($sdl_framework)
    1.10          sdl_framework_dir=`dirname $sdl_framework`
    1.11          SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include"