diff --git a/configure.ac b/configure.ac index 010abc8..d7a17f2 100644 --- a/configure.ac +++ b/configure.ac @@ -142,32 +142,18 @@ case $host in *-mingw*) if test -z "$host_alias"; then - - # No --host argument was given to 'configure'; therefore $host - # was set to a default value based on the build platform. But - # this default value may be wrong if we are building from a - # 64-bit MSYS[2] pre-configured to build 32-bit MinGW programs. - # Therefore, we'll try to get the right host platform from the - # compiler's target. - - AC_MSG_CHECKING([the compiler's target]) - if test -z "$CC"; then - cc=gcc - else - cc=$CC - fi - cc_target=`$cc -v 2>&1 | sed -n 's/Target: //p'` - case "$cc_target" in - *-*) host=$cc_target - ;; - "") AC_MSG_ERROR([Impossible to obtain $cc compiler target. -Please explicitly provide --host.]) - ;; - *) AC_MSG_WARN([Compiler reported non-standard target. -Defaulting to $host.]) - ;; - esac - AC_MSG_RESULT([$host]) + # No --host argument was given; therefore $host was set to $build. + # But this default value is wrong if we are building from MSYS2 + # 64-bit with the mingw32 shell, or from MSYS2 32-bit with the + # mingw64 shell. So we have to amend $host in those cases. + host1=`AS_ECHO $host | sed \ + -e 's/x86_64-pc-mingw32/i686-pc-mingw32/' \ + -e 's/i686-pc-mingw64/x86_64-pc-mingw64/'` + + if test "$host1" != "$host"; then + host=$host1 + AC_MSG_WARN([host system type amended to $host]) + fi fi . $srcdir/nt/mingw-cfg.site