[GRASS5] r.flow: strange compile error M_PI

Glynn Clements glynn at gclements.plus.com
Tue Jun 28 07:27:55 EDT 2005


Brad Douglas wrote:

> Currently, "gmath.h" doesn't seem like the best place to define it, but
> it's not the worst, either.

It shouldn't go in gmath.h; that's for more "heavyweight" stuff.

> Personally, I would work this out via autoconf by doing something like:
> 
> ...
> AC_MSG_CHECKING(for M_PI) 
> mpi=no 
> AC_TRY_COMPILE([#include <math.h>], 
> [ double f = M_PI; ], 
> mpi=yes, AC_DEFINE(M_PI, 3.14159265358979323846)) 
> AC_MSG_RESULT($mpi)

Personally, I would just conditionalise the local definitions, e.g.:

	#ifndef M_PI
	#define M_PI 3.14159265358979323846
	#endif

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list