Fixed Vulkan configure check for Android and added one for Mac OS X
authorSam Lantinga <slouken@libsdl.org>
Mon, 28 Aug 2017 22:36:45 -0700
changeset 114080783887749f6
parent 11407 ff9e8ae4d4fb
child 11409 3a5c77515d55
Fixed Vulkan configure check for Android and added one for Mac OS X
configure
configure.in
src/video/cocoa/SDL_cocoametalview.h
     1.1 --- a/configure	Mon Aug 28 22:13:45 2017 -0700
     1.2 +++ b/configure	Mon Aug 28 22:36:45 2017 -0700
     1.3 @@ -745,7 +745,6 @@
     1.4  docdir
     1.5  oldincludedir
     1.6  includedir
     1.7 -runstatedir
     1.8  localstatedir
     1.9  sharedstatedir
    1.10  sysconfdir
    1.11 @@ -922,7 +921,6 @@
    1.12  sysconfdir='${prefix}/etc'
    1.13  sharedstatedir='${prefix}/com'
    1.14  localstatedir='${prefix}/var'
    1.15 -runstatedir='${localstatedir}/run'
    1.16  includedir='${prefix}/include'
    1.17  oldincludedir='/usr/include'
    1.18  docdir='${datarootdir}/doc/${PACKAGE}'
    1.19 @@ -1175,15 +1173,6 @@
    1.20    | -silent | --silent | --silen | --sile | --sil)
    1.21      silent=yes ;;
    1.22  
    1.23 -  -runstatedir | --runstatedir | --runstatedi | --runstated \
    1.24 -  | --runstate | --runstat | --runsta | --runst | --runs \
    1.25 -  | --run | --ru | --r)
    1.26 -    ac_prev=runstatedir ;;
    1.27 -  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
    1.28 -  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
    1.29 -  | --run=* | --ru=* | --r=*)
    1.30 -    runstatedir=$ac_optarg ;;
    1.31 -
    1.32    -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    1.33      ac_prev=sbindir ;;
    1.34    -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
    1.35 @@ -1321,7 +1310,7 @@
    1.36  for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
    1.37  		datadir sysconfdir sharedstatedir localstatedir includedir \
    1.38  		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
    1.39 -		libdir localedir mandir runstatedir
    1.40 +		libdir localedir mandir
    1.41  do
    1.42    eval ac_val=\$$ac_var
    1.43    # Remove trailing slashes.
    1.44 @@ -1474,7 +1463,6 @@
    1.45    --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
    1.46    --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    1.47    --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    1.48 -  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
    1.49    --libdir=DIR            object code libraries [EPREFIX/lib]
    1.50    --includedir=DIR        C header files [PREFIX/include]
    1.51    --oldincludedir=DIR     C header files for non-gcc [/usr/include]
    1.52 @@ -21921,29 +21909,62 @@
    1.53                  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.54  /* end confdefs.h.  */
    1.55  
    1.56 -                  #if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
    1.57 +                  #if defined(__ARM_ARCH) && __ARM_ARCH < 7
    1.58                    #error Vulkan doesn't work on this configuration
    1.59                    #endif
    1.60 -                  int main()
    1.61 -                  {
    1.62 -                     return 0;
    1.63 -                  }
    1.64 -
    1.65 -int
    1.66 -main ()
    1.67 -{
    1.68 +
    1.69 +int
    1.70 +main ()
    1.71 +{
    1.72 +
    1.73 +
    1.74 +  ;
    1.75 +  return 0;
    1.76 +}
    1.77 +_ACEOF
    1.78 +if ac_fn_c_try_compile "$LINENO"; then :
    1.79 +
    1.80 +
    1.81 +else
    1.82  
    1.83                      enable_video_vulkan=no
    1.84  
    1.85 -  ;
    1.86 -  return 0;
    1.87 -}
    1.88 -_ACEOF
    1.89 -if ac_fn_c_try_compile "$LINENO"; then :
    1.90 -
    1.91 -
    1.92 -fi
    1.93 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.94 +fi
    1.95 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.96 +                ;;
    1.97 +            *-*-darwin*)
    1.98 +                save_CFLAGS="$CFLAGS"
    1.99 +                                CFLAGS="$CFLAGS -x objective-c"
   1.100 +                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.101 +/* end confdefs.h.  */
   1.102 +
   1.103 +                  #include <Cocoa/Cocoa.h>
   1.104 +                  #include <Metal/Metal.h>
   1.105 +                  #include <QuartzCore/CAMetalLayer.h>
   1.106 +
   1.107 +                  #if !TARGET_CPU_X86_64
   1.108 +                  #error Vulkan doesn't work on this configuration
   1.109 +                  #endif
   1.110 +
   1.111 +int
   1.112 +main ()
   1.113 +{
   1.114 +
   1.115 +
   1.116 +  ;
   1.117 +  return 0;
   1.118 +}
   1.119 +_ACEOF
   1.120 +if ac_fn_c_try_compile "$LINENO"; then :
   1.121 +
   1.122 +
   1.123 +else
   1.124 +
   1.125 +                    enable_video_vulkan=no
   1.126 +
   1.127 +fi
   1.128 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.129 +                CFLAGS="$save_CFLAGS"
   1.130                  ;;
   1.131              *)
   1.132                  ;;
   1.133 @@ -21951,8 +21972,8 @@
   1.134          if test x$enable_video_vulkan = xno; then
   1.135              # For reasons I am totally unable to see, I get an undefined macro error if
   1.136              # I put this in the AC_TRY_COMPILE.
   1.137 -            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, Vulkan does not work on this configuration." >&5
   1.138 -$as_echo "$as_me: WARNING: Sorry, Vulkan does not work on this configuration." >&2;}
   1.139 +            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5
   1.140 +$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;}
   1.141          fi
   1.142      fi
   1.143      if test x$enable_video_vulkan = xyes; then
     2.1 --- a/configure.in	Mon Aug 28 22:13:45 2017 -0700
     2.2 +++ b/configure.in	Mon Aug 28 22:36:45 2017 -0700
     2.3 @@ -1983,7 +1983,7 @@
     2.4                    , enable_video_cocoa=yes)
     2.5      if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
     2.6          save_CFLAGS="$CFLAGS"
     2.7 -        dnl work around that we don't have Objective-C support in autoconf
     2.8 +        dnl Work around that we don't have Objective-C support in autoconf
     2.9          CFLAGS="$CFLAGS -x objective-c"
    2.10          AC_MSG_CHECKING(for Cocoa framework)
    2.11          have_cocoa=no
    2.12 @@ -2401,7 +2401,7 @@
    2.13      fi
    2.14  }
    2.15  
    2.16 -dnl Check to see if Vulkan surface support is desired
    2.17 +dnl Check to see if Vulkan support is desired
    2.18  AC_ARG_ENABLE(video-vulkan,
    2.19  AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
    2.20                , enable_video_vulkan=yes)
    2.21 @@ -2413,17 +2413,33 @@
    2.22          case "$host" in
    2.23              *-*-androideabi*)
    2.24                  AC_TRY_COMPILE([
    2.25 -                  #if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
    2.26 +                  #if defined(__ARM_ARCH) && __ARM_ARCH < 7
    2.27                    #error Vulkan doesn't work on this configuration
    2.28                    #endif
    2.29 -                  int main()
    2.30 -                  {
    2.31 -                     return 0;
    2.32 -                  }
    2.33 +                ],[
    2.34 +                ],[
    2.35                  ],[
    2.36                      enable_video_vulkan=no
    2.37 +                ])
    2.38 +                ;;
    2.39 +            *-*-darwin*)
    2.40 +                save_CFLAGS="$CFLAGS"
    2.41 +                dnl Work around that we don't have Objective-C support in autoconf
    2.42 +                CFLAGS="$CFLAGS -x objective-c"
    2.43 +                AC_TRY_COMPILE([
    2.44 +                  #include <Cocoa/Cocoa.h>
    2.45 +                  #include <Metal/Metal.h>
    2.46 +                  #include <QuartzCore/CAMetalLayer.h>
    2.47 +
    2.48 +                  #if !TARGET_CPU_X86_64
    2.49 +                  #error Vulkan doesn't work on this configuration
    2.50 +                  #endif
    2.51                  ],[
    2.52 +                ],[
    2.53 +                ],[
    2.54 +                    enable_video_vulkan=no
    2.55                  ])
    2.56 +                CFLAGS="$save_CFLAGS"
    2.57                  ;;
    2.58              *)
    2.59                  ;;
    2.60 @@ -2431,7 +2447,7 @@
    2.61          if test x$enable_video_vulkan = xno; then
    2.62              # For reasons I am totally unable to see, I get an undefined macro error if
    2.63              # I put this in the AC_TRY_COMPILE.
    2.64 -            AC_MSG_WARN([Sorry, Vulkan does not work on this configuration.])
    2.65 +            AC_MSG_WARN([Vulkan does not work on this configuration.])
    2.66          fi
    2.67      fi
    2.68      if test x$enable_video_vulkan = xyes; then
     3.1 --- a/src/video/cocoa/SDL_cocoametalview.h	Mon Aug 28 22:13:45 2017 -0700
     3.2 +++ b/src/video/cocoa/SDL_cocoametalview.h	Mon Aug 28 22:36:45 2017 -0700
     3.3 @@ -34,9 +34,9 @@
     3.4  
     3.5  #if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA
     3.6  
     3.7 -#import <Cocoa/Cocoa.h>
     3.8 -#import <Metal/Metal.h>
     3.9 -#import <QuartzCore/CAMetalLayer.h>
    3.10 +#include <Cocoa/Cocoa.h>
    3.11 +#include <Metal/Metal.h>
    3.12 +#include <QuartzCore/CAMetalLayer.h>
    3.13  
    3.14  #define METALVIEW_TAG 255
    3.15