autoconf
[Top][All Lists]
Advanced

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

Re: MPI recognition


From: Eric Blake
Subject: Re: MPI recognition
Date: Tue, 21 Dec 2010 08:57:04 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 12/21/2010 07:16 AM, Olaf Lenz wrote:
> I have attached my simplified attempt do this. When I run autoconf, I
> get the warning
> 
>   configure.ac:4: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before
> it was required
> 
> and configure doesn't seem to be looking for mpicc, but always finds gcc
> first.
> The problem seems to be that AC_PROG_CC doesn't work when using it in a
> conditional, is that right? Is there any simple way to do what I want?

The problem is that the autoconf AC_REQUIRE machinery can only be used
to require a macro with default arguments.  When you invoke AC_PROG_CC
inside AS_IF, the AS_IF ends up hoisting the AC_PROG_CC body to occur
early, but in the process, loses the arguments that you specified.
Whether this can be fixed in future autoconf is another matter, but in
general, AC_PROG_CC is special enough that if you ever want to pass
non-default arguments, you must invoke it outside of conditionals.

> After some trial and error I have found a solution for my problem that
> is very simple. Now I wonder whether this is actually the correct way to
> do it, or are there some hidden pitfalls?
> 
> AC_ARG_WITH(mpi,,, [with_mpi=guess])
> if test x"$with_mpi" != xno; then
>   COMPILERS="mpicc hcc mpxlc_r mpxlc mpcc cmpicc gcc cc"
> else
>   COMPILERS="gcc cc"
> fi
> AC_PROG_CC($COMPILERS)

Yes, this is actually a quite decent solution, although you may be
artificially limiting the set of $COMPILERS to something less than what
AC_PROG_CC() would support by default.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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