sdl2.m4
changeset 10382 9befd0acb9ef
parent 7492 98de3e4f1c36
child 12647 fa75f0fb9e96
     1.1 --- a/sdl2.m4	Thu Sep 29 16:10:08 2016 -0700
     1.2 +++ b/sdl2.m4	Thu Sep 29 16:37:08 2016 -0700
     1.3 @@ -4,6 +4,9 @@
     1.4  # stolen back from Frank Belew
     1.5  # stolen from Manish Singh
     1.6  # Shamelessly stolen from Owen Taylor
     1.7 +#
     1.8 +# Changelog:
     1.9 +# * also look for SDL2.framework under Mac OS X
    1.10  
    1.11  # serial 1
    1.12  
    1.13 @@ -20,6 +23,10 @@
    1.14              sdl_exec_prefix="$withval", sdl_exec_prefix="")
    1.15  AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
    1.16  		    , enable_sdltest=yes)
    1.17 +AC_ARG_ENABLE(sdlframework, [  --disable-sdlframework Do not search for SDL2.framework],
    1.18 +        , search_sdl_framework=yes)
    1.19 +
    1.20 +AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework])
    1.21  
    1.22    min_sdl_version=ifelse([$1], ,2.0.0,$1)
    1.23  
    1.24 @@ -53,14 +60,36 @@
    1.25      fi
    1.26      AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH])
    1.27      PATH="$as_save_PATH"
    1.28 -    AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
    1.29      no_sdl=""
    1.30  
    1.31 -    if test "$SDL2_CONFIG" = "no" ; then
    1.32 -      no_sdl=yes
    1.33 -    else
    1.34 -      SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
    1.35 -      SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
    1.36 +    if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then
    1.37 +      AC_MSG_CHECKING(for SDL2.framework)
    1.38 +      if test "x$SDL2_FRAMEWORK" != x; then
    1.39 +        sdl_framework=$SDL2_FRAMEWORK
    1.40 +      else
    1.41 +        for d in / ~/ /System/; do
    1.42 +          if test -d "$dLibrary/Frameworks/SDL2.framework"; then
    1.43 +            sdl_framework="$dLibrary/Frameworks/SDL2.framework"
    1.44 +          fi
    1.45 +        done
    1.46 +      fi
    1.47 +
    1.48 +      if test -d $sdl_framework; then
    1.49 +        AC_MSG_RESULT($sdl_framework)
    1.50 +        sdl_framework_dir=`dirname $sdl_framework`
    1.51 +        SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include"
    1.52 +        SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2"
    1.53 +      else
    1.54 +        no_sdl=yes
    1.55 +      fi
    1.56 +    fi
    1.57 +
    1.58 +    if test "$SDL2_CONFIG" != "no"; then
    1.59 +      if test "x$sdl_pc" = "xno"; then
    1.60 +        AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
    1.61 +        SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
    1.62 +        SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
    1.63 +      fi
    1.64  
    1.65        sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
    1.66               sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    1.67 @@ -141,12 +170,15 @@
    1.68          CFLAGS="$ac_save_CFLAGS"
    1.69          CXXFLAGS="$ac_save_CXXFLAGS"
    1.70          LIBS="$ac_save_LIBS"
    1.71 +
    1.72        fi
    1.73 -    fi
    1.74 -    if test "x$no_sdl" = x ; then
    1.75 -      AC_MSG_RESULT(yes)
    1.76 -    else
    1.77 -      AC_MSG_RESULT(no)
    1.78 +      if test "x$sdl_pc" = "xno"; then
    1.79 +        if test "x$no_sdl" = "xyes"; then
    1.80 +          AC_MSG_RESULT(no)
    1.81 +        else
    1.82 +          AC_MSG_RESULT(yes)
    1.83 +        fi
    1.84 +      fi
    1.85      fi
    1.86    fi
    1.87    if test "x$no_sdl" = x ; then