fi
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"
-# elif test `uname -s` = "SunOS" ; then
-# EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
fi
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
# 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++ */
#if defined(__KCC)
string dir = base + "/" + b.gen_base_path();
string command = "mkdir -p " + dir;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
system( (string("mkdir ") + dir).c_str() );
#else
system(command.c_str());
string dir = base + "/" + b.gen_base_path();
string command = "mkdir -p " + dir;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
system( (string("mkdir ") + dir).c_str() );
#else
system(command.c_str());
#include STL_STRING
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <io.h>
#endif
set_dir( d );
if ( get_dir() == SG_IO_OUT ) {
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
int mode = 00666;
#else
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
#include <simgear/compiler.h>
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
# include <sys/time.h> // select()
# include <sys/types.h> // socket(), bind(), select(), accept()
# include <sys/socket.h> // socket(), bind(), listen(), accept()
port_str(port),
save_len(0)
{
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
if (!wsock_init && !wsastartup()) {
SG_LOG( SG_IO, SG_ALERT, "Winsock not available");
}
SGSocket::SocketType SGSocket::make_server_socket () {
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;
#else
socklen_t length;
// Wrapper functions
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 );
#else
return ::read( fd, buf, 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 );
#else
return ::write( fd, buf, count );
#endif
}
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
int SGSocket::closesocket( int fd ) {
return ::close( fd );
}
return 0;
}
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
u_long arg = 1;
if (ioctlsocket( sock, FIONBIO, &arg ) != 0) {
int error_code = WSAGetLastError();
return true;
}
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
bool SGSocket::wsock_init = false;
SG_USING_STD(string);
-#if defined(_MSC_VER)
-# include <winsock.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+# include <winsock2.h>
#endif
#define SG_MAX_SOCKET_QUEUE 32
*/
class SGSocket : public SGIOChannel {
public:
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
typedef SOCKET SocketType;
#else
typedef int SocketType;
// wrapper functions
size_t readsocket( int fd, 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);
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
// Ensure winsock has been initialised.
static bool wsock_init;
static bool wsastartup();
#include <simgear/compiler.h>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <time.h>
#else
# include <sys/time.h>
void SGTime::update( double lon, double lat, long int warp ) {
double gst_precise, gst_course;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
tm * gmt = &m_gmt;
#endif
<< " warp = " << warp );
// get GMT break down for current time
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
#else
gmt = gmtime(&cur_time);
// return the current modified Julian date (number of days elapsed
// since 1900 jan 0.5), mjd.
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
#else
struct tm *gmt;
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
tm * gmt = &m_gmt;
#endif
<< " warp = " << warp );
// get GMT break down for current time
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
memcpy( gmt, gmtime(&cur_time), sizeof(tm) );
#else
gmt = gmtime(&cur_time);
time_t cur_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
#else
struct tm *gmt;
inline char* get_zonename() const { return zonename; }
/** @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; };
#else
inline struct tm* getGmt()const { return gmt; };