[PATCH] config.guess: Properly detect the *mingw32 targets

Charles Wilson mingw@cwilson.fastmail.fm
Thu Nov 12 13:22:00 GMT 2009


Rainer Emrich wrote:
> for the traditional i686-pc-mingw32 target everything works fine.
> The msys uname -s returns MINGW32* and for this case config.guess
> unconditionally returns i686-pc-mingw32.
> 
> But now we have two additional targets i686-w64-mingw32 and x86_64-w64-mingw32
> which are also build using msys. But config.guess unconditionally returns
> i686-pc-mingw32 for msys systems, that's the point. So you always have to
> specify --build for this two targets. This is solved by the patch.

Given the objections to using the compiler itself to determine the
system, it seems to me that msys should be modified to do the right
thing.  However, as it happens that may not be necessary: currently,
msys uname() is sensitive to the MSYSTEM environment variable. This is
used to switch between normal "build mingw32 apps" mode and "build msys
apps using the hacked msys gcc-2.95.3 compiler" mode.

This behavior could easily be extended for use with these other
compilers: e.g. without modifying the msys DLL/uname() at all.  On my
machine:

$ uname -m; uname -r; uname -s; uname -v
i686
1.0.11(0.46/3/2)
MINGW32_NT-6.0
2009-07-11 17:46

$ export MSYSTEM=MINGW64
$ uname -m; uname -r; uname -s; uname -v
i686
1.0.11(0.46/3/2)
MINGW64_NT-6.0    <<<<---- HERE
2009-07-11 17:46

Now, assuming that msys 'uname -m' returns the correct result on an
x86_64 machine AND you're building "natively" [*], then it seems that
you could modify config.status to use the "traditional" uname results to
compute the triple, so long as the mingw64 folks modify their msys
startup batch files to set MSYSTEM appropriately.

[*] of course, if you're trying to use the w64 compiler from a 32 bit
machine ... well, technically that's cross-compiling, so you should
expect to have to set $host in that case.  But with the changes above,
you'd not have to set $build.

--
Chuck

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: config.guess.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091112/c42adc95/attachment.ksh>


More information about the Gcc-patches mailing list