From c6139ee764b898c8a90e898bb9fb94b89d854571 Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Mon, 21 Jul 2014 17:18:22 +0200
Subject: Haiku support


diff --git a/configure.ac b/configure.ac
index 12e7614..e318411 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,6 +304,7 @@ AC_COMPILE_IFELSE([
 ], [
 	AC_MSG_RESULT([yes, find Darwin getxattr])
 	[XATTR_CFLAGS="-DWITH_EXTENDED_FS=1"]
+	[XATTR_LIBS=""]
 ], [
 	AC_COMPILE_IFELSE([
 		AC_LANG_PROGRAM(
@@ -314,12 +315,15 @@ AC_COMPILE_IFELSE([
 	], [
 		AC_MSG_RESULT([yes, find Linux getxattr])
 		[XATTR_CFLAGS="-DWITH_EXTENDED_FS=2"]
+		AS_CASE([$host], [*-*-haiku*], [XATTR_LIBS="-lgnu"], [XATTR_LIBS=""])
 	], [
 		AC_MSG_RESULT([no])
 		[XATTR_CFLAGS="-DWITH_EXTENDED_FS=0"]
+		[XATTR_LIBS=""]
 	])
 ])
 AC_SUBST(XATTR_CFLAGS)
+AC_SUBST(XATTR_LIBS)
 
 # =========
 # Find zlib
diff --git a/src/tools/file/Makefile.am b/src/tools/file/Makefile.am
index 9b25e89..6260426 100644
--- a/src/tools/file/Makefile.am
+++ b/src/tools/file/Makefile.am
@@ -3,7 +3,7 @@ bin_PROGRAMS = mwawFile
 AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src/lib/ $(REVENGE_CFLAGS) $(XATTR_CFLAGS) $(DEBUG_CXXFLAGS)
 
 mwawFile_DEPENDENCIES = @MWAWFILE_WIN32_RESOURCE@
-mwawFile_LDADD = @MWAWFILE_WIN32_RESOURCE@
+mwawFile_LDADD = $(XATTR_LIBS) @MWAWFILE_WIN32_RESOURCE@
 
 if STATIC_TOOLS
 mwawFile_LDFLAGS = -all-static
diff --git a/src/tools/zip/Makefile.am b/src/tools/zip/Makefile.am
old mode 100755
new mode 100644
index a8dd26d..28a9c51
--- a/src/tools/zip/Makefile.am
+++ b/src/tools/zip/Makefile.am
@@ -3,7 +3,7 @@ bin_PROGRAMS = mwawZip
 AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src/lib/ $(REVENGE_CFLAGS) $(XATTR_CFLAGS) $(ZLIB_CFLAGS) $(DEBUG_CXXFLAGS)
 
 mwawZip_DEPENDENCIES = @MWAWZIP_WIN32_RESOURCE@
-mwawZip_LDADD = $(ZLIB_LIBS) @MWAWZIP_WIN32_RESOURCE@
+mwawZip_LDADD = $(XATTR_LIBS) $(ZLIB_LIBS) @MWAWZIP_WIN32_RESOURCE@
 
 if STATIC_TOOLS
 mwawZip_LDFLAGS = -all-static
-- 
1.8.3.4

