compiling grass5.0beta7 on linux

Russell L. Carter rcarter at pinyon.org
Mon Apr 24 21:56:59 EDT 2000


Hi all,

%Markus Neteler wrote:
%> Hi there,
%> 
%> INFINITY is defined in
%> 
%> /usr/include/math.h:    INFINITY        representation of the infinity value of type 'float'
%> 
%> If r.cost is not compiling on your machine, I assume your compiler
%> is not installed properly. The declarations in src/raster/r.cost seems
%> to be o.k.
%> 
%> Kind regards
%> 
%>  Markus Neteler
%
%Hi Markus, 
%
%sorry to insist on that, but on my Red Hat Linux 5.2, glibc 2.0.7, 
%INFINITY is not defined in /usr/include/math.h or elswhere.
%
%On IRIX 6.2 INFINITY is not defined too and compilation of r.cost stops
%too. 

It is also not in any versions of FreeBSD, include 5.0-current.
Nor is isfinite ().  I copied over the macro and inline function
defs from RH-6.1 into the one file that needed it.

%Please do not assume that all Unix systems are the same or compatible
%with some standards Linux or glibc introduced a very short time ago. I
%still hope that GRASS will continue support for other Unix platforms
%than Linux. 
%
%A portable program should use HUGE_VAL for a undefined infinite which is
%defined in <math.h> and in <limits.h>. HUGE_VAL should be compatible
%with systems that use IEEE floating point format. Another way is the
%function isinf(double X), but this is BSD and is not portable to systems
%that strictly confine to SYSV. 
%
%I don't know if the code in main.c is correct as INFINITY is defined as
%a float but null_cost is a double variable. Other possible defines:
%FLT_MAX and DBL_MAX from <limits.h> contain the biggest value a float
 ^^^^^^^^^^^^^^^^^^^
These are available on lots of systems... #include <float.h>

There is also that "#ifdef linux" in a .l file which fixes yylineno, 
needed for BSD too.  Thankfully somebody left a ~ file around, a 
diff revealed the fix.

Other than that... a clean build.  

Thanks!
Russell


%resp. a double variable can hold. One could use FLT_MAX instead of
%INFINITY. 
%
%Please contact me if you whish me to investigate this further. I can
%provide a patch.
%
%cu 
%
%Andreas 
%
%-- 
%Andreas Lange, 65187 Wiesbaden, Germany, Tel. +49 611 807850
%Andreas.Lange at Rhein-Main.de, A.C.Lange at GMX.net
%





More information about the grass-user mailing list