]> git.mxchange.org Git - simgear.git/commitdiff
Fixes to allow MingW compilation.
authorcurt <curt>
Fri, 6 Sep 2002 20:05:40 +0000 (20:05 +0000)
committercurt <curt>
Fri, 6 Sep 2002 20:05:40 +0000 (20:05 +0000)
simgear/io/Makefile.am
simgear/io/tcp_client.cxx
simgear/serial/Makefile.am
simgear/threads/SGThread.cxx

index c78df9565d495ee28f38a24d214b7333096beed4..9cf9c3a251c2b27b5bc80e1766b1b2069ad6bcac 100644 (file)
@@ -38,7 +38,7 @@ tcp_server_LDADD = \
        $(top_builddir)/simgear/bucket/libsgbucket.a \
        $(top_builddir)/simgear/misc/libsgmisc.a \
        $(top_builddir)/simgear/xml/libsgxml.a \
-       -lplibnet -lz
+       -lplibnet -lplibul -lz $(NETWORK_LIB)
 
 tcp_client_SOURCES = tcp_client.cxx
 
@@ -48,7 +48,7 @@ tcp_client_LDADD = \
        $(top_builddir)/simgear/bucket/libsgbucket.a \
        $(top_builddir)/simgear/misc/libsgmisc.a \
         $(top_builddir)/simgear/xml/libsgxml.a \
-       -lplibnet -lz
+       -lplibnet -lplibul -lz $(NETWORK_LIB)
 
 socktest_SOURCES = socktest.cxx
 
@@ -58,7 +58,7 @@ socktest_LDADD = \
        $(top_builddir)/simgear/debug/libsgdebug.a \
        $(top_builddir)/simgear/misc/libsgmisc.a \
        $(top_builddir)/simgear/xml/libsgxml.a \
-       -lplibnet -lz
+       -lplibnet -lplibul -lz $(NETWORK_LIB)
 
 lowtest_SOURCES = lowtest.cxx
 
@@ -73,4 +73,4 @@ decode_binobj_LDADD = \
         $(top_builddir)/simgear/misc/libsgmisc.a \
         $(top_builddir)/simgear/debug/libsgdebug.a \
        $(top_builddir)/simgear/xml/libsgxml.a \
-       $(NETWORK_LIB) -lz
+       -lz
index 78548f53276d554f61a316598ca781bb4fcb623e..a02e25d3b2bca5636ad73123bb99a6055abd9106 100644 (file)
@@ -1,6 +1,11 @@
 #include <simgear/compiler.h>
 #include STL_IOSTREAM
+
+#ifdef _WIN32
+#include <windows.h>
+#else
 #include <unistd.h>
+#endif
 
 #include <simgear/debug/logstream.hxx>
 
@@ -72,7 +77,11 @@ main()
     for (int i = 0; i < 3; ++i)
     {
        client.process();
+#ifdef _WIN32
+        Sleep(1000);
+#else
        sleep(1);
+#endif
     }
 
     //client.close();
index f39951cea028853944f1df704e7e2c37fcbe8e75..17af84e2caa3ff35524d49874ea03f82d59a277d 100644 (file)
@@ -1,13 +1,13 @@
 includedir = @includedir@/serial
 
-noinst_PROGRAMS = testserial
-
 lib_LIBRARIES = libsgserial.a
 
 include_HEADERS = serial.hxx
 
 libsgserial_a_SOURCES = serial.cxx
 
+noinst_PROGRAMS = testserial
+
 testserial_SOURCES = testserial.cxx
 
 testserial_LDADD = \
index 4119d7b4ab335c53d4dfa957785313c4a5db217c..6c5fe682fb6a281e7b54564951389be48e05819e 100644 (file)
@@ -49,6 +49,31 @@ SGMutex::trylock()
     return true;
 }
 
+#if defined(_MSC_VER) || defined(__MINGW32__)
+int gettimeofday(struct timeval* tp, void* tzp) {
+    LARGE_INTEGER t;
+
+    if(QueryPerformanceCounter(&t)) {
+        /* hardware supports a performance counter */
+        LARGE_INTEGER f;
+        QueryPerformanceFrequency(&f);
+        tp->tv_sec = t.QuadPart/f.QuadPart;
+        tp->tv_usec = ((float)t.QuadPart/f.QuadPart*1000*1000)
+            - (tp->tv_sec*1000*1000);
+    } else {
+        /* hardware doesn't support a performance counter, so get the
+           time in a more traditional way. */
+        DWORD t;
+        t = timeGetTime();
+        tp->tv_sec = t / 1000;
+        tp->tv_usec = t % 1000;
+    }
+
+    /* 0 indicates that the call succeeded. */
+    return 0;
+}
+#endif
+
 bool
 SGCondition::wait( SGMutex& mutex, unsigned long ms )
 {