autoconf
[Top][All Lists]
Advanced

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

Re: Causing configure script to abort when tools are missing.


From: Ralf Wildenhues
Subject: Re: Causing configure script to abort when tools are missing.
Date: Sun, 21 Oct 2007 21:28:01 +0200
User-agent: Mutt/1.5.16 (2007-10-11)

* Brad Larsen wrote on Sun, Oct 21, 2007 at 09:05:41PM CEST:
> On Sun, 21 Oct 2007 14:56:28 -0400, Ralf Wildenhues wrote:
>> * Brad Larsen wrote on Sun, Oct 21, 2007 at 08:10:03PM CEST:
>>>
>>> How can I make the configure script bail out with an error message if no
>>> suitable compiler is found?
>>
>> After AC_PROG_F77, add
>>   if test -z "$F77" || test "X$F77" = "Xno"; then
>>     AC_MSG_ERROR([No suitable Fortran 77 compiler found])
>>   fi
>
> Thanks Ralf, that did the trick.  Can you explain the second part of the 
> conditional (test "X$F77" = "Xno")?  autoconf sets the value of $F77 to 
> "no" if it's not found?

Nope, it sets it to empty.  The user might have set it to `no' to
prevent configure from finding an _existing_ compiler, for example
for testing purposes.

> I assume for safety's sake, I should do similar checks for $CC and whatever 
> other programs are required?

The compiler checks (CC, CXX, F77, FC) are "special".  configure will
bail out if it can't find the one corresponding to the first test you
have in configure.ac (because it will use it to compute things like the
object extension and such).  I wouldn't call this a feature, rather an
unfortunate internal detail.

But other than that, you should check the documentation: For example,
AC_PROG_CXX may set $CXX to `g++' if it found no suitable compiler.  I
don't know why it was done that way.  But the ChangeLogs indicate this
was already done in 1994.  So I guess the best for CXX is to do an
actual compile test.

Cheers,
Ralf




reply via email to

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