[GRASS-dev] [bug #3224] (grass) r.terraflow does not compile (Solaris2.9/Sparc)

Report from Harri:

after a very long time, I managed to get back into compiling GRASS on
Solaris2.9/Sparc.

r.terraflow:

Does not compile, complains about:
"direction.h", line 50: Error: Could not open include file<ostream.h>.

Which in Solaris is <iostream.h> (or <iostream> for standard mode
libraries which use namespaces.) The same goes also for
IOStream/include/empq_impl.h
The test present in both these cases about whether the compiler is GNU 3
with subnumber 1 or larger excludes the new GNU 4 compilers, which is
probably not the intention. It also excludes the Solaris CC, and the
system currently recommends using <iostrem> while <iostrem.h> is not
standard and deprecated.

Then, in the main.cc on line 333:
"main.cc", line 333: Error: The function "ctime_r" must have a
prototype."

-------------------------------------------- Managed by Request Tracker

Markus Neteler via RT wrote:

Report from Harri:

after a very long time, I managed to get back into compiling GRASS on
Solaris2.9/Sparc.

r.terraflow:

Does not compile, complains about:
"direction.h", line 50: Error: Could not open include file<ostream.h>.

Which in Solaris is <iostream.h> (or <iostream> for standard mode
libraries which use namespaces.) The same goes also for
IOStream/include/empq_impl.h
The test present in both these cases about whether the compiler is GNU 3
with subnumber 1 or larger excludes the new GNU 4 compilers, which is
probably not the intention. It also excludes the Solaris CC, and the
system currently recommends using <iostrem> while <iostrem.h> is not
standard and deprecated.

Then, in the main.cc on line 333:
"main.cc", line 333: Error: The function "ctime_r" must have a
prototype."

common.cc starts with:
#include <sys/types.h>
#include <sys/mman.h>
#include <ctype.h>

#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#include <ostream>
#else
#include <ostream.h>
#endif

#include <iostream>
using namespace std;

#include "common.h"

gcc (g++) 3.0 shipped with headers without the ".h", except for ostream.
all others dropped the ".h" at gcc 2.95?
after gcc 3.1 all ".h" are gone.

maybe we need to extend these tests to be less gcc centric.

"ostream" != "iostream"

$ ll /usr/include/c++/3.3/ | grep stream
-rw-r--r-- 1 root root 24834 May 25 2005 fstream
-rw-r--r-- 1 root root 3041 May 25 2005 iostream
-rw-r--r-- 1 root root 27292 May 25 2005 istream
-rw-r--r-- 1 root root 18353 May 25 2005 ostream
-rw-r--r-- 1 root root 20575 May 25 2005 sstream
-rw-r--r-- 1 root root 31972 May 25 2005 streambuf

but iostream #includes both <istream> and <ostream>

Hamish