Hi,

First, let me thank you all for the great work you've done with FG.

I started cross-compiling FG using the great fgfs-builder from Ralf and
I have to say that it helped a lot. However, I had to patch the source
code to make it possible. Here is the first one which basically replaces
SGMutex by OpenThreads::Mutex and allows to get rid of pthread.

The other patch is mainly not mixing winsock with winsock2 and changing
ifdefs. Sometimes there is _MSVC_VER, sometimes __MINGW32__ etc... for
the same thing. I didn't want to provide the patch now since I think
there is a better way. ffmpeg began to move all the platform-specific
code in 2 files called os_support.c and os_support.h. I think this way
help people focusing on what's important. Do you think it's a good
idea ? Do you have other ideas ?

Regards
Benoit
Index: configure.ac
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/configure.ac,v
retrieving revision 1.107
diff -u -p -r1.107 configure.ac
--- configure.ac	15 Mar 2008 16:33:49 -0000	1.107
+++ configure.ac	20 Apr 2008 17:01:26 -0000
@@ -171,22 +171,6 @@ esac
 
 dnl Checks for libraries.
 
-dnl Thread related checks
-AC_CHECK_HEADER(pthread.h)
-AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
-if test "x$ac_cv_header_pthread_h" = "xyes"; then
-    CXXFLAGS="$CXXFLAGS -D_REENTRANT"
-    CFLAGS="$CFLAGS -D_REENTRANT"
-
-  if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
-    CXXFLAGS="-pthread $CXXFLAGS"
-    CFLAGS="-pthread $CFLAGS"
-  fi
-fi
-
-AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
-
-thread_LIBS="$LIBS"
 LIBS=""
 
 dnl search for network related libraries
@@ -502,9 +486,3 @@ else
    echo "Without JPEG Factory support"
 fi
 
-if test "x$ac_cv_header_pthread_h" = "xyes"; then
-   echo "Threads: pthread lib found."
-else
-   echo "Threads: no threads (pthread lib not found.)"
-fi
-
Index: simgear/Makefile.am
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/Makefile.am,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile.am
--- simgear/Makefile.am	6 Jan 2007 17:01:58 -0000	1.18
+++ simgear/Makefile.am	20 Apr 2008 17:01:26 -0000
@@ -1,9 +1,3 @@
-if HAVE_THREADS
-SGTHREAD_DIR = threads
-else
-SGTHREAD_DIR = 
-endif
-
 # METAR_DIRS =
 METAR_DIRS = environment
 
@@ -31,7 +25,6 @@ SUBDIRS = \
 	screen \
 	serial \
 	sound \
-	$(SGTHREAD_DIR) \
 	timing
 
-DIST_SUBDIRS = $(SUBDIRS) compatibility
+DIST_SUBDIRS = $(SUBDIRS) compatibility threads
Index: simgear/scene/model/shadanim.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/model/shadanim.cxx,v
retrieving revision 1.13
diff -u -p -r1.13 shadanim.cxx
--- simgear/scene/model/shadanim.cxx	4 Dec 2007 22:38:41 -0000	1.13
+++ simgear/scene/model/shadanim.cxx	20 Apr 2008 17:01:26 -0000
@@ -37,7 +37,7 @@
 #include <osgUtil/HighlightMapGenerator>
 
 #include <simgear/scene/util/SGUpdateVisitor.hxx>
-#include <simgear/threads/SGThread.hxx>
+#include <OpenThreads/Mutex>
 #include <simgear/threads/SGGuard.hxx>
 
 #include <simgear/props/condition.hxx>
@@ -132,8 +132,8 @@ getOrCreateTextureCubeMap()
   if (textureCubeMap.get())
     return textureCubeMap.get();
 
-  static SGMutex mutex;
-  SGGuard<SGMutex> locker(mutex);
+  static OpenThreads::Mutex mutex;
+  SGGuard<OpenThreads::Mutex> locker(mutex);
   if (textureCubeMap.get())
     return textureCubeMap.get();
 
@@ -217,8 +217,8 @@ StateSetMap;
 // graph: 0 -> completely chrome, 1 -> completely model texture.
 static void create_chrome(osg::Group* group, osg::Texture2D* texture)
 {
-    static SGMutex mutex;
-    SGGuard<SGMutex> locker(mutex);
+    static OpenThreads::Mutex mutex;
+    SGGuard<OpenThreads::Mutex> locker(mutex);
     static StateSetMap chromeMap;
     osg::StateSet *stateSet;
     StateSetMap::iterator iterator = chromeMap.find(texture);
Index: simgear/scene/tgdb/obj.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/tgdb/obj.cxx,v
retrieving revision 1.33
diff -u -p -r1.33 obj.cxx
--- simgear/scene/tgdb/obj.cxx	24 Mar 2008 21:41:30 -0000	1.33
+++ simgear/scene/tgdb/obj.cxx	20 Apr 2008 17:01:26 -0000
@@ -50,8 +50,6 @@
 #include <simgear/scene/util/SGUpdateVisitor.hxx>
 #include <simgear/scene/util/SGNodeMasks.hxx>
 #include <simgear/scene/util/QuadTreeBuilder.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
 
 #include "SGTexturedTriangleBin.hxx"
 #include "SGLightBin.hxx"
Index: simgear/scene/tgdb/pt_lights.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/tgdb/pt_lights.cxx,v
retrieving revision 1.14
diff -u -p -r1.14 pt_lights.cxx
--- simgear/scene/tgdb/pt_lights.cxx	21 Dec 2007 06:24:53 -0000	1.14
+++ simgear/scene/tgdb/pt_lights.cxx	20 Apr 2008 17:01:26 -0000
@@ -52,7 +52,7 @@
 
 #include <simgear/math/sg_random.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/threads/SGThread.hxx>
+#include <OpenThreads/Mutex>
 #include <simgear/threads/SGGuard.hxx>
 #include <simgear/scene/util/RenderConstants.hxx>
 #include <simgear/scene/util/SGEnlargeBoundingBox.hxx>
@@ -131,8 +131,8 @@ gen_standard_light_sprite(void)
   if (texture.valid())
     return texture.get();
   
-  static SGMutex mutex;
-  SGGuard<SGMutex> guard(mutex);
+  static OpenThreads::Mutex mutex;
+  SGGuard<OpenThreads::Mutex> guard(mutex);
   if (texture.valid())
     return texture.get();
   
Index: simgear/scene/util/SGSceneFeatures.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/util/SGSceneFeatures.cxx,v
retrieving revision 1.3
diff -u -p -r1.3 SGSceneFeatures.cxx
--- simgear/scene/util/SGSceneFeatures.cxx	8 Jun 2007 06:50:16 -0000	1.3
+++ simgear/scene/util/SGSceneFeatures.cxx	20 Apr 2008 17:01:26 -0000
@@ -32,7 +32,7 @@
 #include <osg/Texture>
 
 #include <simgear/structure/SGSharedPtr.hxx>
-#include <simgear/threads/SGThread.hxx>
+#include <OpenThreads/Mutex>
 #include <simgear/threads/SGGuard.hxx>
 
 SGSceneFeatures::SGSceneFeatures() :
@@ -50,8 +50,8 @@ SGSceneFeatures::instance()
   static SGSharedPtr<SGSceneFeatures> sceneFeatures;
   if (sceneFeatures)
     return sceneFeatures;
-  static SGMutex mutex;
-  SGGuard<SGMutex> guard(mutex);
+  static OpenThreads::Mutex mutex;
+  SGGuard<OpenThreads::Mutex> guard(mutex);
   if (sceneFeatures)
     return sceneFeatures;
   sceneFeatures = new SGSceneFeatures;
Index: simgear/structure/commands.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/structure/commands.cxx,v
retrieving revision 1.2
diff -u -p -r1.2 commands.cxx
--- simgear/structure/commands.cxx	4 Jan 2007 12:47:12 -0000	1.2
+++ simgear/structure/commands.cxx	20 Apr 2008 17:01:26 -0000
@@ -6,7 +6,7 @@
 
 #include <memory>
 #include <simgear/props/props_io.hxx>
-#include <simgear/threads/SGThread.hxx>
+#include <OpenThreads/Mutex>
 #include <simgear/threads/SGGuard.hxx>
 
 #include "commands.hxx"
@@ -35,8 +35,8 @@ SGCommandMgr::instance()
   if (mgr.get())
     return mgr.get();
 
-  static SGMutex lock;
-  SGGuard<SGMutex> guard(lock);
+  static OpenThreads::Mutex lock;
+  SGGuard<OpenThreads::Mutex> guard(lock);
   if (mgr.get())
     return mgr.get();
 
Index: simgear/threads/Makefile.am
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/threads/Makefile.am,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile.am
--- simgear/threads/Makefile.am	7 Sep 2002 02:58:20 -0000	1.1.1.1
+++ simgear/threads/Makefile.am	20 Apr 2008 17:01:26 -0000
@@ -1,13 +1,5 @@
 includedir = @includedir@/threads
 
-lib_LIBRARIES = libsgthreads.a
-
-include_HEADERS = \
-	SGGuard.hxx \
-	SGQueue.hxx \
-	SGThread.hxx
-
-libsgthreads_a_SOURCES = \
-	SGThread.cxx
+include_HEADERS = SGGuard.hxx
 
 INCLUDES = -I$(top_srcdir)
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to