Changes from Bernie Bright:
Added '--with-cxx=COMPILER[:flags]' to ./configure in order to set the compiler and flags. If this option is omitted then the default compiler is assumed (ie the current behaviour). This duplicates the effect of passing CC, CFLAGS, CXX and CXXFLAGS on the command line to configure and make. SimGear/simgear/compiler.h Initial support for KAI C++ on linux. SimGear/simgear/ephemeris/celestialBody.[ch]xx Removed extraneous semicolons. SimGear/simgear/io/sg_file.cxx MSVC tidy up.
This commit is contained in:
parent
2c4a0dd998
commit
31db353173
21
acsite.m4
21
acsite.m4
@ -392,3 +392,24 @@ if test "$have_timezone" = no; then
|
||||
AC_MSG_RESULT(no))
|
||||
fi
|
||||
])dnl
|
||||
|
||||
## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
|
||||
## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
|
||||
AC_DEFUN(AC_SG_SET_COMPILER,
|
||||
[cxxwith=`echo $1 | sed -e 's/ /@/'`
|
||||
case "$cxxwith" in
|
||||
*:*@*) # Full initialization syntax
|
||||
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)@.*/\1/p'`
|
||||
CXXFLAGS=`echo "$cxxwith" | sed -n -e 's/.*:.*@\(.*\)/\1/p'`
|
||||
;;
|
||||
*:*) # Simple initialization syntax
|
||||
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)/\1/p'`
|
||||
CXXFLAGS=$3
|
||||
;;
|
||||
*) # Default values
|
||||
CXX=$2
|
||||
CXXFLAGS=$3
|
||||
CC="$2 --c"
|
||||
## CFLAGS=
|
||||
;;
|
||||
esac])
|
||||
|
17
configure.in
17
configure.in
@ -8,6 +8,23 @@ AC_INIT(simgear/bucket/newbucket.cxx)
|
||||
dnl Initialize the automake stuff
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.0.14)
|
||||
|
||||
dnl Specify KAI C++ compiler and flags.
|
||||
dnl Borrowed with slight modification from blitz distribution.
|
||||
AC_ARG_WITH(cxx,
|
||||
[ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
|
||||
[case "$withval" in
|
||||
KCC*) # KAI C++ http://www.kai.com/
|
||||
echo "Configuring for KAI C++"
|
||||
AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
|
||||
CXX_OPTIMIZE_FLAGS=="+K3 -O3"
|
||||
CXX_DEBUG_FLAGS="-g +K0"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
echo CXX = $CXX
|
||||
echo CC = $CC
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
|
@ -94,6 +94,25 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* KAI C++ */
|
||||
#if defined(__KCC)
|
||||
|
||||
# define FG_NAMESPACES
|
||||
# define FG_HAVE_STD
|
||||
# define FG_HAVE_STREAMBUF
|
||||
# define FG_HAVE_TRAITS
|
||||
# define FG_HAVE_STD_INCLUDES
|
||||
|
||||
# define STL_ALGORITHM <algorithm>
|
||||
# define STL_FUNCTIONAL <functional>
|
||||
# define STL_IOMANIP <iomanip>
|
||||
# define STL_IOSTREAM <iostream>
|
||||
# define STL_FSTREAM <fstream>
|
||||
# define STL_STDEXCEPT <stdexcept>
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Metrowerks
|
||||
//
|
||||
|
@ -108,7 +108,7 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun)
|
||||
}
|
||||
|
||||
FV = RAD_TO_DEG * acos( tmp );
|
||||
};
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* double CelestialBody::sgCalcEccAnom(double M, double e)
|
||||
|
@ -121,7 +121,7 @@ inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
updateOrbElements(mjd);
|
||||
};
|
||||
}
|
||||
|
||||
inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
@ -136,7 +136,7 @@ inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
};
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* inline void CelestialBody::updateOrbElements(double mjd)
|
||||
|
@ -50,19 +50,13 @@ SGFile::~SGFile() {
|
||||
bool SGFile::open( SGProtocolDir dir ) {
|
||||
if ( dir == SG_IO_OUT ) {
|
||||
#ifdef _MSC_VER
|
||||
fp = _open( file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
|
||||
00666 );
|
||||
int mode = 00666;
|
||||
#else
|
||||
fp = std::open( file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
|
||||
S_IROTH | S_IWOTH );
|
||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||
#endif
|
||||
fp = ::open( file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode );
|
||||
} else if ( dir == SG_IO_IN ) {
|
||||
#ifdef _MSC_VER
|
||||
fp = _open( file_name.c_str(), O_RDONLY );
|
||||
#else
|
||||
fp = std::open( file_name.c_str(), O_RDONLY );
|
||||
#endif
|
||||
fp = ::open( file_name.c_str(), O_RDONLY );
|
||||
} else {
|
||||
FG_LOG( FG_IO, FG_ALERT,
|
||||
"Error: bidirection mode not available for files." );
|
||||
@ -81,13 +75,7 @@ bool SGFile::open( SGProtocolDir dir ) {
|
||||
// read a block of data of specified size
|
||||
int SGFile::read( char *buf, int length ) {
|
||||
// read a chunk
|
||||
#ifdef _MSC_VER
|
||||
int result = _read( fp, buf, length );
|
||||
#else
|
||||
int result = std::read( fp, buf, length );
|
||||
#endif
|
||||
|
||||
return result;
|
||||
return ::read( fp, buf, length );
|
||||
}
|
||||
|
||||
|
||||
@ -97,11 +85,7 @@ int SGFile::readline( char *buf, int length ) {
|
||||
int pos = lseek( fp, 0, SEEK_CUR );
|
||||
|
||||
// read a chunk
|
||||
#ifdef _MSC_VER
|
||||
int result = _read( fp, buf, length );
|
||||
#else
|
||||
int result = std::read( fp, buf, length );
|
||||
#endif
|
||||
int result = ::read( fp, buf, length );
|
||||
|
||||
// find the end of line and reset position
|
||||
int i;
|
||||
@ -122,11 +106,7 @@ int SGFile::readline( char *buf, int length ) {
|
||||
|
||||
// write data to a file
|
||||
int SGFile::write( char *buf, int length ) {
|
||||
#ifdef _MSC_VER
|
||||
int result = _write( fp, buf, length );
|
||||
#else
|
||||
int result = std::write( fp, buf, length );
|
||||
#endif
|
||||
int result = ::write( fp, buf, length );
|
||||
if ( result != length ) {
|
||||
FG_LOG( FG_IO, FG_ALERT, "Error writing data: " << file_name );
|
||||
}
|
||||
@ -144,11 +124,7 @@ int SGFile::writestring( char *str ) {
|
||||
|
||||
// close the port
|
||||
bool SGFile::close() {
|
||||
#ifdef _MSC_VER
|
||||
if ( _close( fp ) == -1 ) {
|
||||
#else
|
||||
if ( std::close( fp ) == -1 ) {
|
||||
#endif
|
||||
if ( ::close( fp ) == -1 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user