diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/Makefile.am gnome-vfs-2.24.4/Makefile.am
--- gnome-vfs-2.24.4.orig/Makefile.am	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/Makefile.am	2015-02-23 04:36:47.000000000 -0500
@@ -1,3 +1,4 @@
+ACLOCAL_AMFLAGS = -I m4
 SUBDIRS_GNOME=doc schemas
 
 SUBDIRS =					\
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/acinclude.m4 gnome-vfs-2.24.4/acinclude.m4
--- gnome-vfs-2.24.4.orig/acinclude.m4	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/acinclude.m4	2015-02-22 15:56:59.000000000 -0500
@@ -235,7 +235,6 @@
 AC_MSG_NOTICE([using bundled neon ($NEON_VERSION)])
 NEON_BUILD_BUNDLED="yes"
 LIBNEON_SOURCE_CHECKS
-NEON_CFLAGS="$CFLAGS -I.. -I../.. -I$srcdir/$neon_bundled_srcdir"
 NEON_NEED_XML_PARSER=yes
 neon_library_message="included libneon (${NEON_VERSION})"
 
@@ -267,8 +266,8 @@
 
 #xml parser stuff
 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $XML_REQUIRED)
-NEON_CFLAGS="$NEON_CFLAGS $LIBXML_CFLAGS" 
-NEON_LIBS="$NEON_LIBS $LIBXML_LIBS"
+NEON_CFLAGS="$NEON_CFLAGS $OPENSSL_CFLAGS $LIBXML_CFLAGS" 
+NEON_LIBS="$NEON_LIBS $OPENSSL_LIBS $LIBXML_LIBS"
 
 AC_DEFINE(HAVE_LIBXML, 1, [Define if you have libxml])
 
@@ -403,10 +402,11 @@
 Darwin) ne_cv_os_macosx=yes ;;
 *) ne_cv_os_macosx=no ;;
 esac])
-if test $ne_cv_os_macosx = yes; then
-  CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
-  LDFLAGS="$LDFLAGS -flat_namespace"
-fi
+dnl not appropriate for modern darwin (back at least to 10.3)
+dnl if test $ne_cv_os_macosx = yes; then
+dnl   CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
+dnl   LDFLAGS="$LDFLAGS -flat_namespace"
+dnl fi
 ])
 
 AC_DEFUN([NEON_FORMAT_PREP], [
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/configure.in gnome-vfs-2.24.4/configure.in
--- gnome-vfs-2.24.4.orig/configure.in	2010-07-01 11:36:09.000000000 -0400
+++ gnome-vfs-2.24.4/configure.in	2021-02-21 12:54:19.000000000 -0500
@@ -36,8 +36,7 @@
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE(gnome-vfs, $LIBGNOMEVFS_VERSION)
 
-dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
-AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
+AC_CONFIG_MACRO_DIR([m4])
 
 AM_MAINTAINER_MODE
 
@@ -363,6 +362,7 @@
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <stdlib.h>
 
 struct linger li;
 
@@ -451,8 +451,8 @@
 AC_PATH_PROG([KRB5_CONFIG], krb5-config, none, $PATH:/usr/kerberos/bin)
 					   
 if test "x$KRB5_CONFIG" != "xnone"; then
-   GSSAPI_LIBS="`${KRB5_CONFIG} --libs gssapi`"
-   GSSAPI_CFLAGS="`${KRB5_CONFIG} --cflags gssapi`"
+   GSSAPI_LIBS="`${KRB5_CONFIG} --libs gssapi | sed -e 's,-L/usr/lib,,'`"
+   GSSAPI_CFLAGS="`${KRB5_CONFIG} --cflags gssapi | sed -e 's,-L/usr/include,,'`"
    
    saved_CPPFLAGS="$CPPFLAGS"
    saved_LIBS="$LIBS"
@@ -489,7 +489,6 @@
 dnl ******************************
 dnl http-method (neon checks)
 dnl ******************************
-VFS_NEON_BUNDLED(imported/neon)
 
 AC_ARG_ENABLE(http-debug,
 	[AS_HELP_STRING([--enable-http-debug],[Enable HTTP method debugging])],
@@ -658,6 +657,10 @@
   dnl end of PKG_CHECK_MODULES(openssl)
 fi
 
+# this is patched (acinclude.m4) to slurp OPENSSL_, so must be after
+# openssl tests, cf http://bugzilla.gnome.org/show_bug.cgi?id=511189
+VFS_NEON_BUNDLED(imported/neon)
+
 dnl ****************************
 dnl GNUTLS
 dnl ****************************
@@ -667,16 +670,11 @@
   if test "x${OPENSSL_LIBS}" != "x"; then
     AC_MSG_ERROR([*** Can't use both openssl and gnutls at the same time. Please pick one only. ***])
   else
-    AC_CHECK_HEADER(gcrypt.h,, AC_MSG_ERROR([*** Need gcrypt.h to compile with GnuTLS support ***]))
-    AM_PATH_LIBGNUTLS(1.0.0, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
+    PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 1.0.0, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
 			      have_ssl=true])
-
-    if test "x${LIBGNUTLS_LIBS}" = "x"; then
-      AM_PATH_LIBGNUTLS(0.5.1, [AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if GnuTLS is available])
-                                 AC_DEFINE(GNUTLS_COMPAT, 1, [FIXME])
-				 have_ssl=true],
-                                 AC_MSG_ERROR([Unable to find GNUTLS]))
-    fi
+   if test "x${LIBGNUTLS_LIBS}" = "x"; then
+     AC_MSG_ERROR([Unable to find GNUTLS])
+   fi
   fi
 fi
 
@@ -1095,7 +1093,7 @@
 
 AC_CACHE_CHECK([for POSIX ACL], gvfs_cv_HAVE_POSIX_ACLS,[
 		acl_LIBS=$LIBS
-		LIBS="$LIBS -lacl"
+		LIBS="$LIBS $ACL_LIBS"
 		AC_TRY_LINK([#include <sys/types.h>
 #include <sys/acl.h>],
 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry (acl, entry_id, entry_p);],
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/imported/neon/Makefile.am gnome-vfs-2.24.4/imported/neon/Makefile.am
--- gnome-vfs-2.24.4.orig/imported/neon/Makefile.am	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/imported/neon/Makefile.am	2015-02-22 15:56:59.000000000 -0500
@@ -9,13 +9,12 @@
 INCLUDES =					\
 	-DNE_HAVE_DAV				\
 	$(SSL_DEFINES)                          \
-	$(NEON_CFLAGS)				\
-	$(LIBGNOMEVFS_CFLAGS)			\
-	$(GSSAPI_CFLAGS)			\
         -I$(top_srcdir)                         \
         -I$(top_builddir)                       \
         -I$(top_srcdir)/libgnomevfs             \
         -I$(top_builddir)/libgnomevfs           \
+	$(NEON_CFLAGS)				\
+	$(LIBGNOMEVFS_CFLAGS)			\
         $(NULL)
 
 noinst_LTLIBRARIES = libneon.la
@@ -64,6 +63,7 @@
 
 libneon_la_LIBADD =			\
 	$(NEON_LIBS) $(NEON_LTLIBS)	\
+	$(LIBGNOMEVFS_LIBS)		\
 	$(NULL)
 
 libneon_la_LDFLAGS =			\
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/libgnomevfs/Makefile.am gnome-vfs-2.24.4/libgnomevfs/Makefile.am
--- gnome-vfs-2.24.4.orig/libgnomevfs/Makefile.am	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/libgnomevfs/Makefile.am	2015-02-22 15:56:59.000000000 -0500
@@ -114,6 +114,7 @@
 	$(SOCKET_LIBS)				\
 	$(INTLLIBS)				\
 	$(SELINUX_LIBS)				\
+	-lresolv				\
 	$(NULL)
 
 libgnomevfs_2_la_LDFLAGS =			\
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/libgnomevfs/gnome-vfs-ssl.c gnome-vfs-2.24.4/libgnomevfs/gnome-vfs-ssl.c
--- gnome-vfs-2.24.4.orig/libgnomevfs/gnome-vfs-ssl.c	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/libgnomevfs/gnome-vfs-ssl.c	2021-01-30 17:48:38.000000000 -0500
@@ -42,8 +42,10 @@
 #include <openssl/x509.h>
 #include <openssl/err.h>
 #elif defined HAVE_GNUTLS
-#include <gcrypt.h>
 #include <gnutls/gnutls.h>
+#if GNUTLS_VERSION_NUMBER <= 0x020b00
+#include <gcrypt.h>
+#endif
 #endif
 #if defined(HAVE_OPENSSL) || defined(HAVE_GNUTLS)
 #include <sys/time.h>
@@ -61,13 +63,6 @@
 #endif
 #endif
 
-#if defined GNUTLS_COMPAT
-#define gnutls_certificate_credentials GNUTLS_CERTIFICATE_CREDENTIALS
-#define gnutls_session GNUTLS_STATE
-#define gnutls_certificate_free_credentials gnutls_certificate_free_sc
-#define gnutls_certificate_allocate_credentials gnutls_certificate_allocate_sc
-#endif
-
 typedef struct {
 #ifdef HAVE_OPENSSL
 	int sockfd;
@@ -89,7 +84,7 @@
 	GnomeVFSSSLPrivate *private;
 };
 
-#ifdef HAVE_GNUTLS
+#if defined(HAVE_GNUTLS) && GNUTLS_VERSION_NUMBER <= 0x020b00
 static int gcry_gthread_mutex_init (void **priv)			      
 {									      
 	GMutex* lock = g_mutex_new();
@@ -134,7 +129,9 @@
 #ifdef HAVE_OPENSSL
 	SSL_library_init ();
 #elif defined HAVE_GNUTLS
+#if GNUTLS_VERSION_NUMBER <= 0x020b00
 	gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_gthread);
+#endif
 	gnutls_global_init();
 #endif
 	return NULL;
@@ -314,21 +311,6 @@
 #endif
 }
 
-#ifdef HAVE_GNUTLS
-static const int protocol_priority[] = {GNUTLS_TLS1, GNUTLS_SSL3, 0};
-static const int cipher_priority[] = 
-	{GNUTLS_CIPHER_RIJNDAEL_128_CBC, GNUTLS_CIPHER_3DES_CBC,
-	 GNUTLS_CIPHER_RIJNDAEL_256_CBC, GNUTLS_CIPHER_ARCFOUR, 0};
-static const int comp_priority[] =
-	{GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0};
-static const int kx_priority[] =
-	{GNUTLS_KX_DHE_RSA, GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS, 0};
-static const int mac_priority[] =
-	{GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0};
-
-#endif
-
-
 /**
  * gnome_vfs_ssl_create_from_fd:
  * @handle_return: pointer to a #GnomeVFSSSL struct, which will
@@ -437,11 +419,7 @@
 	gnutls_transport_set_ptr (ssl->private->tlsstate, 
 				  GINT_TO_POINTER (fd));
 
-	gnutls_protocol_set_priority (ssl->private->tlsstate, protocol_priority);
-	gnutls_cipher_set_priority (ssl->private->tlsstate, cipher_priority);
-	gnutls_compression_set_priority (ssl->private->tlsstate, comp_priority);
-	gnutls_kx_set_priority (ssl->private->tlsstate, kx_priority);
-	gnutls_mac_set_priority (ssl->private->tlsstate, mac_priority);
+	gnutls_set_default_priority (ssl->private->tlsstate);
 
 	gnutls_cred_set (ssl->private->tlsstate, GNUTLS_CRD_CERTIFICATE,
 			 ssl->private->xcred);
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/test/Makefile.am gnome-vfs-2.24.4/test/Makefile.am
--- gnome-vfs-2.24.4.orig/test/Makefile.am	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/test/Makefile.am	2015-02-23 04:21:34.000000000 -0500
@@ -65,7 +65,7 @@
 	test-async-cancel \
 	test-escape       \
 	test-uri       	  \
-	$(srcdir)/auto-test	
+	auto-test	
 
 libraries =						\
 	$(top_builddir)/libgnomevfs/libgnomevfs-2.la	\
diff -Nurd -x'*~' gnome-vfs-2.24.4.orig/test/test-async-directory.c gnome-vfs-2.24.4/test/test-async-directory.c
--- gnome-vfs-2.24.4.orig/test/test-async-directory.c	2010-02-09 07:16:14.000000000 -0500
+++ gnome-vfs-2.24.4/test/test-async-directory.c	2021-02-21 12:56:56.000000000 -0500
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <glib.h>
+#include <glib/gprintf.h>
 #include <libgnomevfs/gnome-vfs-async-ops.h>
 #include <libgnomevfs/gnome-vfs-init.h>
 #include <stdio.h>
