automake
[Top][All Lists]
Advanced

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

Re: Can I select a different compiler ??


From: Ronald Landheer-Cieslak
Subject: Re: Can I select a different compiler ??
Date: Wed, 16 Apr 2003 10:23:16 +0200 (CEST)

The easiest way I know to do what you want, is to separate foo and foobar, 
using two configure.ac files. The configure.ac file would contain an 
AC_PROG_CC invocation with the different "special" compilers, which would 
make the configure script search for those in stead of the standard list 
of compilers.

Failing that, you'll have to write your own m4 macro to scan for the 
compilers, much like AC_PROG_CC_FOR_BUILD does - but note that 
AC_PROG_CC_FOR_BUILD doesn't work for the current autoconf and I don't 
know why (yet) (apparently, the pushdefs don't get propagated correctly).

HTH

rlc


On Tue, 15 Apr 2003, Dr. David Kirkby wrote:
> Hi,
>       I'm using autoconf/automake on a set of programs (call them foo and
> foobar) that are likely to use two different C compilers. foo is
> likely to be compiled with gcc or cc (as determined by the configure
> script) and will of course be set by the configure script to the
> variable CC.
> 
> The other compiler, needed to compile foobar, is a bit more
> specialised and might typically be be called mpicc,  hcc, mpcc, mpcc_r
> or whatever. This compiler is used for compiling code to run on a
> network of distributed computers. This compiler is set to the variable
> MPICC and the linker flags are set to MPILIBS. These are both set
> using an M4 macro called from the configure script. 
> 
> I want to compile+link foo with the $CC compiler and $LIBS, but foobar
> with the $MPICC compiler and $MPILIB + $LIBS libraries. I've sorted
> out how to do the libraries (see below), but I'm not sure how to
> enforce foobar to be compiled/linked using $MPICC rather than the
> normal $CC.
> 
> # This is part of the Makefile.am. 
> # foo needs no special treatment, as the default $CC compiler is fine. 
> bin_PROGRAMS = foo foobar
> foo_SOURCES = foo1.c foo2.c
> foo_LDADD = @LIBS@
> 
> # foobar needs to be compiled with the $MPICC compiler and linked with
> $MPILIBS.
> # the linker is easy to sort out, but how about the compiler ???????
> foobar_SOURCES = foobar1.c foobar2.c
> foobar_LDADD = @LIBS@ @MPILIB@
> 
> 
> 





reply via email to

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