From 26dac03854c3973beae9436d38fb4c8b1a1cbd4c Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 1 Aug 2016 19:08:15 +0000
Subject: Haiku patch


diff --git a/configure.ac b/configure.ac
index 26cfc91..fcbe5d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,7 +190,7 @@ for PostScript level 3 compression.])
   ])
 fi
 
-AC_CHECK_LIB(m, floor, true, AC_MSG_ERROR([cannot find the m library (-lm)]))
+AC_CHECK_LIB(m, floor, MATH_LIBS="-lm", MATH_LIBS="")
 
 dnl ----------------------------------------------------------------------
 dnl Check for types
@@ -272,6 +272,7 @@ AC_SUBST(MKBITMAP)
 AC_SUBST(EXTRA_OBJS)
 AC_SUBST(EXTRA_INCLUDES)
 AC_SUBST(EXTRA_LIBS)
+AC_SUBST(MATH_LIBS)
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(POTRACELIB_VERSION)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 1a92572..cce2563 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,17 +21,17 @@ potrace_SOURCES = main.c main.h bitmap_io.c bitmap_io.h backend_eps.c	\
  platform.h progress.h progress_bar.c progress_bar.h bbox.c bbox.h	\
  trans.c trans.h
 EXTRA_potrace_SOURCES = getopt.c getopt1.c include/getopt/getopt.h
-potrace_LDADD = libpotrace.la @EXTRA_OBJS@ -lm @EXTRA_LIBS@
+potrace_LDADD = libpotrace.la @EXTRA_OBJS@ @MATH_LIBS@ @EXTRA_LIBS@
 potrace_DEPENDENCIES = libpotrace.la @EXTRA_OBJS@
 
 mkbitmap_SOURCES = mkbitmap.c bitmap_io.c bitmap_io.h greymap.c	\
  greymap.h platform.h bitmap.h potracelib.h bitops.h
 EXTRA_mkbitmap_SOURCES = getopt.c getopt1.c include/getopt/getopt.h
-mkbitmap_LDADD = @EXTRA_OBJS@ -lm
+mkbitmap_LDADD = @EXTRA_OBJS@ @MATH_LIBS@
 mkbitmap_DEPENDENCIES = @EXTRA_OBJS@
 
 potracelib_demo_SOURCES = potracelib_demo.c
-potracelib_demo_LDADD = libpotrace.la -lm
+potracelib_demo_LDADD = libpotrace.la @MATH_LIBS@
 potracelib_demo_DEPENDENCIES = libpotrace.la
 
 AM_CPPFLAGS = @EXTRA_INCLUDES@
@@ -48,7 +48,7 @@ EXTRA_LTLIBRARIES = libpotrace.la
 libpotrace_la_SOURCES = $(libsources)
 libpotrace_la_LDFLAGS = -version-info 0:6:0 -rpath '$(libdir)' \
  -export-symbols $(srcdir)/libpotrace-export.sym -no-undefined
-libpotrace_la_LIBADD = -lm
+libpotrace_la_LIBADD = @MATH_LIBS@
 MOSTLYCLEANFILES = libpotrace.la
 
 # header files to install
-- 
2.21.0

