[Top][All Lists]

[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

Hash: SHA1

I've noticed that config.guess will always detect my system as:
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 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

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__ is defined by all mingw toolchains, both x86 and x86_64,
from both vendors ( 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 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 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.
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird -


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

reply via email to

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