Subject: RE: Compiling apps to Mingw32 with cygwin
From: "Jon Leichter" <[email-masked]>
To: "Robert Collins" <[email-masked]>
Cc: <[email-masked]>, <[email-masked]>
Date: Thu, 10 Jan 2002 14:08:00 -0800

> -----Original Message-----
> From: [email-masked] [mailto:[email-masked]]On Behalf
> Of Robert Collins
> Sent: Thursday, January 10, 2002 1:44 PM
> To: [email-masked]
> Cc: [email-masked]
> Subject: Re: Compiling apps to Mingw32 with cygwin
>
> Autoconf 2.13 supports these options - so the configure script doesn't
> need to be *that* up to date.
>
> However, the script needs
> AC_CANONICAL_BUILD
> AC_CANONICAL_HOST
> (and if the package generates platform specific output (ie it's an
> assembler/compiler etc)
> AC_CANONICAL_TARGET
> in the configure.in. You may need to add the relevant macros and run
> autoconf again.
>
> As for --build, it is automatically detected as long as
> AC_CANONICAL_BUILD is in the script. You may get a warning
> ==
> configure: WARNING: If you wanted to set the --build type, don't
> use --host.
>     If a cross compiler is detected then cross compile mode will be
> used.
> ==
> This warning is safe IFF you have a cross compiler.

Ok. Definitely some misunderstandings on my part. So, I will restate:

For any particular project, the --build, --host, --target switches are not
guaranteed to be work "properly". This will depend on how well configure.in
has been written. In that respect, the project builder STILL needs to
manually check the 'configure' script (or just try to use it and see what
happens).

>
> > This spawns another associated topic. What are the right values for
> > the triplets (in CURRENT autoconf)? If you're building MinGW
> > binaries in a Cygwin-hosted environment, it seems to me that you
> > should ONLY specify --target=i686-pc-mingw32 and let the other
> > two switches resolve.
>
> No. Specify --host. The meaning is clearly documented in the autoconf
> documentation.
> For clarity:
> build - what OS the compilation is running on..
> host  - what OS the binaries created should run on.
> target - what OS the binaries created should target their output to.

Actually, I'm a little unclear. Are you saying that 'target' is for binaries
that you build, which in themselves, generate other binaries? Would an
example of this be GCC? Would I still need to "properly" specify --target if
I wasn't building binaries that generated binaries? Would you then say that
the following is the appropriate set of switches for Cygwin-GCC to produce
MinGW binaries:

	--build=i686-pc-cygwin --host=i686-pc-mingw32 --target=i686-pc-mingw32

Can I leave out the --build switch? Will it get automatically resolved? Or
does that ALSO depend on how well configure.in was written? In the configure
scripts I've used, I have consistently seen the 'build' variables get
assigned the same values as the 'host' variables.

> > Note that I have tried to only use the --target switch in my projects,
> > opposed to the --host switch. However, in OpenLDAP and the other
> > related projects, NONE of the configure scripts handle these switches
> > correctly. I found that using --host was the best solution for these
> > projects.
>
> --target being the wrong switch, I'm not surprised it didn't do what you
> wanted :}.
>

Ok. Once I've had my switch questions answered, I will go back and see how
well those switches play in my projects.

Jon

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/