config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Better mingw support


From: LRN
Subject: Better mingw support
Date: Fri, 29 Mar 2013 11:50:09 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Thunderbird/22.0a1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've noticed that config.guess will always detect my system as:
i686-pc-mingw32.
Turns out:
1) -pc vendor name is hard-coded into config.guess
2) config.guess relies on uname to get machine architecture

Both are wrong, because:
1) mingw-w64 toolchain has -w64 vendor name, but can (and should)
still be used with MSYS. uname is a MSYS-only utility, and has no
knowledge of the mingw toolchain installed alongside it. Thus uname
can't tell a difference between MSYS+mingw.org toolchain and
MSYS+mingw-w64 toolchain.
While it might (didn't test that) be possible to modify msys
configuration to identify itself differently, it would have to be
enforced from outside, and would still have nothing to do with the
toolchain.

2) uname only reports MSYS architecture. MSYS (at the moment; not sure
about MSYS2) is 32-bit only, and will always report itself as either
i386 or i686 (could also claim to be "alpha" or "mips", but that's
exotic) based upon GetSystemInfo() API call results. Even if it had
been capable of correctly identifying x86_64 versions of the OS, that
still would be somewhat at odds with the toolchain, because x86_64
Windows can run both x86 and x86_64 toolchains. It is better to ask
the toolchain about its architecture.

To this end, *:MINGW*:* case should not default to
${UNAME_MACHINE}-pc-mingw32, but should instead run CC like some other
tests do, and check for the following preprocessor definitions:
__MINGW32_MAJOR_VERSION
__MINGW64_VERSION_MAJOR
__MINGW32__
__MINGW64__

__MINGW32__ is defined by all mingw toolchains, both x86 and x86_64,
from both vendors (mingw.org and mingw-w64). If it isn't there, it's
not mingw. Defined by gcc internally.

__MINGW64__ is only defined by x86_64 toolchains (currently only
mingw-w64, but mingw.org might catch up in the future) alongside with
__MINGW32__. Defined by gcc internally.

__MINGW64_VERSION_MAJOR is only defined by mingw-w64 headers (same
headers used for both x86 and x86_64). Defined by headers, so you need
to include a standard header (such as stdio.h) for it to appear.

__MINGW32_MAJOR_VERSION is only defined by mingw.org headers. Defined
by headers, so you need to include a standard header (such as stdio.h)
for it to appear.

A proof-of-concept patch is attached.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRVUevAAoJEOs4Jb6SI2CwDkEH/imcDKL4F+bAr+PZ7J5cNYnl
LZiWn1JRxFC9hTyVHMYoEHakkIKizxugTdCzMuKDMn5eEk01B5k3mNc8R+bz9rb7
BFhF4r9DPhM9gRqsch3r6OJ9qFQaFgRvqErkupTzXJykqfaFP1YOFsFM5PYV/a4l
d6TMtJidbCTnAdvFpFlZu5hLoX7owi5aZfn0DylRF8/vvcO1ZqsrpqtFuLU7Pfvn
1Bku/pG/VllIxDBwlEn46jinFeA3iY1z+LMb0cydrvGAbCKPpKZeHgsL/ZAeQPCE
0xfyEzOnD1pDaYYEr842TcABNkc30o3+WMVl83CyrZHu9Q7Hbwb1ArAhe0TqO58=
=vnKY
-----END PGP SIGNATURE-----

Attachment: config.guess-mingw-w64.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]