Index: /branches/osx/config.h.in
===================================================================
--- /branches/osx/config.h.in	(revision 8121)
+++ /branches/osx/config.h.in	(revision 8122)
@@ -36,4 +36,7 @@
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
+
+/* Define to 1 if you have the `OpenGL' library (-lOpenGL). */
+#undef HAVE_LIBOPENGL
 
 /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
Index: /branches/osx/configure.ac
===================================================================
--- /branches/osx/configure.ac	(revision 8121)
+++ /branches/osx/configure.ac	(revision 8122)
@@ -434,6 +434,6 @@
  osX="yes"
  QT_PREFIX="$prefix"
- CPPFLAGS="-I/$prefix/include $CPPFLAGS -F$prefix/lib"
- LDFLAGS="$LDFLAGS -L$prefix/lib -F$prefix/lib"
+ CPPFLAGS="-I/$prefix/include $CPPFLAGS -F$prefix/lib -I/opt/local"
+ LDFLAGS="$LDFLAGS -L$prefix/lib -F$prefix/lib -L/opt/local"
  PCK_CONFIG_PATH='/opt/local'
 # checking gl header
@@ -443,5 +443,5 @@
     AC_CHECK_HEADERS([OpenGL/glu.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
-
+	AC_CHECK_LIB( OpenGL, main, , )
    LIBS="$LIBS -framework OpenGL"
 
@@ -565,5 +565,5 @@
 # QT #
 #----#
-if test `uname` = "Darwin" ; then
+if test x$osX = xyes ; then
 	PKG_CONFIG_PATH="$prefix"
 	PKG_CHECK_MODULES( QT, QtOpenGL >= 4.01 QtCore >= 4.01 QtGui >= 4.0.1 )
Index: /branches/osx/src/lib/graphics/importer/md2Model.cc
===================================================================
--- /branches/osx/src/lib/graphics/importer/md2Model.cc	(revision 8121)
+++ /branches/osx/src/lib/graphics/importer/md2Model.cc	(revision 8122)
@@ -14,5 +14,12 @@
 
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
-
+#include "config.h"
+#ifdef HAVE_SDL_SDL_H
+#include <SDL/SDL.h>
+#include <SDL/SDL_endian.h>
+#else
+#include <SDL.h>
+#include <SDL_endian.h>
+#endif
 #include "md2Model.h"
 #include "material.h"
@@ -20,5 +27,4 @@
 #include "debug.h"
 #include "util/loading/resource_manager.h"
-
 
 using namespace std;
@@ -67,4 +73,14 @@
 
 
+#ifdef SDL_LIL_ENDIAN
+#define BULK_CONV( _ptr, _num ) do { \
+	int  _cnt = _num;\
+	int* _iptr = (int*)_ptr;\
+	for( int _l = 0; _l<_cnt; ++_l )\
+		_iptr[_l] = SDL_SwapLE32( _iptr[_l] );\
+} while( 0 )
+#else
+#define BULK_CONV( _ptr, _num )
+#endif	
 
 /********************************************************************************
@@ -80,5 +96,8 @@
   /* this creates the data container via ressource manager */
   if (!modelFileName.empty())
-    this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale);
+    this->data = (MD2Data*)ResourceManager::getInstance()->load( 
+			modelFileName, MD2, RP_GAME, skinFileName, scale);
+			
+	//When arriving here it is assumed that everything is in the correct byte order.	
   if( unlikely(this->data == NULL))
     PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
@@ -99,8 +118,11 @@
   this->pModelInfo.numNormals = 0;
   this->pModelInfo.numTexCoor = this->data->numTexCoor;
+	
   this->pModelInfo.pVertices = (float*)this->data->pVertices;
+		
   this->pModelInfo.pNormals = NULL;
+
   this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor;
-
+	
   // triangle conversion
   this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
@@ -357,13 +379,13 @@
 void MD2Model::debug()
 {
-  PRINT(0)("\n==========================| MD2Model::debug() |===\n");
-  PRINT(0)("=  Model FileName:\t%s\n", this->data->fileName.c_str());
-  PRINT(0)("=  Skin FileName:\t%s\n", this->data->skinFileName.c_str());
-  PRINT(0)("=  Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size
-  PRINT(0)("=  Number of Vertices:\t%i\n", this->data->header->numVertices);
-  PRINT(0)("=  Number of Frames: \t%i\n", this->data->header->numFrames);
-  PRINT(0)("=  Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);
-  PRINT(0)("=  Pointer to the data object: %p\n", this->data);
-  PRINT(0)("===================================================\n\n");
+  //PRINTF(0)("\n==========================| MD2Model::debug() |===\n");
+  PRINTF(0)("=  Model FileName:\t%s\n", this->data->fileName.c_str());
+  PRINTF(0)("=  Skin FileName:\t%s\n", this->data->skinFileName.c_str());
+  PRINTF(0)("=  Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size
+  PRINTF(0)("=  Number of Vertices:\t%i\n", this->data->header->numVertices);
+  PRINTF(0)("=  Number of Frames: \t%i\n", this->data->header->numFrames);
+  PRINTF(0)("=  Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);
+  PRINTF(0)("=  Pointer to the data object: %p\n", this->data);
+  //PRINTF(0)("===================================================\n\n");
 }
 
@@ -442,6 +464,7 @@
   this->header = new MD2Header;
   fread(this->header, 1, sizeof(MD2Header), pFile);
+	BULK_CONV( this->header, sizeof(MD2Header)/4 );
   /* check for the header version: make sure its a md2 file :) */
-  if( unlikely(this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))
+  if( unlikely( this->header->version != MD2_VERSION) && unlikely( this->header->ident != MD2_IDENT))
     {
       PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
@@ -449,5 +472,5 @@
     }
 
-  this->fileName =fileName;
+  this->fileName = fileName;
   /* got the data: map it to locals */
   this->numFrames = this->header->numFrames;
@@ -468,14 +491,19 @@
   fseek(pFile, this->header->offsetFrames, SEEK_SET);
   fread(buffer, this->header->frameSize, this->numFrames, pFile);
+	BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );
   /* read opengl commands */
   fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
+
   fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
+	BULK_CONV( this->pGLCommands, this->numGLCommands );
   /* triangle list */
   fseek(pFile, this->header->offsetTriangles, SEEK_SET);
-  fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);
+  fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);	
+	BULK_CONV( this->pTriangles, this->numTriangles*(sizeof(sTriangle)/4) );
+
   /*  read in texture coordinates */
   fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
   fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile);
-
+	BULK_CONV( this->pTexCoor, this->numTexCoor*(sizeof(sTexCoor)/4) );
 
   for(int i = 0; i < this->numFrames; ++i)
Index: /branches/osx/src/lib/graphics/importer/texture.cc
===================================================================
--- /branches/osx/src/lib/graphics/importer/texture.cc	(revision 8121)
+++ /branches/osx/src/lib/graphics/importer/texture.cc	(revision 8122)
@@ -207,15 +207,15 @@
                                     surface->w, surface->h,
                                     pixelDepth,
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
+//#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
                                     0x000000FF,
                                     0x0000FF00,
                                     0x00FF0000,
                                     0xFF000000
-#else
-                                    0xFF000000,
+/*#else*/
+                                    /*0xFF000000,
                                     0x00FF0000,
                                     0x0000FF00,
-                                    0x000000FF
-#endif
+                                    0x000000FF*/
+/*#endif*/
                                    );
   if ( retSurface == NULL )
Index: /branches/osx/src/lib/graphics/spatial_separation/quadtree.cc
===================================================================
--- /branches/osx/src/lib/graphics/spatial_separation/quadtree.cc	(revision 8121)
+++ /branches/osx/src/lib/graphics/spatial_separation/quadtree.cc	(revision 8122)
@@ -25,5 +25,4 @@
 
 using namespace std;
-
 #define QUADTREE_MATERIAL_COUNT       4
 
Index: /branches/osx/src/lib/shell/shell_buffer.cc
===================================================================
--- /branches/osx/src/lib/shell/shell_buffer.cc	(revision 8121)
+++ /branches/osx/src/lib/shell/shell_buffer.cc	(revision 8122)
@@ -66,6 +66,6 @@
     va_list arguments;
     va_start(arguments, line);
-
-    static OrxThread::Mutex ShellBuffer__bufferMutex;
+   
+ 		static OrxThread::Mutex ShellBuffer__bufferMutex;
 
     OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex);
Index: /branches/osx/src/lib/sound/ogg_player.cc
===================================================================
--- /branches/osx/src/lib/sound/ogg_player.cc	(revision 8121)
+++ /branches/osx/src/lib/sound/ogg_player.cc	(revision 8122)
@@ -31,4 +31,16 @@
 
 #include "debug.h"
+
+#ifdef HAVE_SDL_SDL_H
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_endian.h>
+
+#else
+
+#include <SDL.h>
+#include <SDL_endian.h>
+
+#endif
 
 namespace OrxSound
@@ -151,5 +163,5 @@
   bool OggPlayer::play()
   {
-    if (!(this->state & OggPlayer::FileOpened))
+    /*if (!(this->state & OggPlayer::FileOpened))
       return false;
 
@@ -161,5 +173,5 @@
     if (this->musicThreadID == NULL)
       return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL);
-    return true;
+    return true;*/
   }
 
@@ -374,5 +386,10 @@
     if(size == 0)
       return false;
-
+/*#ifdef SDL_BIG_ENDIAN
+			int cnt = wavLength/2;
+			Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
+			for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
+				*wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
+#endif*/
     alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
     if (DEBUG_LEVEL >= 3)
Index: /branches/osx/src/lib/sound/sound_buffer.cc
===================================================================
--- /branches/osx/src/lib/sound/sound_buffer.cc	(revision 8121)
+++ /branches/osx/src/lib/sound/sound_buffer.cc	(revision 8122)
@@ -22,5 +22,11 @@
 #include "sdlincl.h"
 #include <cassert>
-
+#ifdef HAVE_SDL_SDL_H
+#include <SDL/SDL.h>
+#include <SDL/SDL_endian.h>
+#else
+#include <SDL.h>
+#include <SDL_endian.h>
+#endif
 namespace OrxSound
 {
@@ -67,6 +73,15 @@
       return false;
     }
-
-    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), wavBuffer, wavLength, wavSpec.freq);
+#ifdef SDL_BIG_ENDIAN
+		if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) ) {
+			int cnt = wavLength/2;
+			Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
+			for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
+				*wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
+		}
+#endif
+    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), 
+			wavBuffer, wavLength, wavSpec.freq);
+			
     SDL_FreeWAV(wavBuffer);
     if (SoundEngine::checkError("Could not load Wave file", __LINE__))
Index: /branches/osx/src/lib/sound/sound_source.cc
===================================================================
--- /branches/osx/src/lib/sound/sound_source.cc	(revision 8121)
+++ /branches/osx/src/lib/sound/sound_source.cc	(revision 8122)
@@ -153,4 +153,5 @@
     if (DEBUG_LEVEL >= 3)
       SoundEngine::checkError("Play Source", __LINE__);
+		
   }
 
Index: /branches/osx/src/util/signal_handler.cc
===================================================================
--- /branches/osx/src/util/signal_handler.cc	(revision 8121)
+++ /branches/osx/src/util/signal_handler.cc	(revision 8122)
@@ -46,5 +46,5 @@
 void SignalHandler::catchSignal( int sig )
 {
-  sighandler_t handler = signal( sig, SignalHandler::sigHandler );
+  sig_t handler = signal( sig, SignalHandler::sigHandler );
 
   assert( handler != SIG_ERR );
@@ -59,6 +59,7 @@
 void SignalHandler::sigHandler( int sig )
 {
+
   std::string sigName = "UNKNOWN";
-
+  
   switch ( sig )
   {
@@ -83,8 +84,6 @@
   if ( pid == 0 )
   {
-    getInstance()->dontCatch();
-
+	getInstance()->dontCatch();	
     sleep(2);
-
 
     return;
Index: /branches/osx/src/util/signal_handler.h
===================================================================
--- /branches/osx/src/util/signal_handler.h	(revision 8121)
+++ /branches/osx/src/util/signal_handler.h	(revision 8122)
@@ -11,5 +11,5 @@
 
 
-
+#define GDB_BT_FILE "orxonox.backtrace"
 enum GdbRunType{
   GDB_RUN_WRITE_TO_FILE = 1,
@@ -24,5 +24,5 @@
 {
   int signal;
-  sighandler_t handler;
+  sig_t handler;
 };
 
