This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Charles Wilson schrieb:
> Rainer Emrich wrote:
>> I doubt if that's the right solution! As I see it, msys is primary a build
>> system for windows. Which may be used by different windows targeted toolchains.
>> These not only have different compilers, also different runtimes bundled. This
>> in mint, it's much more natural and much easier to decide by invoking the compiler.
>>
>> This way you may have an arbitrary count of different toolchains with bundled
>> runtimes which will just work! For switching between different toolchains you
>> only have to modify your PATH!
> 
> I was just going by this, from around line 100 in config.guess:
> 
> # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
> # compiler to aid in system detection is discouraged as it requires
> # temporary files to be created and, as you can see below, it is a
> # headache to deal with in a portable fashion.
> 
> Now..."discouraged" doesn't mean "disallowed", so I guess you could do
> it your way. OTOH, config.guess can be used with packages that don't
> require a compiler at all (python/ruby/perl extensions, shell script
> packages, ...), and your method would break in that case.  But I suppose
> the odds of somebody trying to "build" a package on a win32ish platform
> and NOT having any C compiler at all installed, yet still having a shell
> interpreter in order to run config.guess at all, is pretty low.
> 
> I notice that most of the other mechanisms that use CC_FOR_BUILD use it
> to either compile a small test program, or preprocess and parse the
> output. They don't rely on gcc-specific command line flags like
> -dumpmachine.  But given that we're specifically talking about *MINGW*
> here -- which is by definition "gcc for win32" and not "intelcc" or
> "borlandcc" -- maybe that's ok too.
> 
> --
> Chuck
> 

Here's a revised patch. If there are no objections here, I will send it to
config-patches@gnu.org.

Cheers,
Rainer

- ---
2009-11-13  Rainer Emrich  <rainer@emrich-ebersheim.de>

        * config.guess: Properly detect the *mingw32 targets

- --- config.guess        (revision 154096)
+++ config.guess        (working copy)
@@ -798,7 +798,19 @@ EOF
        echo ${UNAME_MACHINE}-pc-cygwin
        exit ;;
     *:MINGW*:*)
- -       echo ${UNAME_MACHINE}-pc-mingw32
+       eval $set_cc_for_build
+       if [ "$CC_FOR_BUILD" = 'no_compiler_found' ]; then
+           echo ${UNAME_MACHINE}-pc-mingw32
+       else
+           if echo __GNUC__ | $CC_FOR_BUILD -E - 2>/dev/null | grep -q __GNUC__
+           then
+               # Non GNU compiler found
+               echo unknown-unknown-mingw32
+           else
+               # GNU compiler found, dump machine
+               echo `$CC_FOR_BUILD -dumpmachine`
+           fi
+       fi
        exit ;;
     i*:windows32*:*)
        # uname -m includes "-pc" on this system.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr9Lz8ACgkQoUhjsh59BL4/ZgCfYVVc1gjMd25WqPB0GDKUNmpJ
fu4AnAsYg0fA94b54AG24GpFUplvKYIq
=Eucm
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]