From 14ccd80344965eb9d534d8acd6374cb38162f0b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A1n=20Arroyo=20Calle?=
 <adrian.arroyocalle@gmail.com>
Date: Sun, 3 Jan 2016 18:43:27 +0000
Subject: Fix build under Haiku


diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h
index 0c9b51c..dee6d31 100644
--- a/include/IrrCompileConfig.h
+++ b/include/IrrCompileConfig.h
@@ -45,10 +45,7 @@
 
 
 //! Uncomment this line to compile with the SDL device
-//#define _IRR_COMPILE_WITH_SDL_DEVICE_
-#ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_
-#undef _IRR_COMPILE_WITH_SDL_DEVICE_
-#endif
+#define _IRR_COMPILE_WITH_SDL_DEVICE_
 
 //! Comment this line to compile without the fallback console device.
 #define _IRR_COMPILE_WITH_CONSOLE_DEVICE_
@@ -97,15 +94,6 @@
 #define _IRR_COMPILE_WITH_OSX_DEVICE_
 #endif
 
-#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
-#ifndef _IRR_SOLARIS_PLATFORM_
-#define _IRR_LINUX_PLATFORM_
-#endif
-#define _IRR_POSIX_API_
-#define _IRR_COMPILE_WITH_X11_DEVICE_
-#endif
-
-
 //! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events.
 #define _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
 #ifdef NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_
@@ -185,10 +173,9 @@ comment this define out */
 /** If you do not wish the engine to be compiled with X11, comment this
 define out. */
 // Only used in LinuxDevice.
-#define _IRR_COMPILE_WITH_X11_
-#ifdef NO_IRR_COMPILE_WITH_X11_
+// #define _IRR_COMPILE_WITH_X11_
 #undef _IRR_COMPILE_WITH_X11_
-#endif
+#undef _IRR_COMPILE_WITH_X11_DEVICE_
 
 //! Define _IRR_OPENGL_USE_EXTPOINTER_ if the OpenGL renderer should use OpenGL extensions via function pointers.
 /** On some systems there is no support for the dynamic extension of OpenGL
@@ -249,7 +236,7 @@ the engine will no longer read .jpeg images. */
 //! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
 /** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
 	This is only used when _IRR_COMPILE_WITH_LIBJPEG_ is defined. */
-#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
+//#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
 #ifdef NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
 #undef _IRR_USE_NON_SYSTEM_JPEG_LIB_
 #endif
@@ -265,7 +252,7 @@ the engine will no longer read .png images. */
 //! Define _IRR_USE_NON_SYSTEM_LIBPNG_ to let irrlicht use the libpng which comes with irrlicht.
 /** If this is commented out, Irrlicht will try to compile using the libpng installed in the system.
 	This is only used when _IRR_COMPILE_WITH_LIBPNG_ is defined. */
-#define _IRR_USE_NON_SYSTEM_LIB_PNG_
+//#define _IRR_USE_NON_SYSTEM_LIB_PNG_
 #ifdef NO_IRR_USE_NON_SYSTEM_LIB_PNG_
 #undef _IRR_USE_NON_SYSTEM_LIB_PNG_
 #endif
@@ -602,7 +589,7 @@ ones. */
 /** If this is commented out, Irrlicht will try to compile using the zlib
 installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
 defined. */
-#define _IRR_USE_NON_SYSTEM_ZLIB_
+//#define _IRR_USE_NON_SYSTEM_ZLIB_
 #ifdef NO_IRR_USE_NON_SYSTEM_ZLIB_
 #undef _IRR_USE_NON_SYSTEM_ZLIB_
 #endif
diff --git a/source/Irrlicht/CFileSystem.h b/source/Irrlicht/CFileSystem.h
index 0af5356..5ef84f7 100644
--- a/source/Irrlicht/CFileSystem.h
+++ b/source/Irrlicht/CFileSystem.h
@@ -5,6 +5,8 @@
 #ifndef __C_FILE_SYSTEM_H_INCLUDED__
 #define __C_FILE_SYSTEM_H_INCLUDED__
 
+#include <unistd.h>
+
 #include "IFileSystem.h"
 #include "irrArray.h"
 
diff --git a/source/Irrlicht/COSOperator.cpp b/source/Irrlicht/COSOperator.cpp
index 0899d1d..ccf5ef5 100644
--- a/source/Irrlicht/COSOperator.cpp
+++ b/source/Irrlicht/COSOperator.cpp
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #ifndef _IRR_SOLARIS_PLATFORM_
 #include <sys/types.h>
-#include <sys/sysctl.h>
 #endif
 #endif
 
diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h
index 1b77bad..ee70cd5 100644
--- a/source/Irrlicht/COpenGLExtensionHandler.h
+++ b/source/Irrlicht/COpenGLExtensionHandler.h
@@ -37,7 +37,7 @@
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
 		#include "glext.h"
 	#endif
-#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
+#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
 		#define GL_GLEXT_LEGACY 1
 		#define GLX_GLXEXT_LEGACY 1
diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile
index 6f8aa45..91f2491 100644
--- a/source/Irrlicht/Makefile
+++ b/source/Irrlicht/Makefile
@@ -88,7 +88,7 @@ STATIC_LIB = libIrrlicht.a
 LIB_PATH = ../../lib/$(SYSTEM)
 INSTALL_DIR = /usr/local/lib
 sharedlib install: SHARED_LIB = libIrrlicht.so
-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
+sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lSDL -lGL
 staticlib sharedlib: CXXINCS += -I/usr/X11R6/include
 
 #OSX specific options
--
2.2.2

