From 6bb33f02e730526ca22abe041a5f81c87bd137ce Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 11 Jun 2014 17:25:38 +0000
Subject: haiku patch


diff --git a/configure.ac b/configure.ac
index 8ad5562..8c9c428 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,6 +130,9 @@ case $host in
                          [ LIBM_LIBS="-lcpml"
                            have_cpml=true ],,)
             ;;
+    haiku*)
+    	LIBM_LIBS=""
+    		;;
         *)
             AC_MSG_RESULT([no])
             ;;
@@ -355,7 +358,7 @@ case $host_cpu in
     AC_DEFINE(HAVE_X86CPU,1, [Compiling for x86-64 architecture CPU])
     have_x86cpu=true
     have_x86_64cpu=true
-    PROGRAM_NOPIC="-fno-PIC"
+    PROGRAM_NOPIC=""
     ;;
   powerpc | powerpc64)
     AC_MSG_RESULT(PowerPC)
diff --git a/lavtools/Makefile.am b/lavtools/Makefile.am
index 117dce7..417d7d2 100644
--- a/lavtools/Makefile.am
+++ b/lavtools/Makefile.am
@@ -152,7 +152,7 @@ jpeg2yuv_LDADD = $(LIBMJPEGUTILS) liblavjpeg.la $(JPEG_LIBS)
 
 png2yuv_SOURCES = png2yuv.c colorspace.c subsample.c
 png2yuv_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPNG_CFLAGS)
-png2yuv_LDADD = $(LIBMJPEGUTILS) $(LIBPNG_LIBS) -lz -lm
+png2yuv_LDADD = $(LIBMJPEGUTILS) $(LIBPNG_LIBS) -lz
 
 lavpipe_SOURCES = lavpipe.c pipelist.c
 lavpipe_LDADD = $(LIBMJPEGUTILS)
diff --git a/y4mdenoise/newdenoise.cc b/y4mdenoise/newdenoise.cc
index d84890b..3b0a4ec 100644
--- a/y4mdenoise/newdenoise.cc
+++ b/y4mdenoise/newdenoise.cc
@@ -1853,12 +1853,14 @@ BasicThread::Initialize (void)
 		mjpeg_error_exit1 ("pthread_attr_init() failed: %s",
 			strerror (nErr));
 
+#ifndef __HAIKU__
 	// Inherit scheduling parameters from the main thread.
 	nErr = pthread_attr_setinheritsched (&sThreadAttributes,
 		PTHREAD_INHERIT_SCHED);
 	if (nErr != 0)
 		mjpeg_error_exit1 ("pthread_attr_setinheritsched() failed: %s",
 			strerror (nErr));
+#endif
 	
 	// Create the thread.
 	nErr = pthread_create (&m_oThreadInfo,
diff --git a/yuvscaler/Makefile.am b/yuvscaler/Makefile.am
index 1fe4d75..d855a93 100644
--- a/yuvscaler/Makefile.am
+++ b/yuvscaler/Makefile.am
@@ -18,6 +18,5 @@ noinst_HEADERS = \
 
 EXTRA_DIST = yuvscaler_implementation.txt
 
-yuvscaler_CFLAGS=@PROGRAM_NOPIC@
 yuvscaler_SOURCES = yuvscaler.c yuvscaler_resample.c yuvscaler_bicubic.c
 yuvscaler_LDADD = $(LIBMJPEGUTILS) $(LIBM_LIBS)
-- 
1.8.3.4

