On 21 Apr 2000, Alexandre Oliva wrote:

> On Apr 21, 2000, Mo DeJong <[EMAIL PROTECTED]> wrote:
> 
> > On 21 Apr 2000, Alexandre Oliva wrote:
> >> On Apr 21, 2000, Mo DeJong <[EMAIL PROTECTED]> wrote:
> >> 
> >> > So if it should have been "internal" then why do I need to add the
> >> > AC_CANONICAL_BUILD macro to my configure.in file to get cross
> >> > compiling to work?
> 
> > But the docs tell me I only need AC_CANONICAL_SYSTEM if I am
> > a tool in a cross compiler toolchain.
> 
> Yep, that's right.  The point is that you should seldom need
> information about the build platform.  So AC_CANONICAL_SYSTEM, that
> sets build, host and target, is useful for cross-compiler toolchains
> because it sets target, and target is useless for any other kind of
> application.
> 
> -- 
> Alexandre Oliva    Enjoy Guaran�, see http://www.ic.unicamp.br/~oliva/
> Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
> Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
> oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me
> 


Ok, I am starting to see the light now. I now think that I have
a much better way to solve this whole mess. I created a patch
to add a AC_CHECK_TOOLS macro that works just like the AC_CHECK_PROGS
macro. Then I just pop this macro into AC_PROG_CXX and presto
my 4 line script works for the cross compile case.


mo(~/foo)% cat configure.in 
AC_INIT(foo.cpp)
AC_PREREQ(2.14)

AC_LANG_CPLUSPLUS
AC_PROG_CXX


mo(~/foo)% ./configure 
checking host system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for c++... c++
checking whether the C++ compiler (c++   ) works... yes
checking whether the C++ compiler (c++   ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes


mo(~/foo)% ./configure --host=i586-cygwin32
checking host system type... i586-pc-cygwin32
checking build system type... i686-pc-linux-gnu
checking for i586-cygwin32-c++... i586-cygwin32-c++
checking whether the C++ compiler (i586-cygwin32-c++   ) works... yes
checking whether the C++ compiler (i586-cygwin32-c++   ) is a
cross-compiler... yes
checking whether we are using GNU C++... yes
checking whether i586-cygwin32-c++ accepts -g... yes


I will send the patch along with my earlier patch to autoconf-patches.
I want to touch it up a bit an make sure it works for C as well.

Mo Dejong
Red Hat Inc.

Reply via email to