diff --git a/configure b/configure index 2597bc0e791..d757194be45 100755 --- a/configure +++ b/configure @@ -19273,34 +19273,41 @@ if test "x$ac_cv_cflags__Wno_format" = xyes then : EXTRACFLAGS="$EXTRACFLAGS -Wno-format" fi ;; - *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -mabi=ms" >&5 -printf %s "checking whether the compiler supports -mabi=ms... " >&6; } -if test ${ac_cv_cflags__mabi_ms+y} + *) if test -z "$CROSSTARGET" + then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -mabi=ms" >&5 +printf %s "checking for working -mabi=ms... " >&6; } +if test ${ac_cv_mabi_ms+y} then : printf %s "(cached) " >&6 else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -mabi=ms" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + CFLAGS="$CFLAGS -mabi=ms" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } +#include +int a(int b, ...) { __builtin_ms_va_list list; __builtin_ms_va_start(list,b); } +int +main (void) +{ + + ; + return 0; +} _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_cflags__mabi_ms=yes + ac_cv_mabi_ms=yes else $as_nop - ac_cv_cflags__mabi_ms=no + ac_cv_mabi_ms=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__mabi_ms" >&5 -printf "%s\n" "$ac_cv_cflags__mabi_ms" >&6; } -if test "x$ac_cv_cflags__mabi_ms" = xyes -then : - MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms" -fi ;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mabi_ms" >&5 +printf "%s\n" "$ac_cv_mabi_ms" >&6; } + test $ac_cv_mabi_ms = yes || as_fn_error $? "The compiler doesn't support -mabi=ms. Use gcc instead of clang, or install mingw-w64." "$LINENO" 5 + fi + MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms" ;; esac ;; esac diff --git a/configure.ac b/configure.ac index d14cc396e51..7881af45e5b 100644 --- a/configure.ac +++ b/configure.ac @@ -1893,7 +1893,17 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy= dnl Mingw uses Windows 64-bit types, not Unix ones cygwin*|mingw32*) WINE_TRY_CFLAGS([-Wno-format]) ;; dnl Default to ms_abi on 64-bit - *) WINE_TRY_CFLAGS([-mabi=ms],[MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms"]) ;; + *) if test -z "$CROSSTARGET" + then + AC_CACHE_CHECK([for working -mabi=ms], ac_cv_mabi_ms, + [CFLAGS="$CFLAGS -mabi=ms" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +int a(int b, ...) { __builtin_ms_va_list list; __builtin_ms_va_start(list,b); }]])], + [ac_cv_mabi_ms=yes],[ac_cv_mabi_ms=no]) + CFLAGS=$saved_CFLAGS]) + test $ac_cv_mabi_ms = yes || AC_MSG_ERROR([The compiler doesn't support -mabi=ms. Use gcc instead of clang, or install mingw-w64.]) + fi + MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms" ;; esac ;; esac