From d1ffdc61ccb3c8eccbb0c938e8fafa4f8c3dc3f7 Mon Sep 17 00:00:00 2001
From: Mikolaj 'lich' Halber <lich@opmbx.org>
Date: Tue, 15 Dec 2015 15:06:31 +0000
Subject: Added Haiku support


diff --git a/Makefile b/Makefile
index 88a8bd6..5d1a683 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,9 @@ ifneq ($(HG_REV), )
     EXTRA_CFLAGS += '-DHG_REV="$(HG_REV)"'
 endif
 
-EXTRA_LDLIBS += -lm
+ifneq (BePC, $(shell uname -m))
+    EXTRA_LDLIBS += -lm
+endif
 
 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
 SDL_LDLIBS := $(shell $(SDL_CONFIG) --libs)
diff --git a/src/opentyr.c b/src/opentyr.c
index 3cffa49..d0f85a4 100644
--- a/src/opentyr.c
+++ b/src/opentyr.c
@@ -52,6 +52,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
+#include <libgen.h>
+#include <unistd.h>
 
 const char *opentyrian_str = "OpenTyrian",
            *opentyrian_version = HG_REV;
@@ -275,6 +277,7 @@ void opentyrian_menu( void )
 
 int main( int argc, char *argv[] )
 {
+	chdir(dirname(argv[0]));
 	mt_srand(time(NULL));
 
 	printf("\nWelcome to... >> %s %s <<\n\n", opentyrian_str, opentyrian_version);
-- 
2.2.2

