configure.in
changeset 11808 510c0e047122
parent 11762 c4900725a75a
child 11829 fcbafc9e443c
     1.1 --- a/configure.in	Tue Jan 02 14:32:15 2018 -0800
     1.2 +++ b/configure.in	Tue Jan 02 19:06:14 2018 -0400
     1.3 @@ -2066,10 +2066,30 @@
     1.4  AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
     1.5                                  , enable_render_metal=yes)
     1.6      if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
     1.7 -        dnl This should maybe make sure you have a supported SDK version.
     1.8 -        AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
     1.9 -        SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
    1.10 -        SUMMARY_video="${SUMMARY_video} metal"
    1.11 +        save_CFLAGS="$CFLAGS"
    1.12 +        dnl Work around that we don't have Objective-C support in autoconf
    1.13 +        CFLAGS="$CFLAGS -x objective-c"
    1.14 +        AC_MSG_CHECKING(for Metal framework)
    1.15 +        have_metal=no
    1.16 +        AC_TRY_COMPILE([
    1.17 +          #import <Cocoa/Cocoa.h>
    1.18 +          #import <Metal/Metal.h>
    1.19 +          #import <QuartzCore/CAMetalLayer.h>
    1.20 +
    1.21 +          #if !TARGET_CPU_X86_64
    1.22 +          #error Metal doesn't work on this configuration
    1.23 +          #endif
    1.24 +        ],[
    1.25 +        ],[
    1.26 +        have_metal=yes
    1.27 +        ])
    1.28 +        CFLAGS="$save_CFLAGS"
    1.29 +        AC_MSG_RESULT($have_metal)
    1.30 +        if test x$have_metal = xyes; then
    1.31 +            AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
    1.32 +            SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
    1.33 +            SUMMARY_video="${SUMMARY_video} metal"
    1.34 +        fi
    1.35      fi
    1.36  }
    1.37