mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
build: Rewrite checks for MinGW using polymorphic shell variables.
This commit is contained in:
parent
f931d3ad66
commit
30a19692af
@ -46,8 +46,8 @@ VKD3D_CHECK_SYNC_ADD_AND_FETCH_FUNC
|
||||
VKD3D_CHECK_SYNC_SUB_AND_FETCH_FUNC
|
||||
|
||||
dnl Check for cross compilers
|
||||
VKD3D_CHECK_MINGW32_PROG(CROSSCC32, CROSSTARGET32, false)
|
||||
VKD3D_CHECK_MINGW64_PROG(CROSSCC64, CROSSTARGET64, false)
|
||||
VKD3D_CHECK_MINGW32_PROG(CROSSCC32, CROSSTARGET32, [false])
|
||||
VKD3D_CHECK_MINGW64_PROG(CROSSCC64, CROSSTARGET64, [false])
|
||||
|
||||
AM_CONDITIONAL([HAS_CROSSTARGET32], [test "x$CROSSTARGET32" != xfalse])
|
||||
AM_CONDITIONAL([HAS_CROSSTARGET64], [test "x$CROSSTARGET64" != xfalse])
|
||||
|
@ -1,56 +1,39 @@
|
||||
dnl VKD3D_CHECK_MINGW32_PROG(variable, crosstarget-variable, [value-if-not-found], [path])
|
||||
dnl VKD3D_CHECK_MINGW32_PROG(cc-variable, crosstarget-variable, [value-if-not-found], [path])
|
||||
AC_DEFUN([VKD3D_CHECK_MINGW32_PROG],
|
||||
[
|
||||
AC_SUBST([$2], [$3])dnl
|
||||
[AC_SUBST([$2], [$3])
|
||||
vkd3d_mingw_list="m4_foreach([vkd3d_mingw_prefix], [w64-mingw32, pc-mingw32, mingw32, mingw32msvc],
|
||||
m4_foreach([vkd3d_cpu], [i686, i586, i486, i386], [vkd3d_cpu-vkd3d_mingw_prefix-gcc ]))
|
||||
mingw32-gcc"
|
||||
m4_foreach([vkd3d_cpu], [i686, i586, i486, i386], [vkd3d_cpu-vkd3d_mingw_prefix-gcc ])) mingw32-gcc"
|
||||
AC_CHECK_PROGS([$1], [$vkd3d_mingw_list], [$3], [$4])
|
||||
if test "x[$]$1" != x$3
|
||||
then
|
||||
vkd3d_cc_saved="$CC"
|
||||
CC="[$]$1"
|
||||
AC_MSG_CHECKING([whether $CC works])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
set x [$]$1
|
||||
shift
|
||||
while test "[$]#" -ge 1
|
||||
do
|
||||
case "[$]1" in
|
||||
*-gcc) $2=`expr "[$]1" : '\(.*\)-gcc'` ;;
|
||||
esac
|
||||
shift
|
||||
done],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CC="$vkd3d_cc_saved"
|
||||
fi
|
||||
AS_VAR_PUSHDEF([vkd3d_cross_cc], [$1])dnl
|
||||
AS_VAR_IF([vkd3d_cross_cc], [$3],
|
||||
[],
|
||||
[vkd3d_cc_saved="$CC"
|
||||
AS_VAR_COPY([CC], [vkd3d_cross_cc])
|
||||
AC_MSG_CHECKING([whether $CC works])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
$2=`expr "$CC" : '\(.*\)-gcc'`],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CC="$vkd3d_cc_saved"])
|
||||
AS_VAR_POPDEF([vkd3d_cross_cc])dnl
|
||||
])
|
||||
|
||||
dnl VKD3D_CHECK_MINGW64_PROG(variable, crosstarget-variable, [value-if-not-found], [path])
|
||||
dnl VKD3D_CHECK_MINGW64_PROG(cc-variable, crosstarget-variable, [value-if-not-found], [path])
|
||||
AC_DEFUN([VKD3D_CHECK_MINGW64_PROG],
|
||||
[
|
||||
AC_SUBST([$2], [$3])dnl
|
||||
[AC_SUBST([$2], [$3])
|
||||
vkd3d_mingw_list="m4_foreach([vkd3d_mingw_prefix], [pc-mingw32, w64-mingw32, mingw32msvc],
|
||||
m4_foreach([vkd3d_cpu], [x86_64, amd64], [vkd3d_cpu-vkd3d_mingw_prefix-gcc ]))"
|
||||
AC_CHECK_PROGS([$1], [$vkd3d_mingw_list], [$3], [$4])
|
||||
if test "x[$]$1" != x$3
|
||||
then
|
||||
vkd3d_cc_saved="$CC"
|
||||
CC="[$]$1"
|
||||
AC_MSG_CHECKING([whether $CC works])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
set x [$]$1
|
||||
shift
|
||||
while test "[$]#" -ge 1
|
||||
do
|
||||
case "[$]1" in
|
||||
*-gcc) $2=`expr "[$]1" : '\(.*\)-gcc'` ;;
|
||||
esac
|
||||
shift
|
||||
done],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CC="$vkd3d_cc_saved"
|
||||
fi
|
||||
AS_VAR_PUSHDEF([vkd3d_cross_cc], [$1])dnl
|
||||
AS_VAR_IF([vkd3d_cross_cc], [$3],
|
||||
[],
|
||||
[vkd3d_cc_saved="$CC"
|
||||
AS_VAR_COPY([CC], [vkd3d_cross_cc])
|
||||
AC_MSG_CHECKING([whether $CC works])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
$2=`expr "$CC" : '\(.*\)-gcc'`],
|
||||
[AC_MSG_RESULT([no])])
|
||||
CC="$vkd3d_cc_saved"])
|
||||
AS_VAR_POPDEF([vkd3d_cross_cc])dnl
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user