Fixes major build errors on macOS

See http://lists.gnu.org/archive/html/bug-tar/2014-08/msg00001.html

diff --git a/Makefile.in b/Makefile.in
index f9f1d1d..b403e46 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -1583,9 +1583,10 @@ distcheck: dist
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
-	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	  && ../configure \
 	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	    --srcdir=.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
diff --git a/aclocal.m4 b/aclocal.m4
index 0e09589..804c0b3 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.14 -*- Autoconf -*-
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
 
 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.14'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.14], [],
+m4_if([$1], [1.14.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.14])dnl
+[AM_AUTOMAKE_VERSION([1.14.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/config.h.in b/config.h.in
index 6646ea5..8571ef4 100644
--- a/config.h.in
+++ b/config.h.in
@@ -617,7 +617,7 @@
    */
 #undef HAVE_ALLOCA_H
 
-/* define to 1 if we have <attr/xattr.h> header */
+/* Define to 1 if you have the <attr/xattr.h> header file. */
 #undef HAVE_ATTR_XATTR_H
 
 /* Define to 1 if you have the <bp-sym.h> header file. */
@@ -924,21 +924,12 @@
 /* Define to 1 if you have the <features.h> header file. */
 #undef HAVE_FEATURES_H
 
-/* Define to 1 if you have the `fgetxattr' function. */
-#undef HAVE_FGETXATTR
-
-/* Define to 1 if you have the `flistxattr' function. */
-#undef HAVE_FLISTXATTR
-
 /* Define to 1 if you have the `flockfile' function. */
 #undef HAVE_FLOCKFILE
 
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 #undef HAVE_FSEEKO
 
-/* Define to 1 if you have the `fsetxattr' function. */
-#undef HAVE_FSETXATTR
-
 /* Define to 1 if you have the `fstatat' function. */
 #undef HAVE_FSTATAT
 
@@ -990,9 +981,6 @@
 /* Define to 1 if you have the `gettimeofday' function. */
 #undef HAVE_GETTIMEOFDAY
 
-/* Define to 1 if you have the `getxattr' function. */
-#undef HAVE_GETXATTR
-
 /* Define to 1 if you have the `grantpt' function. */
 #undef HAVE_GRANTPT
 
@@ -1045,12 +1033,6 @@
 /* Define to 1 if you have the `lchown' function. */
 #undef HAVE_LCHOWN
 
-/* Define to 1 if you have the `lgetxattr' function. */
-#undef HAVE_LGETXATTR
-
-/* Define to 1 if you have the `attr' library (-lattr). */
-#undef HAVE_LIBATTR
-
 /* Define to 1 if you have the <libgen.h> header file. */
 #undef HAVE_LIBGEN_H
 
@@ -1069,12 +1051,6 @@
 /* Define to 1 if you have the <linux/fd.h> header file. */
 #undef HAVE_LINUX_FD_H
 
-/* Define to 1 if you have the `listxattr' function. */
-#undef HAVE_LISTXATTR
-
-/* Define to 1 if you have the `llistxattr' function. */
-#undef HAVE_LLISTXATTR
-
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
@@ -1087,9 +1063,6 @@
 /* Define to 1 if the system has the type 'long long int'. */
 #undef HAVE_LONG_LONG_INT
 
-/* Define to 1 if you have the `lsetxattr' function. */
-#undef HAVE_LSETXATTR
-
 /* Define to 1 if you have the `lstat' function. */
 #undef HAVE_LSTAT
 
@@ -1867,9 +1840,6 @@
 /* Define to 1 if you have the `setlocale' function. */
 #undef HAVE_SETLOCALE
 
-/* Define to 1 if you have the `setxattr' function. */
-#undef HAVE_SETXATTR
-
 /* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
@@ -2074,7 +2044,7 @@
 /* Define to 1 if you have the <sys/wait.h> header file. */
 #undef HAVE_SYS_WAIT_H
 
-/* define to 1 if we have <sys/xattr.h> header */
+/* Define to 1 if you have the <sys/xattr.h> header file. */
 #undef HAVE_SYS_XATTR_H
 
 /* Define if struct tm has the tm_gmtoff member. */
diff --git a/configure b/configure
index cfdd721..8cf6e91 100755
--- a/configure
+++ b/configure
@@ -663,8 +663,6 @@ RSH
 LIBOBJS
 TAR_COND_GRANTPT_FALSE
 TAR_COND_GRANTPT_TRUE
-TAR_LIB_ATTR_FALSE
-TAR_LIB_ATTR_TRUE
 TAR_COND_XATTR_H_FALSE
 TAR_COND_XATTR_H_TRUE
 GNULIB_TEST_WARN_CFLAGS
@@ -34994,41 +34992,6 @@ else
   TAR_COND_XATTR_H_FALSE=
 fi
 
-   if false; then
-  TAR_LIB_ATTR_TRUE=
-  TAR_LIB_ATTR_FALSE='#'
-else
-  TAR_LIB_ATTR_TRUE='#'
-  TAR_LIB_ATTR_FALSE=
-fi
-
-  if test "$ac_cv_header_sys_xattr_h" = yes; then
-    for ac_func in getxattr  fgetxattr  lgetxattr \
-                   setxattr  fsetxattr  lsetxattr \
-                   listxattr flistxattr llistxattr
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- # only when functions are present
-
-$as_echo "#define HAVE_SYS_XATTR_H 1" >>confdefs.h
-
-        if test "$with_xattrs" != no; then
-
-$as_echo "#define HAVE_XATTRS /**/" >>confdefs.h
-
-        fi
-
-fi
-done
-
-  fi
-
-  # If <sys/xattr.h> is not found, then check for <attr/xattr.h>
   if test "$ac_cv_header_sys_xattr_h" != yes; then
     for ac_header in attr/xattr.h
 do :
@@ -35050,13 +35013,20 @@ else
   TAR_COND_XATTR_H_FALSE=
 fi
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgetxattr in -lattr" >&5
-$as_echo_n "checking for fgetxattr in -lattr... " >&6; }
-if ${ac_cv_lib_attr_fgetxattr+:} false; then :
+  fi
+
+  if test "$with_xattrs" != no; then
+    for i in getxattr  fgetxattr  lgetxattr \
+             setxattr  fsetxattr  lsetxattr \
+             listxattr flistxattr llistxattr
+    do
+      as_ac_Search=`$as_echo "ac_cv_search_$i" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing $i" >&5
+$as_echo_n "checking for library containing $i... " >&6; }
+if eval \${$as_ac_Search+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lattr  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -35066,67 +35036,56 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char fgetxattr ();
+char $i ();
 int
 main ()
 {
-return fgetxattr ();
+return $i ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_attr_fgetxattr=yes
-else
-  ac_cv_lib_attr_fgetxattr=no
+for ac_lib in '' attr; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Search=\$ac_res"
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_attr_fgetxattr" >&5
-$as_echo "$ac_cv_lib_attr_fgetxattr" >&6; }
-if test "x$ac_cv_lib_attr_fgetxattr" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBATTR 1
-_ACEOF
-
-  LIBS="-lattr $LIBS"
-
+    conftest$ac_exeext
+  if eval \${$as_ac_Search+:} false; then :
+  break
 fi
+done
+if eval \${$as_ac_Search+:} false; then :
 
-     if test "$ac_cv_lib_attr_fgetxattr" = yes; then
-  TAR_LIB_ATTR_TRUE=
-  TAR_LIB_ATTR_FALSE='#'
 else
-  TAR_LIB_ATTR_TRUE='#'
-  TAR_LIB_ATTR_FALSE=
+  eval "$as_ac_Search=no"
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
 fi
+eval ac_res=\$$as_ac_Search
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval ac_res=\$$as_ac_Search
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-    if test "$ac_cv_header_attr_xattr_h" = yes; then
-      for ac_func in getxattr  fgetxattr  lgetxattr \
-                     setxattr  fsetxattr  lsetxattr \
-                     listxattr flistxattr llistxattr
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- # only when functions are present
+fi
 
-$as_echo "#define HAVE_ATTR_XATTR_H 1" >>confdefs.h
+      eval found=\$ac_cv_search_$i
+      test "$found" = "no" && break
+    done
 
-          if test "$with_xattrs" != no; then
+    if test "$found" != no; then
 
 $as_echo "#define HAVE_XATTRS /**/" >>confdefs.h
 
-          fi
-
-fi
-done
-
     fi
   fi
 
@@ -38187,18 +38146,10 @@ if test -z "${TAR_COND_XATTR_H_TRUE}" && test -z "${TAR_COND_XATTR_H_FALSE}"; th
   as_fn_error $? "conditional \"TAR_COND_XATTR_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${TAR_LIB_ATTR_TRUE}" && test -z "${TAR_LIB_ATTR_FALSE}"; then
-  as_fn_error $? "conditional \"TAR_LIB_ATTR\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${TAR_COND_XATTR_H_TRUE}" && test -z "${TAR_COND_XATTR_H_FALSE}"; then
   as_fn_error $? "conditional \"TAR_COND_XATTR_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${TAR_LIB_ATTR_TRUE}" && test -z "${TAR_LIB_ATTR_FALSE}"; then
-  as_fn_error $? "conditional \"TAR_LIB_ATTR\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${TAR_COND_GRANTPT_TRUE}" && test -z "${TAR_COND_GRANTPT_FALSE}"; then
   as_fn_error $? "conditional \"TAR_COND_GRANTPT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/doc/Makefile.in b/doc/Makefile.in
index ca44f1a..42a06b3 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/gnu/Makefile.in b/gnu/Makefile.in
index 03eed58..d908a03 100644
--- a/gnu/Makefile.in
+++ b/gnu/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 41a9aca..1254b8f 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/rmt/Makefile.in b/rmt/Makefile.in
index c3f2509..0f3dca4 100644
--- a/rmt/Makefile.in
+++ b/rmt/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 57c0d0d..bf344ed 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/src/Makefile.in b/src/Makefile.in
index 6f9a592..fc6fc87 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -99,7 +99,6 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = tar$(EXEEXT)
-@TAR_LIB_ATTR_TRUE@am__append_1 = -lattr
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/build-aux/depcomp $(noinst_HEADERS)
@@ -254,7 +253,7 @@ am__DEPENDENCIES_2 = ../lib/libtar.a ../gnu/libgnu.a \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 tar_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -1225,8 +1224,7 @@ tar_SOURCES = \
 AM_CPPFLAGS = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
-tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) \
-	$(LIB_SELINUX) $(am__append_1)
+tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX)
 all: all-am
 
 .SUFFIXES:
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 6807509..50d7689 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/lib/xattr-at.c b/lib/xattr-at.c
index 443ccae..009bde5 100644
--- a/lib/xattr-at.c
+++ b/lib/xattr-at.c
@@ -18,6 +18,11 @@

 #include <config.h>

+/* Temporarily don't build.  We are unable to build on (probably not only)
+   darwin due to lack of l*xattr callbacks (XATTR_NOFOLLOW is alternative) and
+   different function definitions. */
+#ifdef HAVE_XATTRS
+
 #include "xattr-at.h"
 #include "openat.h"

@@ -108,3 +113,5 @@
 #undef AT_FUNC_RESULT
 #undef AT_FUNC_POST_FILE_PARAM_DECLS
 #undef AT_FUNC_POST_FILE_ARGS
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 82b2d46..42daaef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,3 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)

 tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX)
-
-if TAR_LIB_ATTR
-tar_LDADD += -lattr
-endif
--
1.9.3
