Various changes for MingWin32 support.
This commit is contained in:
+3
-2
@@ -77,9 +77,10 @@ if test -d /opt/X11R6 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$ac_cv_header_windows_h" = "xyes" ; then
|
if test "x$ac_cv_header_windows_h" = "xyes" ; then
|
||||||
|
if test -d /usr/mingw/usr ; then
|
||||||
|
EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
|
||||||
|
fi
|
||||||
EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
|
EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
|
||||||
# elif test `uname -s` = "SunOS" ; then
|
|
||||||
# EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
|
|
||||||
fi
|
fi
|
||||||
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined( __MINGW32__ )
|
||||||
|
# define bcopy(from, to, n) memcpy(to, from, n)
|
||||||
|
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* KAI C++ */
|
/* KAI C++ */
|
||||||
#if defined(__KCC)
|
#if defined(__KCC)
|
||||||
|
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
|||||||
|
|
||||||
string dir = base + "/" + b.gen_base_path();
|
string dir = base + "/" + b.gen_base_path();
|
||||||
string command = "mkdir -p " + dir;
|
string command = "mkdir -p " + dir;
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
system( (string("mkdir ") + dir).c_str() );
|
system( (string("mkdir ") + dir).c_str() );
|
||||||
#else
|
#else
|
||||||
system(command.c_str());
|
system(command.c_str());
|
||||||
@@ -828,7 +828,7 @@ bool SGBinObject::write_ascii( const string& base, const string& name,
|
|||||||
|
|
||||||
string dir = base + "/" + b.gen_base_path();
|
string dir = base + "/" + b.gen_base_path();
|
||||||
string command = "mkdir -p " + dir;
|
string command = "mkdir -p " + dir;
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
system( (string("mkdir ") + dir).c_str() );
|
system( (string("mkdir ") + dir).c_str() );
|
||||||
#else
|
#else
|
||||||
system(command.c_str());
|
system(command.c_str());
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include STL_STRING
|
#include STL_STRING
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ bool SGFile::open( const SGProtocolDir d ) {
|
|||||||
set_dir( d );
|
set_dir( d );
|
||||||
|
|
||||||
if ( get_dir() == SG_IO_OUT ) {
|
if ( get_dir() == SG_IO_OUT ) {
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
int mode = 00666;
|
int mode = 00666;
|
||||||
#else
|
#else
|
||||||
mode_t mode = 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;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||||
# include <sys/time.h> // select()
|
# include <sys/time.h> // select()
|
||||||
# include <sys/types.h> // socket(), bind(), select(), accept()
|
# include <sys/types.h> // socket(), bind(), select(), accept()
|
||||||
# include <sys/socket.h> // socket(), bind(), listen(), accept()
|
# include <sys/socket.h> // socket(), bind(), listen(), accept()
|
||||||
@@ -48,7 +48,7 @@ SGSocket::SGSocket( const string& host, const string& port,
|
|||||||
port_str(port),
|
port_str(port),
|
||||||
save_len(0)
|
save_len(0)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
if (!wsock_init && !wsastartup()) {
|
if (!wsock_init && !wsastartup()) {
|
||||||
SG_LOG( SG_IO, SG_ALERT, "Winsock not available");
|
SG_LOG( SG_IO, SG_ALERT, "Winsock not available");
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ SGSocket::~SGSocket() {
|
|||||||
SGSocket::SocketType SGSocket::make_server_socket () {
|
SGSocket::SocketType SGSocket::make_server_socket () {
|
||||||
struct sockaddr_in name;
|
struct sockaddr_in name;
|
||||||
|
|
||||||
#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) || defined( sgi ) || defined( _MSC_VER )
|
#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) || defined( sgi ) || defined( _MSC_VER ) || defined(__MINGW32__)
|
||||||
int length;
|
int length;
|
||||||
#else
|
#else
|
||||||
socklen_t length;
|
socklen_t length;
|
||||||
@@ -161,7 +161,7 @@ SGSocket::SocketType SGSocket::make_client_socket () {
|
|||||||
|
|
||||||
// Wrapper functions
|
// Wrapper functions
|
||||||
size_t SGSocket::readsocket( int fd, void *buf, size_t count ) {
|
size_t SGSocket::readsocket( int fd, void *buf, size_t count ) {
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
return ::recv( fd, (char *)buf, count, 0 );
|
return ::recv( fd, (char *)buf, count, 0 );
|
||||||
#else
|
#else
|
||||||
return ::read( fd, buf, count );
|
return ::read( fd, buf, count );
|
||||||
@@ -169,14 +169,14 @@ size_t SGSocket::readsocket( int fd, void *buf, size_t count ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t SGSocket::writesocket( int fd, const void *buf, size_t count ) {
|
size_t SGSocket::writesocket( int fd, const void *buf, size_t count ) {
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
return ::send( fd, (const char*)buf, count, 0 );
|
return ::send( fd, (const char*)buf, count, 0 );
|
||||||
#else
|
#else
|
||||||
return ::write( fd, buf, count );
|
return ::write( fd, buf, count );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||||
int SGSocket::closesocket( int fd ) {
|
int SGSocket::closesocket( int fd ) {
|
||||||
return ::close( fd );
|
return ::close( fd );
|
||||||
}
|
}
|
||||||
@@ -504,7 +504,7 @@ bool SGSocket::nonblock() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
u_long arg = 1;
|
u_long arg = 1;
|
||||||
if (ioctlsocket( sock, FIONBIO, &arg ) != 0) {
|
if (ioctlsocket( sock, FIONBIO, &arg ) != 0) {
|
||||||
int error_code = WSAGetLastError();
|
int error_code = WSAGetLastError();
|
||||||
@@ -519,7 +519,7 @@ bool SGSocket::nonblock() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
|
|
||||||
bool SGSocket::wsock_init = false;
|
bool SGSocket::wsock_init = false;
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
|
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
# include <winsock.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SG_MAX_SOCKET_QUEUE 32
|
#define SG_MAX_SOCKET_QUEUE 32
|
||||||
@@ -53,7 +53,7 @@ SG_USING_STD(string);
|
|||||||
*/
|
*/
|
||||||
class SGSocket : public SGIOChannel {
|
class SGSocket : public SGIOChannel {
|
||||||
public:
|
public:
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
typedef SOCKET SocketType;
|
typedef SOCKET SocketType;
|
||||||
#else
|
#else
|
||||||
typedef int SocketType;
|
typedef int SocketType;
|
||||||
@@ -83,11 +83,11 @@ private:
|
|||||||
// wrapper functions
|
// wrapper functions
|
||||||
size_t readsocket( int fd, void *buf, size_t count );
|
size_t readsocket( int fd, void *buf, size_t count );
|
||||||
size_t writesocket( int fd, const void *buf, size_t count );
|
size_t writesocket( int fd, const void *buf, size_t count );
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||||
int closesocket(int fd);
|
int closesocket(int fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
// Ensure winsock has been initialised.
|
// Ensure winsock has been initialised.
|
||||||
static bool wsock_init;
|
static bool wsock_init;
|
||||||
static bool wsastartup();
|
static bool wsastartup();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ static double sidereal_course( time_t cur_time, struct tm *gmt, double lng )
|
|||||||
void SGTime::update( double lon, double lat, long int warp ) {
|
void SGTime::update( double lon, double lat, long int warp ) {
|
||||||
double gst_precise, gst_course;
|
double gst_precise, gst_course;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
tm * gmt = &m_gmt;
|
tm * gmt = &m_gmt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ void SGTime::update( double lon, double lat, long int warp ) {
|
|||||||
<< " warp = " << warp );
|
<< " warp = " << warp );
|
||||||
|
|
||||||
// get GMT break down for current time
|
// get GMT break down for current time
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
|
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
|
||||||
#else
|
#else
|
||||||
gmt = gmtime(&cur_time);
|
gmt = gmtime(&cur_time);
|
||||||
@@ -333,13 +333,14 @@ double sgTimeCalcMJD(int mn, double dy, int yr) {
|
|||||||
// return the current modified Julian date (number of days elapsed
|
// return the current modified Julian date (number of days elapsed
|
||||||
// since 1900 jan 0.5), mjd.
|
// since 1900 jan 0.5), mjd.
|
||||||
double sgTimeCurrentMJD( long int warp ) {
|
double sgTimeCurrentMJD( long int warp ) {
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
struct tm m_gmt; // copy of system gmtime(&time_t) structure
|
struct tm m_gmt; // copy of system gmtime(&time_t) structure
|
||||||
#else
|
#else
|
||||||
struct tm *gmt;
|
struct tm *gmt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
tm * gmt = &m_gmt;
|
tm * gmt = &m_gmt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -351,7 +352,7 @@ double sgTimeCurrentMJD( long int warp ) {
|
|||||||
<< " warp = " << warp );
|
<< " warp = " << warp );
|
||||||
|
|
||||||
// get GMT break down for current time
|
// get GMT break down for current time
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
|
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
|
||||||
#else
|
#else
|
||||||
gmt = gmtime(&cur_time);
|
gmt = gmtime(&cur_time);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
time_t cur_time;
|
time_t cur_time;
|
||||||
|
|
||||||
// Break down of equivalent GMT time
|
// Break down of equivalent GMT time
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
struct tm m_gmt; // copy of system gmtime(&time_t) structure
|
struct tm m_gmt; // copy of system gmtime(&time_t) structure
|
||||||
#else
|
#else
|
||||||
struct tm *gmt;
|
struct tm *gmt;
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
inline char* get_zonename() const { return zonename; }
|
inline char* get_zonename() const { return zonename; }
|
||||||
|
|
||||||
/** @return GMT in a "brokent down" tm structure */
|
/** @return GMT in a "brokent down" tm structure */
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
inline struct tm* getGmt()const { return (struct tm *)&m_gmt; };
|
inline struct tm* getGmt()const { return (struct tm *)&m_gmt; };
|
||||||
#else
|
#else
|
||||||
inline struct tm* getGmt()const { return gmt; };
|
inline struct tm* getGmt()const { return gmt; };
|
||||||
|
|||||||
Reference in New Issue
Block a user