From 33498c7b021a9834a42822a02985b9cd5110a0aa Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 25 Dec 2015 22:07:28 +0000
Subject: Haiku patch


diff --git a/configure.ac b/configure.ac
index 1b32dfb..a9da74b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -456,6 +456,9 @@ if test x"$ac_cv_func_connect" = x"no"; then
 fi
 
 AC_SEARCH_LIBS(inet_ntop, resolv)
+AC_SEARCH_LIBS(socket, network)
+AC_SEARCH_LIBS(getpass, bsd)
+AC_SEARCH_LIBS(getxattr, gnu)
 
 # For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed.  We'll
 # accept either iconv_open or libiconv_open, since some include files map
@@ -1047,6 +1050,12 @@ else
 	AC_DEFINE(SUPPORT_XATTRS, 1)
 	AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
 	;;
+    *haiku*)
+	AC_MSG_RESULT(Using Linux xattrs)
+	AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
+	AC_DEFINE(SUPPORT_XATTRS, 1)
+	AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
+	;;
     *)
 	if test x"$enable_xattr_support" = x"yes"; then
 	    AC_MSG_ERROR(Failed to find extended attribute support)
diff --git a/rsync.h b/rsync.h
index 6e1e1dd..ff24175 100644
--- a/rsync.h
+++ b/rsync.h
@@ -443,7 +443,9 @@ enum delret {
 #ifdef MAKEDEV_TAKES_3_ARGS
 #define MAKEDEV(devmajor,devminor) makedev(0,devmajor,devminor)
 #else
-#define MAKEDEV(devmajor,devminor) makedev(devmajor,devminor)
+#define MAKEDEV(devmajor,devminor) ((dev_t)0)
+#define major(dev) (0)
+#define minor(dev) (0)
 #endif
 
 #ifdef HAVE_COMPAT_H
diff --git a/testsuite/hands.test b/testsuite/hands.test
index 46928d4..08a9eec 100644
--- a/testsuite/hands.test
+++ b/testsuite/hands.test
@@ -15,7 +15,7 @@ DEBUG_OPTS="--debug=all0,deltasum0"
 
 runtest "basic operation" 'checkit "$RSYNC -av \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
 
-ln "$fromdir/filelist" "$fromdir/dir"
+cp -p "$fromdir/filelist" "$fromdir/dir"
 runtest "hard links" 'checkit "$RSYNC -avH $DEBUG_OPTS \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
 
 rm "$todir/text"
diff --git a/testsuite/relative.test b/testsuite/relative.test
index 686399e..c6e14dc 100644
--- a/testsuite/relative.test
+++ b/testsuite/relative.test
@@ -31,8 +31,8 @@ $RSYNC -ai --include=/down/ --exclude='/*' "$fromdir/" "$chkdir/"
 sleep 1
 runtest "basic relative" 'checkit "$RSYNC -avR ./$deepstr \"$todir\"" "$chkdir" "$todir"'
 
-ln $deepstr/filelist $deepstr/dir
-ln ../chk/$deepstr/filelist ../chk/$deepstr/dir
+cp -p $deepstr/filelist $deepstr/dir
+cp -p ../chk/$deepstr/filelist ../chk/$deepstr/dir
 # Work around time rounding/truncating issue by touching both dirs.
 touch -r $deepstr/dir $deepstr/dir ../chk/$deepstr/dir
 runtest "hard links" 'checkit "$RSYNC -avHR ./$deepstr/ \"$todir\"" "$chkdir" "$todir"'
-- 
2.2.2

