Fixed Vulkan configure check for Android and added one for Mac OS X

This commit is contained in:
Sam Lantinga 2017-08-28 22:36:45 -07:00
parent 90b38a5d61
commit 8ac85744cd
3 changed files with 70 additions and 33 deletions

63
configure vendored
View File

@ -745,7 +745,6 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -922,7 +921,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}' docdir='${datarootdir}/doc/${PACKAGE}'
@ -1175,15 +1173,6 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1321,7 +1310,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir libdir localedir mandir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1474,7 +1463,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -21921,19 +21909,14 @@ CheckVulkan()
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) #if defined(__ARM_ARCH) && __ARM_ARCH < 7
#error Vulkan doesn't work on this configuration #error Vulkan doesn't work on this configuration
#endif #endif
int main()
{
return 0;
}
int int
main () main ()
{ {
enable_video_vulkan=no
; ;
return 0; return 0;
@ -21942,17 +21925,55 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
else
enable_video_vulkan=no
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;; ;;
*-*-darwin*)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <Cocoa/Cocoa.h>
#include <Metal/Metal.h>
#include <QuartzCore/CAMetalLayer.h>
#if !TARGET_CPU_X86_64
#error Vulkan doesn't work on this configuration
#endif
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
enable_video_vulkan=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
;;
*) *)
;; ;;
esac esac
if test x$enable_video_vulkan = xno; then if test x$enable_video_vulkan = xno; then
# For reasons I am totally unable to see, I get an undefined macro error if # For reasons I am totally unable to see, I get an undefined macro error if
# I put this in the AC_TRY_COMPILE. # I put this in the AC_TRY_COMPILE.
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, Vulkan does not work on this configuration." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5
$as_echo "$as_me: WARNING: Sorry, Vulkan does not work on this configuration." >&2;} $as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;}
fi fi
fi fi
if test x$enable_video_vulkan = xyes; then if test x$enable_video_vulkan = xyes; then

View File

@ -1983,7 +1983,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]])
, enable_video_cocoa=yes) , enable_video_cocoa=yes)
if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
dnl work around that we don't have Objective-C support in autoconf dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c"
AC_MSG_CHECKING(for Cocoa framework) AC_MSG_CHECKING(for Cocoa framework)
have_cocoa=no have_cocoa=no
@ -2401,7 +2401,7 @@ CheckEmscriptenGLES()
fi fi
} }
dnl Check to see if Vulkan surface support is desired dnl Check to see if Vulkan support is desired
AC_ARG_ENABLE(video-vulkan, AC_ARG_ENABLE(video-vulkan,
AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
, enable_video_vulkan=yes) , enable_video_vulkan=yes)
@ -2413,25 +2413,41 @@ CheckVulkan()
case "$host" in case "$host" in
*-*-androideabi*) *-*-androideabi*)
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) #if defined(__ARM_ARCH) && __ARM_ARCH < 7
#error Vulkan doesn't work on this configuration #error Vulkan doesn't work on this configuration
#endif #endif
int main() ],[
{ ],[
return 0;
}
],[ ],[
enable_video_vulkan=no enable_video_vulkan=no
],[
]) ])
;; ;;
*-*-darwin*)
save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c"
AC_TRY_COMPILE([
#include <Cocoa/Cocoa.h>
#include <Metal/Metal.h>
#include <QuartzCore/CAMetalLayer.h>
#if !TARGET_CPU_X86_64
#error Vulkan doesn't work on this configuration
#endif
],[
],[
],[
enable_video_vulkan=no
])
CFLAGS="$save_CFLAGS"
;;
*) *)
;; ;;
esac esac
if test x$enable_video_vulkan = xno; then if test x$enable_video_vulkan = xno; then
# For reasons I am totally unable to see, I get an undefined macro error if # For reasons I am totally unable to see, I get an undefined macro error if
# I put this in the AC_TRY_COMPILE. # I put this in the AC_TRY_COMPILE.
AC_MSG_WARN([Sorry, Vulkan does not work on this configuration.]) AC_MSG_WARN([Vulkan does not work on this configuration.])
fi fi
fi fi
if test x$enable_video_vulkan = xyes; then if test x$enable_video_vulkan = xyes; then

View File

@ -34,9 +34,9 @@
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA #if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA
#import <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#import <Metal/Metal.h> #include <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h> #include <QuartzCore/CAMetalLayer.h>
#define METALVIEW_TAG 255 #define METALVIEW_TAG 255