Blob Blame History Raw
From 727efe8ebda7313e03cdfb6f6636f4ce99fb5da2 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Thu, 29 Mar 2018 02:31:29 -0400
Subject: [PATCH] Use system libgit2.

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 configure              | 3862 +++---------------------------------------------
 configure.ac           |  401 +----
 src/Makevars.in        |   64 +-
 src/git2r_branch.c     |   32 +-
 src/git2r_checkout.c   |    1 -
 src/git2r_commit.c     |    4 +-
 src/git2r_cred.c       |   46 +-
 src/git2r_diff.c       |   51 +-
 src/git2r_merge.c      |   33 +-
 src/git2r_note.c       |   17 +-
 src/git2r_odb.c        |   22 +-
 src/git2r_remote.c     |    3 +-
 src/git2r_repository.c |    4 +-
 src/git2r_stash.c      |    4 +-
 src/git2r_tag.c        |    4 +-
 15 files changed, 315 insertions(+), 4233 deletions(-)

diff --git a/configure b/configure
index e574a65f..7661bf02 100755
--- a/configure
+++ b/configure
@@ -197,8 +197,7 @@ test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
 else
@@ -586,67 +585,16 @@ PACKAGE_BUGREPORT='https://github.com/ropensci/git2r/issues'
 PACKAGE_URL=''
 
 ac_unique_file="src/git2r.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 PKG_LIBS
 PKG_CPPFLAGS
 PKG_CFLAGS
-GIT2R_SRC_REGEX
-LIBCURL
-LIBCURL_CPPFLAGS
-_libcurl_config
-AWK
-LTLIBICONV
-LIBICONV
-libssh2_LIBS
-libssh2_CFLAGS
-openssl_LIBS
-openssl_CFLAGS
-zlib_LIBS
-zlib_CFLAGS
-EGREP
-GREP
-CPP
+libgit2_LIBS
+libgit2_CFLAGS
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
-BREW
 OBJEXT
 EXEEXT
 ac_ct_CC
@@ -703,16 +651,6 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-with_zlib_include
-with_zlib_lib
-with_libssh2_include
-with_libssh2_lib
-with_libssl_include
-with_libssl_lib
-with_gnu_ld
-enable_rpath
-with_libiconv_prefix
-with_libcurl
 '
       ac_precious_vars='build_alias
 host_alias
@@ -725,13 +663,8 @@ CPPFLAGS
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
-CPP
-zlib_CFLAGS
-zlib_LIBS
-openssl_CFLAGS
-openssl_LIBS
-libssh2_CFLAGS
-libssh2_LIBS'
+libgit2_CFLAGS
+libgit2_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1341,33 +1274,6 @@ if test -n "$ac_init_help"; then
    esac
   cat <<\_ACEOF
 
-Optional Features:
-  --disable-option-checking  ignore unrecognized --enable/--with options
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-rpath         do not hardcode runtime library paths
-
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-zlib-include=INCLUDE_PATH
-                          the location of the zlib header files
-  --with-zlib-lib=LIB_PATH
-                          the location of the zlib library
-  --with-libssh2-include=INCLUDE_PATH
-                          the location of the LibSSH2 header files
-  --with-libssh2-lib=LIB_PATH
-                          the location of the LibSSH2 library
-  --with-libssl-include=INCLUDE_PATH
-                          the location of the libssl header files
-  --with-libssl-lib=LIB_PATH
-                          the location of the libssl library
-  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
-  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
-  --with-libcurl=PREFIX   look for the curl library in PREFIX/lib and headers
-                          in PREFIX/include
-
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
@@ -1381,17 +1287,10 @@ Some influential environment variables:
               directories to add to pkg-config's search path
   PKG_CONFIG_LIBDIR
               path overriding pkg-config's built-in search path
-  CPP         C preprocessor
-  zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
-  zlib_LIBS   linker flags for zlib, overriding pkg-config
-  openssl_CFLAGS
-              C compiler flags for openssl, overriding pkg-config
-  openssl_LIBS
-              linker flags for openssl, overriding pkg-config
-  libssh2_CFLAGS
-              C compiler flags for libssh2, overriding pkg-config
-  libssh2_LIBS
-              linker flags for libssh2, overriding pkg-config
+  libgit2_CFLAGS
+              C compiler flags for libgit2, overriding pkg-config
+  libgit2_LIBS
+              linker flags for libgit2, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1510,583 +1409,120 @@ fi
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
 
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
+It was created by git2r $as_me see.DESCRIPTION.file, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
+  $ $0 $@
 
-  ;
-  return 0;
-}
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
+exec 5>>config.log
 {
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
-else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+_ASUNAME
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
-  ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
+} >&5
 
-  fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
+cat >&5 <<_ACEOF
 
-} # ac_fn_c_compute_int
 
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+## ----------- ##
+## Core tests. ##
+## ----------- ##
 
-    ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
+_ACEOF
 
-} # ac_fn_c_try_cpp
 
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
-} # ac_fn_c_check_header_compile
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if eval \${$4+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_member
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by git2r $as_me see.DESCRIPTION.file, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
-  done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
-    2)
-      as_fn_append ac_configure_args1 " '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      as_fn_append ac_configure_args " '$ac_arg'"
-      ;;
-    esac
-  done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
 
     $as_echo "## ---------------- ##
 ## Cache variables. ##
@@ -2355,65 +1791,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
 ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
-#***************************************************************************
-#                                  _   _ ____  _
-#  Project                     ___| | | |  _ \| |
-#                             / __| | | | |_) | |
-#                            | (__| |_| |  _ <| |___
-#                             \___|\___/|_| \_\_____|
-#
-# Copyright (C) 2006, David Shaw <dshaw@jabberwocky.com>
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://curl.haxx.se/docs/copyright.html.
-#
-# You may opt to use, copy, modify, merge, publish, distribute and/or sell
-# copies of the Software, and permit persons to whom the Software is
-# furnished to do so, under the terms of the COPYING file.
-#
-# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
-# KIND, either express or implied.
-#
-###########################################################################
-# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
-#                       [ACTION-IF-YES], [ACTION-IF-NO])
-# ----------------------------------------------------------
-#      David Shaw <dshaw@jabberwocky.com>   May-09-2006
-#
-# Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
-# specify whether to default to --with-libcurl or --without-libcurl.
-# If not supplied, DEFAULT-ACTION is yes.  MINIMUM-VERSION is the
-# minimum version of libcurl to accept.  Pass the version as a regular
-# version number like 7.10.1. If not supplied, any version is
-# accepted.  ACTION-IF-YES is a list of shell commands to run if
-# libcurl was successfully found and passed the various tests.
-# ACTION-IF-NO is a list of shell commands that are run otherwise.
-# Note that using --without-libcurl does run ACTION-IF-NO.
-#
-# This macro #defines HAVE_LIBCURL if a working libcurl setup is
-# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary
-# values.  Other useful defines are LIBCURL_FEATURE_xxx where xxx are
-# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
-# where yyy are the various protocols supported by libcurl.  Both xxx
-# and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
-# the macro for the complete list of possible defines.  Shell
-# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
-# defined to 'yes' for those features and protocols that were found.
-# Note that xxx and yyy keep the same capitalization as in the
-# curl-config list (e.g. it's "HTTP" and not "http").
-#
-# Users may override the detected values by doing something like:
-# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
-#
-# For the sake of sanity, this macro assumes that any libcurl that is
-# found is after version 7.7.2, the first version that included the
-# curl-config script.  Note that it is very important for people
-# packaging binary versions of libcurl to include this script!
-# Without curl-config, we can only guess what protocols are available,
-# or use curl_version_info to figure it out at runtime.
-
-
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
   as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
@@ -3277,53 +2654,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-## check for brew on OS X
-
-case "${host_os}" in
-    darwin*)
-        # Extract the first word of "brew", so it can be a program name with args.
-set dummy brew; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_BREW+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$BREW"; then
-  ac_cv_prog_BREW="$BREW" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_BREW="yes"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-BREW=$ac_cv_prog_BREW
-if test -n "$BREW"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BREW" >&5
-$as_echo "$BREW" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test "x${BREW}" = xyes; then
-            BREW_DIR=`brew --prefix`
-        fi
-    ;;
-esac
-
 # Check for pkg-config
 
 
@@ -3446,2939 +2776,128 @@ $as_echo "no" >&6; }
 	fi
 fi
 
-# Optional include and library paths
+# Check for libgit2
 
-# zlib include and library path
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgit2" >&5
+$as_echo_n "checking for libgit2... " >&6; }
 
-# Check whether --with-zlib-include was given.
-if test "${with_zlib_include+set}" = set; then :
-  withval=$with_zlib_include; zlib_include_path=$withval
+if test -n "$libgit2_CFLAGS"; then
+    pkg_cv_libgit2_CFLAGS="$libgit2_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libgit2 >= 0.26.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libgit2 >= 0.26.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libgit2_CFLAGS=`$PKG_CONFIG --cflags "libgit2 >= 0.26.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
 fi
-
-
-
-# Check whether --with-zlib-lib was given.
-if test "${with_zlib_lib+set}" = set; then :
-  withval=$with_zlib_lib; zlib_lib_path=$withval
-fi
-
-
-# LibSSH2 include and library path
-
-# Check whether --with-libssh2-include was given.
-if test "${with_libssh2_include+set}" = set; then :
-  withval=$with_libssh2_include; libssh2_include_path=$withval
-fi
-
-
-
-# Check whether --with-libssh2-lib was given.
-if test "${with_libssh2_lib+set}" = set; then :
-  withval=$with_libssh2_lib; libssh2_lib_path=$withval
-fi
-
-
-# libssl include and library path
-
-# Check whether --with-libssl-include was given.
-if test "${with_libssl_include+set}" = set; then :
-  withval=$with_libssl_include; libssl_include_path=$withval
-fi
-
-
-
-# Check whether --with-libssl-lib was given.
-if test "${with_libssl_lib+set}" = set; then :
-  withval=$with_libssl_lib; libssl_lib_path=$withval
-fi
-
-
-# Find the compiler and compiler flags to use
-: ${R_HOME=`R RHOME`}
-if test -z "${R_HOME}"; then
-  echo "could not determine R_HOME"
-  exit 1
-fi
-RBIN="${R_HOME}/bin/R"
-CC=`"${RBIN}" CMD config CC`
-CFLAGS=`"${RBIN}" CMD config CFLAGS`
-CPPFLAGS=`"${RBIN}" CMD config CPPFLAGS`
-CPICFLAGS=`"${RBIN}" CMD config CPICFLAGS`
-
-# Determine architecture of the machine
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
-fi
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void*" >&5
-$as_echo_n "checking size of void*... " >&6; }
-if ${ac_cv_sizeof_voidp+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void*))" "ac_cv_sizeof_voidp"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_voidp" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void*)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_voidp=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_voidp" >&5
-$as_echo "$ac_cv_sizeof_voidp" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOIDP $ac_cv_sizeof_voidp
-_ACEOF
-
-
-if test "x$ac_cv_sizeof_voidp" = "x8"; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_64"
-elif test "x$ac_cv_sizeof_voidp" = "x4"; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_32"
-else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void*" >&5
-$as_echo_n "checking size of void*... " >&6; }
-    sizeof_voidp=`"${RBIN}" --slave -e "cat(.Machine\\$sizeof.pointer)"`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_voidp" >&5
-$as_echo "$sizeof_voidp" >&6; }
-    if test "x$sizeof_voidp" = "x8"; then
-        CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_64"
-    elif test "x$sizeof_voidp" = "x4"; then
-        CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_32"
-    else
-        { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "Unsupported architecture
-See \`config.log' for more details" "$LINENO" 5; }
-    fi
-fi
-
-# Check for zlib
-have_zlib=no
-
-# Check for optional zlib include path
-if test  -n "$zlib_include_path"  ; then
-    CPPFLAGS="-I${zlib_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional zlib lib path
-if test  -n "$zlib_lib_path"  ; then
-    LIBS="-L${zlib_lib_path} ${LIBS}"
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inflate" >&5
-$as_echo_n "checking for library containing inflate... " >&6; }
-if ${ac_cv_search_inflate+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char inflate ();
-int
-main ()
-{
-return inflate ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' z; 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 :
-  ac_cv_search_inflate=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_inflate+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_inflate+:} false; then :
-
-else
-  ac_cv_search_inflate=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inflate" >&5
-$as_echo "$ac_cv_search_inflate" >&6; }
-ac_res=$ac_cv_search_inflate
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  have_zlib=yes
-fi
-
-
-if test "x${have_zlib}" = xno; then
-    if test  -n "$PKG_CONFIG"  ; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5
-$as_echo_n "checking for zlib... " >&6; }
-
-if test -n "$zlib_CFLAGS"; then
-    pkg_cv_zlib_CFLAGS="$zlib_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$zlib_LIBS"; then
-    pkg_cv_zlib_LIBS="$zlib_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1`
-        else
-	        zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$zlib_PKG_ERRORS" >&5
-
-
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-	zlib_CFLAGS=$pkg_cv_zlib_CFLAGS
-	zlib_LIBS=$pkg_cv_zlib_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	CPPFLAGS="${zlib_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${zlib_LIBS} ${LIBS}"
-                           have_zlib=yes
-fi
-    fi
-fi
-
-if test "x${have_zlib}" = xno; then
-        { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "
-  ---------------------------------------------
-   The zlib library that is required to build
-   git2r was not found.
-
-   Please install:
-     zlib1g-dev (package on e.g. Debian and Ubuntu)
-     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
-   and try again.
-
-   If the zlib library is installed on your
-   system but the git2r configuration is
-   unable to find it, you can specify the
-   include and lib path to zlib with:
-   R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
-  ---------------------------------------------
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-# Check for SSL
-have_ssl=no
-
-# Check for optional libssl include path
-if test  -n "$libssl_include_path"  ; then
-    CPPFLAGS="-I${libssl_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional libssl lib path
-if test  -n "$libssl_lib_path"  ; then
-    LIBS="-L${libssl_lib_path} ${LIBS}"
-fi
-
-if test "x${OPENSSL_INCLUDES}" = x; then :; else
-    CPPFLAGS="${CPPFLAGS} -I${OPENSSL_INCLUDES}"
-fi
-
-# On OS X, add path to libssl in brew
-case "${host_os}" in
-    darwin*)
-        if test "x${BREW}" = xyes; then
-            CPPFLAGS="${CPPFLAGS} -I${BREW_DIR}/opt/openssl/include"
-            LIBS="${LIBS} -L${BREW_DIR}/opt/openssl/lib"
-        fi
-    ;;
-esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing EVP_EncryptInit" >&5
-$as_echo_n "checking for library containing EVP_EncryptInit... " >&6; }
-if ${ac_cv_search_EVP_EncryptInit+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char EVP_EncryptInit ();
-int
-main ()
-{
-return EVP_EncryptInit ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' crypto; 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 :
-  ac_cv_search_EVP_EncryptInit=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_EVP_EncryptInit+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_EVP_EncryptInit+:} false; then :
-
-else
-  ac_cv_search_EVP_EncryptInit=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_EVP_EncryptInit" >&5
-$as_echo "$ac_cv_search_EVP_EncryptInit" >&6; }
-ac_res=$ac_cv_search_EVP_EncryptInit
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing SSL_library_init" >&5
-$as_echo_n "checking for library containing SSL_library_init... " >&6; }
-if ${ac_cv_search_SSL_library_init+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char SSL_library_init ();
-int
-main ()
-{
-return SSL_library_init ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' ssl; 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 :
-  ac_cv_search_SSL_library_init=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_SSL_library_init+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_SSL_library_init+:} false; then :
-
-else
-  ac_cv_search_SSL_library_init=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_SSL_library_init" >&5
-$as_echo "$ac_cv_search_SSL_library_init" >&6; }
-ac_res=$ac_cv_search_SSL_library_init
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  have_ssl=yes
-fi
-
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing OPENSSL_init_ssl" >&5
-$as_echo_n "checking for library containing OPENSSL_init_ssl... " >&6; }
-if ${ac_cv_search_OPENSSL_init_ssl+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char OPENSSL_init_ssl ();
-int
-main ()
-{
-return OPENSSL_init_ssl ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' ssl; 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 :
-  ac_cv_search_OPENSSL_init_ssl=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_OPENSSL_init_ssl+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_OPENSSL_init_ssl+:} false; then :
-
-else
-  ac_cv_search_OPENSSL_init_ssl=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_OPENSSL_init_ssl" >&5
-$as_echo "$ac_cv_search_OPENSSL_init_ssl" >&6; }
-ac_res=$ac_cv_search_OPENSSL_init_ssl
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  have_ssl=yes
-fi
-
-fi
-
-
-if test "x${have_ssl}" = xno; then
-    if test  -n "$PKG_CONFIG"  ; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl" >&5
-$as_echo_n "checking for openssl... " >&6; }
-
-if test -n "$openssl_CFLAGS"; then
-    pkg_cv_openssl_CFLAGS="$openssl_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_openssl_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$openssl_LIBS"; then
-    pkg_cv_openssl_LIBS="$openssl_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_openssl_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        openssl_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
-        else
-	        openssl_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$openssl_PKG_ERRORS" >&5
-
-
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-	openssl_CFLAGS=$pkg_cv_openssl_CFLAGS
-	openssl_LIBS=$pkg_cv_openssl_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	CPPFLAGS="${openssl_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${openssl_LIBS} ${LIBS}"
-                           have_ssl=yes
-fi
-    fi
-fi
-
-if test "x${have_ssl}" = xno; then
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "
-  ---------------------------------------------
-   The OpenSSL library that is required to
-   build git2r was not found.
-
-   Please install:
-     libssl-dev    (package on e.g. Debian and Ubuntu)
-     openssl-devel (package on e.g. Fedora, CentOS and RHEL)
-     openssl       (Homebrew package on OS X)
-   and try again.
-
-   If the OpenSSL library is installed on
-   your system but the git2r configuration
-   is unable to find it, you can specify
-   the include and lib path to OpenSSL with:
-   R CMD INSTALL --configure-args='--with-libssl-include=INCLUDE_PATH --with-libssl-lib=LIB_PATH' git2r
-  ---------------------------------------------
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-# Check for LibSSH2
-have_ssh2=no
-
-# Check for optional libssh2 include path
-if test  -n "$libssh2_include_path"  ; then
-    CPPFLAGS="-I${libssh2_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional libssh2 lib path
-if test  -n "$libssh2_lib_path"  ; then
-    LIBS="-L${libssh2_lib_path} ${LIBS}"
-fi
-
-case "${host_os}" in
-    darwin*)
-        # Save flags
-        oCPPFLAGS="${CPPFLAGS}"
-        oLIBS="${LIBS}"
-
-        # On OS X, try to find libssh2 in brew
-        if test "x${BREW}" = xyes; then
-            CPPFLAGS="${CPPFLAGS} -I${BREW_DIR}/opt/libssh2/include"
-            LIBS="${LIBS} -L${BREW_DIR}/opt/libssh2/lib"
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libssh2_version" >&5
-$as_echo_n "checking for library containing libssh2_version... " >&6; }
-if ${ac_cv_search_libssh2_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char libssh2_version ();
-int
-main ()
-{
-return libssh2_version ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' ssh2; 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 :
-  ac_cv_search_libssh2_version=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_libssh2_version+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_libssh2_version+:} false; then :
-
-else
-  ac_cv_search_libssh2_version=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_libssh2_version" >&5
-$as_echo "$ac_cv_search_libssh2_version" >&6; }
-ac_res=$ac_cv_search_libssh2_version
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  have_ssh2=yes
-fi
-
-        fi
-
-        if test "x${have_ssh2}" = xno; then
-            CPPFLAGS="${oCPPFLAGS}"
-            LIBS="${oLIBS}"
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Download and build libssh2" >&5
-$as_echo "$as_me: Download and build libssh2" >&6;}
-
-            mkdir -p libssh2 && \
-            curl -fsSL https://www.libssh2.org/download/libssh2-1.8.0.tar.gz | \
-            tar xz --strip 1 -C libssh2
-
-            mkdir -p src/libgit2/deps/libssh2
-            LIBSSH2_INST_DIR="${PWD}/src/libgit2/deps/libssh2"
-            cp -f tools/missing libssh2
-            cd libssh2
-            ./configure --with-pic --with-openssl --disable-examples-build \
-              --disable-shared --enable-static --prefix=$LIBSSH2_INST_DIR \
-              CC="${CC}" CFLAGS="${CFLAGS} ${CPICFLAGS} -Wno-deprecated-declarations" \
-              CPPFLAGS="${CPPFLAGS}" && make && make install && have_ssh2=yes
-            cd ..
-            rm -rf libssh2
-
-            if test "x${have_ssh2}" = xyes; then
-                LIBSSH2_CFLAGS="-Ilibgit2/deps/libssh2/include"
-                LIBSSH2_LIBS="-Llibgit2/deps/libssh2/lib -lssh2"
-            fi
-        fi
-    ;;
-    *)
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libssh2_version" >&5
-$as_echo_n "checking for library containing libssh2_version... " >&6; }
-if ${ac_cv_search_libssh2_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char libssh2_version ();
-int
-main ()
-{
-return libssh2_version ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' ssh2; 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 :
-  ac_cv_search_libssh2_version=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_libssh2_version+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_libssh2_version+:} false; then :
-
-else
-  ac_cv_search_libssh2_version=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_libssh2_version" >&5
-$as_echo "$ac_cv_search_libssh2_version" >&6; }
-ac_res=$ac_cv_search_libssh2_version
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  have_ssh2=yes
-fi
-
-    ;;
-esac
-
-if test "x${have_ssh2}" = xno; then
-    if test  -n "$PKG_CONFIG"  ; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2" >&5
-$as_echo_n "checking for libssh2... " >&6; }
-
-if test -n "$libssh2_CFLAGS"; then
-    pkg_cv_libssh2_CFLAGS="$libssh2_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libssh2") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_libssh2_CFLAGS=`$PKG_CONFIG --cflags "libssh2" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$libssh2_LIBS"; then
-    pkg_cv_libssh2_LIBS="$libssh2_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libssh2") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_libssh2_LIBS=`$PKG_CONFIG --libs "libssh2" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        libssh2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libssh2" 2>&1`
-        else
-	        libssh2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libssh2" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$libssh2_PKG_ERRORS" >&5
-
-
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-else
-	libssh2_CFLAGS=$pkg_cv_libssh2_CFLAGS
-	libssh2_LIBS=$pkg_cv_libssh2_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	CPPFLAGS="${libssh2_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${libssh2_LIBS} ${LIBS}"
-                           have_ssh2=yes
-fi
-    fi
-fi
-
-if test "x${have_ssh2}" = xno; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-  ---------------------------------------------
-   Unable to find the LibSSH2 library on this
-   system. Building a version without support
-   for SSH transport.
-
-   To build with SSH support, please install:
-     libssh2-1-dev (package on e.g. Debian and Ubuntu)
-     libssh2-devel (package on e.g. Fedora, CentOS and RHEL)
-     libssh2       (Homebrew package on OS X)
-   and try again.
-
-   If the LibSSH2 library is installed on
-   your system but the git2r configuration
-   is unable to find it, you can specify
-   the include and lib path to LibSSH2 with:
-   R CMD INSTALL --configure-args='--with-libssh2-include=INCLUDE_PATH --with-libssh2-lib=LIB_PATH' git2r
-  ---------------------------------------------" >&5
-$as_echo "$as_me: WARNING:
-  ---------------------------------------------
-   Unable to find the LibSSH2 library on this
-   system. Building a version without support
-   for SSH transport.
-
-   To build with SSH support, please install:
-     libssh2-1-dev (package on e.g. Debian and Ubuntu)
-     libssh2-devel (package on e.g. Fedora, CentOS and RHEL)
-     libssh2       (Homebrew package on OS X)
-   and try again.
-
-   If the LibSSH2 library is installed on
-   your system but the git2r configuration
-   is unable to find it, you can specify
-   the include and lib path to LibSSH2 with:
-   R CMD INSTALL --configure-args='--with-libssh2-include=INCLUDE_PATH --with-libssh2-lib=LIB_PATH' git2r
-  ---------------------------------------------" >&2;}
-fi
-
-# Check for iconv
-have_iconv=no
-case "${host_os}" in
-    darwin*)
-
-      if test "X$prefix" = "XNONE"; then
-    acl_final_prefix="$ac_default_prefix"
-  else
-    acl_final_prefix="$prefix"
-  fi
-  if test "X$exec_prefix" = "XNONE"; then
-    acl_final_exec_prefix='${prefix}'
-  else
-    acl_final_exec_prefix="$exec_prefix"
-  fi
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
-  prefix="$acl_save_prefix"
-
-
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
-else
-  with_gnu_ld=no
-fi
-
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
-  # contains only /bin. Note that ksh looks also at the FPATH variable,
-  # so we have to set that as well for the test.
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
-    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
-           || PATH_SEPARATOR=';'
-       }
-fi
-
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&6; }
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [\\/]* | ?:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
-      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
-        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if ${acl_cv_path_LD+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$LD"; then
-  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$acl_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      acl_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-        test "$with_gnu_ld" != no && break
-        ;;
-      *)
-        test "$with_gnu_ld" != yes && break
-        ;;
-      esac
-    fi
-  done
-  IFS="$acl_save_ifs"
-else
-  acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${acl_cv_prog_gnu_ld+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  acl_cv_prog_gnu_ld=yes
-  ;;
-*)
-  acl_cv_prog_gnu_ld=no
-  ;;
-esac
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
-$as_echo "$acl_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$acl_cv_prog_gnu_ld
-
-
-
-
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
-$as_echo_n "checking for shared library run path origin... " >&6; }
-if ${acl_cv_rpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
-    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
-    . ./conftest.sh
-    rm -f ./conftest.sh
-    acl_cv_rpath=done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
-$as_echo "$acl_cv_rpath" >&6; }
-  wl="$acl_cv_wl"
-  acl_libext="$acl_cv_libext"
-  acl_shlibext="$acl_cv_shlibext"
-  acl_libname_spec="$acl_cv_libname_spec"
-  acl_library_names_spec="$acl_cv_library_names_spec"
-  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-  acl_hardcode_direct="$acl_cv_hardcode_direct"
-  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
-    # Check whether --enable-rpath was given.
-if test "${enable_rpath+set}" = set; then :
-  enableval=$enable_rpath; :
-else
-  enable_rpath=yes
-fi
-
-
-
-
-  acl_libdirstem=lib
-  acl_libdirstem2=
-  case "$host_os" in
-    solaris*)
-                                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5
-$as_echo_n "checking for 64-bit host... " >&6; }
-if ${gl_cv_solaris_64bit+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#ifdef _LP64
-sixtyfour bits
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "sixtyfour bits" >/dev/null 2>&1; then :
-  gl_cv_solaris_64bit=yes
-else
-  gl_cv_solaris_64bit=no
-fi
-rm -f conftest*
-
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5
-$as_echo "$gl_cv_solaris_64bit" >&6; }
-      if test $gl_cv_solaris_64bit = yes; then
-        acl_libdirstem=lib/64
-        case "$host_cpu" in
-          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
-          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
-        esac
-      fi
-      ;;
-    *)
-      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
-      if test -n "$searchpath"; then
-        acl_save_IFS="${IFS= 	}"; IFS=":"
-        for searchdir in $searchpath; do
-          if test -d "$searchdir"; then
-            case "$searchdir" in
-              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
-              */../ | */.. )
-                # Better ignore directories of this form. They are misleading.
-                ;;
-              *) searchdir=`cd "$searchdir" && pwd`
-                 case "$searchdir" in
-                   */lib64 ) acl_libdirstem=lib64 ;;
-                 esac ;;
-            esac
-          fi
-        done
-        IFS="$acl_save_IFS"
-      fi
-      ;;
-  esac
-  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
-
-
-
-
-
-
-
-
-
-
-
-
-    use_additional=yes
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-
-# Check whether --with-libiconv-prefix was given.
-if test "${with_libiconv_prefix+set}" = set; then :
-  withval=$with_libiconv_prefix;
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/$acl_libdirstem"
-        if test "$acl_libdirstem2" != "$acl_libdirstem" \
-           && ! test -d "$withval/$acl_libdirstem"; then
-          additional_libdir="$withval/$acl_libdirstem2"
-        fi
-      fi
-    fi
-
-fi
-
-      LIBICONV=
-  LTLIBICONV=
-  INCICONV=
-  LIBICONV_PREFIX=
-      HAVE_LIBICONV=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='iconv '
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
-          else
-                                    :
-          fi
-        else
-                              found_dir=
-          found_la=
-          found_so=
-          found_a=
-          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
-          if test -n "$acl_shlibext"; then
-            shrext=".$acl_shlibext"             # typically: shrext=.so
-          else
-            shrext=
-          fi
-          if test $use_additional = yes; then
-            dir="$additional_libdir"
-                                    if test -n "$acl_shlibext"; then
-              if test -f "$dir/$libname$shrext"; then
-                found_dir="$dir"
-                found_so="$dir/$libname$shrext"
-              else
-                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-                  ver=`(cd "$dir" && \
-                        for f in "$libname$shrext".*; do echo "$f"; done \
-                        | sed -e "s,^$libname$shrext\\\\.,," \
-                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-                        | sed 1q ) 2>/dev/null`
-                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-                    found_dir="$dir"
-                    found_so="$dir/$libname$shrext.$ver"
-                  fi
-                else
-                  eval library_names=\"$acl_library_names_spec\"
-                  for f in $library_names; do
-                    if test -f "$dir/$f"; then
-                      found_dir="$dir"
-                      found_so="$dir/$f"
-                      break
-                    fi
-                  done
-                fi
-              fi
-            fi
-                        if test "X$found_dir" = "X"; then
-              if test -f "$dir/$libname.$acl_libext"; then
-                found_dir="$dir"
-                found_a="$dir/$libname.$acl_libext"
-              fi
-            fi
-            if test "X$found_dir" != "X"; then
-              if test -f "$dir/$libname.la"; then
-                found_la="$dir/$libname.la"
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIBICONV; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                                    if test -n "$acl_shlibext"; then
-                    if test -f "$dir/$libname$shrext"; then
-                      found_dir="$dir"
-                      found_so="$dir/$libname$shrext"
-                    else
-                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-                        ver=`(cd "$dir" && \
-                              for f in "$libname$shrext".*; do echo "$f"; done \
-                              | sed -e "s,^$libname$shrext\\\\.,," \
-                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-                              | sed 1q ) 2>/dev/null`
-                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-                          found_dir="$dir"
-                          found_so="$dir/$libname$shrext.$ver"
-                        fi
-                      else
-                        eval library_names=\"$acl_library_names_spec\"
-                        for f in $library_names; do
-                          if test -f "$dir/$f"; then
-                            found_dir="$dir"
-                            found_so="$dir/$f"
-                            break
-                          fi
-                        done
-                      fi
-                    fi
-                  fi
-                                    if test "X$found_dir" = "X"; then
-                    if test -f "$dir/$libname.$acl_libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/$libname.$acl_libext"
-                    fi
-                  fi
-                  if test "X$found_dir" != "X"; then
-                    if test -f "$dir/$libname.la"; then
-                      found_la="$dir/$libname.la"
-                    fi
-                  fi
-                  ;;
-              esac
-              if test "X$found_dir" != "X"; then
-                break
-              fi
-            done
-          fi
-          if test "X$found_dir" != "X"; then
-                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
-            if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no \
-                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
-                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
-                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
-              else
-                                                                                haveit=
-                for x in $ltrpathdirs; do
-                  if test "X$x" = "X$found_dir"; then
-                    haveit=yes
-                    break
-                  fi
-                done
-                if test -z "$haveit"; then
-                  ltrpathdirs="$ltrpathdirs $found_dir"
-                fi
-                                if test "$acl_hardcode_direct" = yes; then
-                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
-                else
-                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
-                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
-                                                            haveit=
-                    for x in $rpathdirs; do
-                      if test "X$x" = "X$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
-                    fi
-                  else
-                                                                                haveit=
-                    for x in $LDFLAGS $LIBICONV; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
-                    fi
-                    if test "$acl_hardcode_minus_L" != no; then
-                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
-                    else
-                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
-              else
-                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
-              fi
-            fi
-                        additional_includedir=
-            case "$found_dir" in
-              */$acl_libdirstem | */$acl_libdirstem/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
-                if test "$name" = 'iconv'; then
-                  LIBICONV_PREFIX="$basedir"
-                fi
-                additional_includedir="$basedir/include"
-                ;;
-              */$acl_libdirstem2 | */$acl_libdirstem2/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
-                if test "$name" = 'iconv'; then
-                  LIBICONV_PREFIX="$basedir"
-                fi
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCICONV; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-                        if test -n "$found_la"; then
-                                                        save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-                            for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
-                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
-                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIBICONV; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIBICONV; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                                                                  haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                                                                  haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
-                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
-            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$acl_hardcode_libdir_separator"; then
-                        alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
-      done
-            acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$acl_hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
-    else
-            for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$acl_hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-            for found_dir in $ltrpathdirs; do
-      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
-    done
-  fi
-
-
-
-
-
-
-
-
-
-
-
-
-          am_save_CPPFLAGS="$CPPFLAGS"
-
-  for element in $INCICONV; do
-    haveit=
-    for x in $CPPFLAGS; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
-    fi
-  done
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
-$as_echo_n "checking for iconv... " >&6; }
-if ${am_cv_func_iconv+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    am_cv_func_iconv="no, consider installing GNU libiconv"
-    am_cv_lib_iconv=no
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <stdlib.h>
-#include <iconv.h>
-
-int
-main ()
-{
-iconv_t cd = iconv_open("","");
-           iconv(cd,NULL,NULL,NULL,NULL);
-           iconv_close(cd);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  am_cv_func_iconv=yes
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    if test "$am_cv_func_iconv" != yes; then
-      am_save_LIBS="$LIBS"
-      LIBS="$LIBS $LIBICONV"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <stdlib.h>
-#include <iconv.h>
-
-int
-main ()
-{
-iconv_t cd = iconv_open("","");
-             iconv(cd,NULL,NULL,NULL,NULL);
-             iconv_close(cd);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-      LIBS="$am_save_LIBS"
-    fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
-$as_echo "$am_cv_func_iconv" >&6; }
-  if test "$am_cv_func_iconv" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5
-$as_echo_n "checking for working iconv... " >&6; }
-if ${am_cv_func_iconv_works+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-                  am_save_LIBS="$LIBS"
-      if test $am_cv_lib_iconv = yes; then
-        LIBS="$LIBS $LIBICONV"
-      fi
-      am_cv_func_iconv_works=no
-      for ac_iconv_const in '' 'const'; do
-        if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
-             *)            am_cv_func_iconv_works="guessing yes" ;;
-           esac
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <iconv.h>
-#include <string.h>
-
-#ifndef ICONV_CONST
-# define ICONV_CONST $ac_iconv_const
-#endif
-
-int
-main ()
-{
-int result = 0;
-  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
-     returns.  */
-  {
-    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
-    if (cd_utf8_to_88591 != (iconv_t)(-1))
-      {
-        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
-        char buf[10];
-        ICONV_CONST char *inptr = input;
-        size_t inbytesleft = strlen (input);
-        char *outptr = buf;
-        size_t outbytesleft = sizeof (buf);
-        size_t res = iconv (cd_utf8_to_88591,
-                            &inptr, &inbytesleft,
-                            &outptr, &outbytesleft);
-        if (res == 0)
-          result |= 1;
-        iconv_close (cd_utf8_to_88591);
-      }
-  }
-  /* Test against Solaris 10 bug: Failures are not distinguishable from
-     successful returns.  */
-  {
-    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
-    if (cd_ascii_to_88591 != (iconv_t)(-1))
-      {
-        static ICONV_CONST char input[] = "\263";
-        char buf[10];
-        ICONV_CONST char *inptr = input;
-        size_t inbytesleft = strlen (input);
-        char *outptr = buf;
-        size_t outbytesleft = sizeof (buf);
-        size_t res = iconv (cd_ascii_to_88591,
-                            &inptr, &inbytesleft,
-                            &outptr, &outbytesleft);
-        if (res == 0)
-          result |= 2;
-        iconv_close (cd_ascii_to_88591);
-      }
-  }
-  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
-  {
-    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
-    if (cd_88591_to_utf8 != (iconv_t)(-1))
-      {
-        static ICONV_CONST char input[] = "\304";
-        static char buf[2] = { (char)0xDE, (char)0xAD };
-        ICONV_CONST char *inptr = input;
-        size_t inbytesleft = 1;
-        char *outptr = buf;
-        size_t outbytesleft = 1;
-        size_t res = iconv (cd_88591_to_utf8,
-                            &inptr, &inbytesleft,
-                            &outptr, &outbytesleft);
-        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
-          result |= 4;
-        iconv_close (cd_88591_to_utf8);
-      }
-  }
-#if 0 /* This bug could be worked around by the caller.  */
-  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
-  {
-    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
-    if (cd_88591_to_utf8 != (iconv_t)(-1))
-      {
-        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-        char buf[50];
-        ICONV_CONST char *inptr = input;
-        size_t inbytesleft = strlen (input);
-        char *outptr = buf;
-        size_t outbytesleft = sizeof (buf);
-        size_t res = iconv (cd_88591_to_utf8,
-                            &inptr, &inbytesleft,
-                            &outptr, &outbytesleft);
-        if ((int)res > 0)
-          result |= 8;
-        iconv_close (cd_88591_to_utf8);
-      }
-  }
-#endif
-  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
-     provided.  */
-  if (/* Try standardized names.  */
-      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
-      /* Try IRIX, OSF/1 names.  */
-      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
-      /* Try AIX names.  */
-      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
-      /* Try HP-UX names.  */
-      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
-    result |= 16;
-  return result;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  am_cv_func_iconv_works=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-        test "$am_cv_func_iconv_works" = no || break
-      done
-      LIBS="$am_save_LIBS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5
-$as_echo "$am_cv_func_iconv_works" >&6; }
-    case "$am_cv_func_iconv_works" in
-      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
-      *)   am_func_iconv=yes ;;
-    esac
-  else
-    am_func_iconv=no am_cv_lib_iconv=no
-  fi
-  if test "$am_func_iconv" = yes; then
-
-$as_echo "#define HAVE_ICONV 1" >>confdefs.h
-
-  fi
-  if test "$am_cv_lib_iconv" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
-$as_echo_n "checking how to link with libiconv... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
-$as_echo "$LIBICONV" >&6; }
-  else
-            CPPFLAGS="$am_save_CPPFLAGS"
-    LIBICONV=
-    LTLIBICONV=
-  fi
-
-
-
-  if test "$am_cv_func_iconv" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5
-$as_echo_n "checking for iconv declaration... " >&6; }
-    if ${am_cv_proto_iconv+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  am_cv_proto_iconv_arg1=""
-else
-  am_cv_proto_iconv_arg1="const"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
-fi
-
-    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result:
-         $am_cv_proto_iconv" >&5
-$as_echo "
-         $am_cv_proto_iconv" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define ICONV_CONST $am_cv_proto_iconv_arg1
-_ACEOF
-
-
-  fi
-
-        if test "x${am_cv_func_iconv}" = xyes; then
-            have_iconv=yes
-        fi
-    ;;
-esac
-
-# Check for libcurl
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Check whether --with-libcurl was given.
-if test "${with_libcurl+set}" = set; then :
-  withval=$with_libcurl; _libcurl_with=$withval
-else
-  _libcurl_with=yes
-fi
-
-
-  if test "$_libcurl_with" != "no" ; then
-
-     for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-
-     _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[1]+256*A[2]+A[3]; print X;}'"
-
-     _libcurl_try_link=yes
-
-     if test -d "$_libcurl_with" ; then
-        LIBCURL_CPPFLAGS="-I$withval/include"
-        _libcurl_ldflags="-L$withval/lib"
-        # Extract the first word of "curl-config", so it can be a program name with args.
-set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path__libcurl_config+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $_libcurl_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in "$withval/bin"
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-_libcurl_config=$ac_cv_path__libcurl_config
-if test -n "$_libcurl_config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
-$as_echo "$_libcurl_config" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-     else
-        # Extract the first word of "curl-config", so it can be a program name with args.
-set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path__libcurl_config+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $_libcurl_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-_libcurl_config=$ac_cv_path__libcurl_config
-if test -n "$_libcurl_config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
-$as_echo "$_libcurl_config" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-     fi
-
-     if test x$_libcurl_config != "x" ; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5
-$as_echo_n "checking for the version of libcurl... " >&6; }
-if ${libcurl_cv_lib_curl_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_version" >&5
-$as_echo "$libcurl_cv_lib_curl_version" >&6; }
-
-        _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
-        _libcurl_wanted=`echo 0 | $_libcurl_version_parse`
-
-        if test $_libcurl_wanted -gt 0 ; then
-           { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version " >&5
-$as_echo_n "checking for libcurl >= version ... " >&6; }
-if ${libcurl_cv_lib_version_ok+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-              if test $_libcurl_version -ge $_libcurl_wanted ; then
-                 libcurl_cv_lib_version_ok=yes
-              else
-                 libcurl_cv_lib_version_ok=no
-              fi
-
+ else
+    pkg_failed=untried
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_version_ok" >&5
-$as_echo "$libcurl_cv_lib_version_ok" >&6; }
-        fi
-
-        if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
-           if test x"$LIBCURL_CPPFLAGS" = "x" ; then
-              LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
-           fi
-           if test x"$LIBCURL" = "x" ; then
-              LIBCURL=`$_libcurl_config --libs`
-
-              # This is so silly, but Apple actually has a bug in their
-              # curl-config script.  Fixed in Tiger, but there are still
-              # lots of Panther installs around.
-              case "${host}" in
-                 powerpc-apple-darwin7*)
-                    LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
-                 ;;
-              esac
-           fi
-
-           # All curl-config scripts support --feature
-           _libcurl_features=`$_libcurl_config --feature`
-
-           # Is it modern enough to have --protocols? (7.12.4)
-           if test $_libcurl_version -ge 461828 ; then
-              _libcurl_protocols=`$_libcurl_config --protocols`
-           fi
-        else
-           _libcurl_try_link=no
-        fi
-
-        unset _libcurl_wanted
-     fi
-
-     if test $_libcurl_try_link = yes ; then
-
-        # we didn't find curl-config, so let's see if the user-supplied
-        # link line (or failing that, "-lcurl") is enough.
-        LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5
-$as_echo_n "checking whether libcurl is usable... " >&6; }
-if ${libcurl_cv_lib_curl_usable+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-           _libcurl_save_cppflags=$CPPFLAGS
-           CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
-           _libcurl_save_libs=$LIBS
-           LIBS="$LIBCURL $LIBS"
-
-           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <curl/curl.h>
-int
-main ()
-{
-
-/* Try and use a few common options to force a failure if we are
-   missing symbols or can't link. */
-int x;
-curl_easy_setopt(NULL,CURLOPT_URL,NULL);
-x=CURL_ERROR_SIZE;
-x=CURLOPT_WRITEFUNCTION;
-x=CURLOPT_WRITEDATA;
-x=CURLOPT_ERRORBUFFER;
-x=CURLOPT_STDERR;
-x=CURLOPT_VERBOSE;
-if (x) {;}
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  libcurl_cv_lib_curl_usable=yes
+if test -n "$libgit2_LIBS"; then
+    pkg_cv_libgit2_LIBS="$libgit2_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libgit2 >= 0.26.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libgit2 >= 0.26.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_libgit2_LIBS=`$PKG_CONFIG --libs "libgit2 >= 0.26.0" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
-  libcurl_cv_lib_curl_usable=no
+  pkg_failed=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-
-           CPPFLAGS=$_libcurl_save_cppflags
-           LIBS=$_libcurl_save_libs
-           unset _libcurl_save_cppflags
-           unset _libcurl_save_libs
-
+ else
+    pkg_failed=untried
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_usable" >&5
-$as_echo "$libcurl_cv_lib_curl_usable" >&6; }
-
-        if test $libcurl_cv_lib_curl_usable = yes ; then
 
-           # Does curl_free() exist in this version of libcurl?
-           # If not, fake it with free()
 
-           _libcurl_save_cppflags=$CPPFLAGS
-           CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
-           _libcurl_save_libs=$LIBS
-           LIBS="$LIBS $LIBCURL"
 
-           ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free"
-if test "x$ac_cv_func_curl_free" = xyes; then :
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-
-$as_echo "#define curl_free free" >>confdefs.h
-
+        _pkg_short_errors_supported=no
 fi
-
-
-           CPPFLAGS=$_libcurl_save_cppflags
-           LIBS=$_libcurl_save_libs
-           unset _libcurl_save_cppflags
-           unset _libcurl_save_libs
-
-
-$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h
-
-
-
-
-           for _libcurl_feature in $_libcurl_features ; do
-              cat >>confdefs.h <<_ACEOF
-#define `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1
-_ACEOF
-
-              eval `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes
-           done
-
-           if test "x$_libcurl_protocols" = "x" ; then
-
-              # We don't have --protocols, so just assume that all
-              # protocols are available
-              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
-
-              if test x$libcurl_feature_SSL = xyes ; then
-                 _libcurl_protocols="$_libcurl_protocols HTTPS"
-
-                 # FTPS wasn't standards-compliant until version
-                 # 7.11.0 (0x070b00 == 461568)
-                 if test $_libcurl_version -ge 461568; then
-                    _libcurl_protocols="$_libcurl_protocols FTPS"
-                 fi
-              fi
-
-              # RTSP, IMAP, POP3 and SMTP were added in
-              # 7.20.0 (0x071400 == 463872)
-              if test $_libcurl_version -ge 463872; then
-                 _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
-              fi
-           fi
-
-           for _libcurl_protocol in $_libcurl_protocols ; do
-              cat >>confdefs.h <<_ACEOF
-#define `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1
-_ACEOF
-
-              eval `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes
-           done
+        if test $_pkg_short_errors_supported = yes; then
+	        libgit2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libgit2 >= 0.26.0" 2>&1`
         else
-           unset LIBCURL
-           unset LIBCURL_CPPFLAGS
+	        libgit2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libgit2 >= 0.26.0" 2>&1`
         fi
-     fi
-
-     unset _libcurl_try_link
-     unset _libcurl_version_parse
-     unset _libcurl_config
-     unset _libcurl_feature
-     unset _libcurl_features
-     unset _libcurl_protocol
-     unset _libcurl_protocols
-     unset _libcurl_version
-     unset _libcurl_ldflags
-  fi
-
-  if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
-     # This is the IF-NO path
-     have_libcurl=no
-  else
-     # This is the IF-YES path
-     have_libcurl=yes
-  fi
-
-  unset _libcurl_with
-
-
-# Configuration specific for solaris
-case "${host_os}" in
-    solaris*)
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5
-$as_echo_n "checking for library containing connect... " >&6; }
-if ${ac_cv_search_connect+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+	# Put the nasty error message in config.log where it belongs
+	echo "$libgit2_PKG_ERRORS" >&5
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char connect ();
-int
-main ()
-{
-return connect ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' socket; 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 :
-  ac_cv_search_connect=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_connect+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_connect+:} false; then :
+	as_fn_error $? "Package requirements (libgit2 >= 0.26.0) were not met:
 
-else
-  ac_cv_search_connect=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5
-$as_echo "$ac_cv_search_connect" >&6; }
-ac_res=$ac_cv_search_connect
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+$libgit2_PKG_ERRORS
 
-fi
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
-$as_echo_n "checking for library containing gethostbyname... " >&6; }
-if ${ac_cv_search_gethostbyname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+Alternatively, you may set the environment variables libgit2_CFLAGS
+and libgit2_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' nsl socket; 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 :
-  ac_cv_search_gethostbyname=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_gethostbyname+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_gethostbyname+:} false; then :
+Alternatively, you may set the environment variables libgit2_CFLAGS
+and libgit2_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
 else
-  ac_cv_search_gethostbyname=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
+	libgit2_CFLAGS=$pkg_cv_libgit2_CFLAGS
+	libgit2_LIBS=$pkg_cv_libgit2_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	CPPFLAGS="${libgit2_CFLAGS} ${CPPFLAGS}"
+                  LIBS="${libgit2_LIBS} ${LIBS}"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5
-$as_echo "$ac_cv_search_gethostbyname" >&6; }
-ac_res=$ac_cv_search_gethostbyname
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+# Find the compiler and compiler flags to use
+: ${R_HOME=`R RHOME`}
+if test -z "${R_HOME}"; then
+  echo "could not determine R_HOME"
+  exit 1
 fi
-
-
-        # Include and use regex on solaris
-        CPPFLAGS="-Ilibgit2/deps/regex ${CPPFLAGS}"
-        GIT2R_SRC_REGEX=libgit2/deps/regex/regex.o
-    ;;
-esac
+RBIN="${R_HOME}/bin/R"
+CC=`"${RBIN}" CMD config CC`
+CFLAGS=`"${RBIN}" CMD config CFLAGS`
+CPPFLAGS=`"${RBIN}" CMD config CPPFLAGS`
+CPICFLAGS=`"${RBIN}" CMD config CPICFLAGS`
 
 # Add include paths for git2r
-CPPFLAGS="-I. -Ilibgit2/src -Ilibgit2/include -Ilibgit2/deps/http-parser ${CPPFLAGS}"
+CPPFLAGS="-I. ${CPPFLAGS}"
 
 # Add definitions
-CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DGIT_OPENSSL -DLIBGIT2_NO_FEATURES_H"
-
-# Specify sha1 implementation
-case "${host_os}" in
-    darwin*)
-        PKG_CFLAGS="-Wno-deprecated-declarations"
-        CPPFLAGS="${CPPFLAGS} -DGIT_SHA1_COMMON_CRYPTO"
-    ;;
-    *)
-        CPPFLAGS="${CPPFLAGS} -DGIT_SHA1_OPENSSL"
-    ;;
-esac
-
-# Add definition for ssh
-if test "x${have_ssh2}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_SSH"
-fi
-
-# Add definition for curl
-if test "x${have_libcurl}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_CURL"
-fi
-
-# Add definition for iconv
-if test "x${have_iconv}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_USE_ICONV"
-fi
-
-# Add definitions specific for solaris
-case "${host_os}" in
-    solaris*)
-        CPPFLAGS="${CPPFLAGS} -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
-    ;;
-esac
-
-# Checks for structures
-ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "#ifdef HAVE_SYS_TYPES_H
-                 # include <sys/types.h>
-                 #endif
-                 #ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif
-"
-if test "x$ac_cv_member_struct_stat_st_mtim" = xyes; then :
-  CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIM"
-fi
-
-
-ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec" "ac_cv_member_struct_stat_st_mtimespec" "#ifdef HAVE_SYS_TYPES_H
-                 # include <sys/types.h>
-                 #endif
-                 #ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif
-"
-if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes; then :
-  CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIMESPEC"
-fi
-
-
-ac_fn_c_check_member "$LINENO" "struct stat" "st_mtime_nsec" "ac_cv_member_struct_stat_st_mtime_nsec" "#ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif
-"
-if test "x$ac_cv_member_struct_stat_st_mtime_nsec" = xyes; then :
-  CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIME_NSEC"
-fi
-
-
-if test "x$ac_cv_member_struct_stat_st_mtim" = "xyes"; then
-    ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.tv_nsec" "ac_cv_member_struct_stat_st_mtim_tv_nsec" "#ifdef HAVE_SYS_STAT_H
-                     # include <sys/stat.h>
-                     #endif
-"
-if test "x$ac_cv_member_struct_stat_st_mtim_tv_nsec" = xyes; then :
-  CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"
-fi
-
-elif test "x$ac_cv_member_struct_stat_st_mtimespec" = "xyes"; then
-    ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec.tv_nsec" "ac_cv_member_struct_stat_st_mtimespec_tv_nsec" "#ifdef HAVE_SYS_STAT_H
-                     # include <sys/stat.h>
-                     #endif
-"
-if test "x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec" = xyes; then :
-  CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"
-fi
-
-else
-    CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"
-fi
-
-# Checks for library functions.
-for ac_func in futimens qsort_r qsort_s
-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
-
-fi
-done
-
-
-if test $ac_cv_func_futimens = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_FUTIMENS"
-fi
-
-if test $ac_cv_func_qsort_r = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_QSORT_R"
-fi
-
-if test $ac_cv_func_qsort_s = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_QSORT_S"
-fi
-
+CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
 
-PKG_CFLAGS="${PKG_CFLAGS} ${LIBSSH2_CFLAGS}"
+PKG_CFLAGS="${PKG_CFLAGS}"
 
-PKG_CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
+PKG_CPPFLAGS="${CPPFLAGS}"
 
-PKG_LIBS="${LIBS} ${LIBSSH2_LIBS} ${LIBCURL} ${LIBICONV}"
+PKG_LIBS="${LIBS}"
 
 
 ac_config_files="$ac_config_files src/Makevars"
 
 
-echo "
-  ----- Results of the git2r package configure -----
-
-    OpenSSL to talk over HTTPS...........: ${have_ssl}
-    LibSSH2 to enable the SSH transport..: ${have_ssh2}
-
-  --------------------------------------------------
-"
-
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -6984,7 +3503,6 @@ gives unlimited permission to copy, distribute and modify it."
 
 ac_pwd='$ac_pwd'
 srcdir='$srcdir'
-AWK='$AWK'
 test -n "\$AWK" || AWK=awk
 _ACEOF
 
diff --git a/configure.ac b/configure.ac
index cf12ec68..4ce34cf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,60 +18,18 @@ AC_PREREQ([2.69])
 AC_INIT([git2r], [see.DESCRIPTION.file], [https://github.com/ropensci/git2r/issues])
 AC_CONFIG_SRCDIR([src/git2r.c])
 AC_CONFIG_AUX_DIR([tools])
-m4_include([tools/libcurl.m4])
 AC_CANONICAL_HOST
 
 # Checks for programs.
 AC_PROG_CC
 
-## check for brew on OS X
-AC_DEFUN([AC_PROG_BREW], [AC_CHECK_PROG(BREW,brew,yes)])
-case "${host_os}" in
-    darwin*)
-        AC_PROG_BREW
-        if test "x${BREW}" = xyes; then
-            BREW_DIR=`brew --prefix`
-        fi
-    ;;
-esac
-
 # Check for pkg-config
 PKG_PROG_PKG_CONFIG
 
-# Optional include and library paths
-
-# zlib include and library path
-AC_ARG_WITH([zlib-include],
-            AC_HELP_STRING([--with-zlib-include=INCLUDE_PATH],
-                           [the location of the zlib header files]),
-            [zlib_include_path=$withval])
-
-AC_ARG_WITH([zlib-lib],
-            AC_HELP_STRING([--with-zlib-lib=LIB_PATH],
-                           [the location of the zlib library]),
-            [zlib_lib_path=$withval])
-
-# LibSSH2 include and library path
-AC_ARG_WITH([libssh2-include],
-            AC_HELP_STRING([--with-libssh2-include=INCLUDE_PATH],
-                           [the location of the LibSSH2 header files]),
-            [libssh2_include_path=$withval])
-
-AC_ARG_WITH([libssh2-lib],
-            AC_HELP_STRING([--with-libssh2-lib=LIB_PATH],
-                           [the location of the LibSSH2 library]),
-            [libssh2_lib_path=$withval])
-
-# libssl include and library path
-AC_ARG_WITH([libssl-include],
-            AC_HELP_STRING([--with-libssl-include=INCLUDE_PATH],
-                           [the location of the libssl header files]),
-            [libssl_include_path=$withval])
-
-AC_ARG_WITH([libssl-lib],
-            AC_HELP_STRING([--with-libssl-lib=LIB_PATH],
-                           [the location of the libssl library]),
-            [libssl_lib_path=$withval])
+# Check for libgit2
+PKG_CHECK_MODULES([libgit2], [libgit2 >= 0.26.0],
+                  [CPPFLAGS="${libgit2_CFLAGS} ${CPPFLAGS}"
+                  LIBS="${libgit2_LIBS} ${LIBS}"])
 
 # Find the compiler and compiler flags to use
 : ${R_HOME=`R RHOME`}
@@ -85,357 +43,16 @@ CFLAGS=`"${RBIN}" CMD config CFLAGS`
 CPPFLAGS=`"${RBIN}" CMD config CPPFLAGS`
 CPICFLAGS=`"${RBIN}" CMD config CPICFLAGS`
 
-# Determine architecture of the machine
-AC_CHECK_SIZEOF([void*])
-if test "x$ac_cv_sizeof_voidp" = "x8"; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_64"
-elif test "x$ac_cv_sizeof_voidp" = "x4"; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_32"
-else
-    AC_MSG_CHECKING([size of void*])
-    sizeof_voidp=`"${RBIN}" --slave -e "cat(.Machine\\$sizeof.pointer)"`
-    AC_MSG_RESULT([$sizeof_voidp])
-    if test "x$sizeof_voidp" = "x8"; then
-        CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_64"
-    elif test "x$sizeof_voidp" = "x4"; then
-        CPPFLAGS="${CPPFLAGS} -DGIT_ARCH_32"
-    else
-        AC_MSG_FAILURE([Unsupported architecture])
-    fi
-fi
-
-# Check for zlib
-have_zlib=no
-
-# Check for optional zlib include path
-if test [ -n "$zlib_include_path" ] ; then
-    CPPFLAGS="-I${zlib_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional zlib lib path
-if test [ -n "$zlib_lib_path" ] ; then
-    LIBS="-L${zlib_lib_path} ${LIBS}"
-fi
-
-AC_SEARCH_LIBS([inflate], [z], [have_zlib=yes])
-
-if test "x${have_zlib}" = xno; then
-    if test [ -n "$PKG_CONFIG" ] ; then
-        PKG_CHECK_MODULES([zlib], [zlib],
-                          [CPPFLAGS="${zlib_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${zlib_LIBS} ${LIBS}"
-                           have_zlib=yes], [ ])
-    fi
-fi
-
-if test "x${have_zlib}" = xno; then
-        AC_MSG_FAILURE([
-  ---------------------------------------------
-   The zlib library that is required to build
-   git2r was not found.
-
-   Please install:
-     zlib1g-dev (package on e.g. Debian and Ubuntu)
-     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
-   and try again.
-
-   If the zlib library is installed on your
-   system but the git2r configuration is
-   unable to find it, you can specify the
-   include and lib path to zlib with:
-   R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
-  ---------------------------------------------])
-fi
-
-# Check for SSL
-have_ssl=no
-
-# Check for optional libssl include path
-if test [ -n "$libssl_include_path" ] ; then
-    CPPFLAGS="-I${libssl_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional libssl lib path
-if test [ -n "$libssl_lib_path" ] ; then
-    LIBS="-L${libssl_lib_path} ${LIBS}"
-fi
-
-if test "x${OPENSSL_INCLUDES}" = x; then :; else
-    CPPFLAGS="${CPPFLAGS} -I${OPENSSL_INCLUDES}"
-fi
-
-# On OS X, add path to libssl in brew
-case "${host_os}" in
-    darwin*)
-        if test "x${BREW}" = xyes; then
-            CPPFLAGS="${CPPFLAGS} -I${BREW_DIR}/opt/openssl/include"
-            LIBS="${LIBS} -L${BREW_DIR}/opt/openssl/lib"
-        fi
-    ;;
-esac
-
-AC_SEARCH_LIBS([EVP_EncryptInit],
-               [crypto],
-               [AC_SEARCH_LIBS([SSL_library_init], [ssl], [have_ssl=yes])
-                AC_SEARCH_LIBS([OPENSSL_init_ssl], [ssl], [have_ssl=yes])])
-
-if test "x${have_ssl}" = xno; then
-    if test [ -n "$PKG_CONFIG" ] ; then
-        PKG_CHECK_MODULES([openssl], [openssl],
-                          [CPPFLAGS="${openssl_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${openssl_LIBS} ${LIBS}"
-                           have_ssl=yes], [ ])
-    fi
-fi
-
-if test "x${have_ssl}" = xno; then
-    AC_MSG_FAILURE([
-  ---------------------------------------------
-   The OpenSSL library that is required to
-   build git2r was not found.
-
-   Please install:
-     libssl-dev    (package on e.g. Debian and Ubuntu)
-     openssl-devel (package on e.g. Fedora, CentOS and RHEL)
-     openssl       (Homebrew package on OS X)
-   and try again.
-
-   If the OpenSSL library is installed on
-   your system but the git2r configuration
-   is unable to find it, you can specify
-   the include and lib path to OpenSSL with:
-   R CMD INSTALL --configure-args='--with-libssl-include=INCLUDE_PATH --with-libssl-lib=LIB_PATH' git2r
-  ---------------------------------------------])
-fi
-
-# Check for LibSSH2
-have_ssh2=no
-
-# Check for optional libssh2 include path
-if test [ -n "$libssh2_include_path" ] ; then
-    CPPFLAGS="-I${libssh2_include_path} ${CPPFLAGS}"
-fi
-
-# Check for optional libssh2 lib path
-if test [ -n "$libssh2_lib_path" ] ; then
-    LIBS="-L${libssh2_lib_path} ${LIBS}"
-fi
-
-case "${host_os}" in
-    darwin*)
-        # Save flags
-        oCPPFLAGS="${CPPFLAGS}"
-        oLIBS="${LIBS}"
-
-        # On OS X, try to find libssh2 in brew
-        if test "x${BREW}" = xyes; then
-            CPPFLAGS="${CPPFLAGS} -I${BREW_DIR}/opt/libssh2/include"
-            LIBS="${LIBS} -L${BREW_DIR}/opt/libssh2/lib"
-            AC_SEARCH_LIBS([libssh2_version], [ssh2], [have_ssh2=yes])
-        fi
-
-        if test "x${have_ssh2}" = xno; then
-            CPPFLAGS="${oCPPFLAGS}"
-            LIBS="${oLIBS}"
-
-            AC_MSG_NOTICE([Download and build libssh2])
-
-            mkdir -p libssh2 && \
-            curl -fsSL https://www.libssh2.org/download/libssh2-1.8.0.tar.gz | \
-            tar xz --strip 1 -C libssh2
-
-            mkdir -p src/libgit2/deps/libssh2
-            LIBSSH2_INST_DIR="${PWD}/src/libgit2/deps/libssh2"
-            cp -f tools/missing libssh2
-            cd libssh2
-            ./configure --with-pic --with-openssl --disable-examples-build \
-              --disable-shared --enable-static --prefix=$LIBSSH2_INST_DIR \
-              CC="${CC}" CFLAGS="${CFLAGS} ${CPICFLAGS} -Wno-deprecated-declarations" \
-              CPPFLAGS="${CPPFLAGS}" && make && make install && have_ssh2=yes
-            cd ..
-            rm -rf libssh2
-
-            if test "x${have_ssh2}" = xyes; then
-                LIBSSH2_CFLAGS="-Ilibgit2/deps/libssh2/include"
-                LIBSSH2_LIBS="-Llibgit2/deps/libssh2/lib -lssh2"
-            fi
-        fi
-    ;;
-    *)
-        AC_SEARCH_LIBS([libssh2_version], [ssh2], [have_ssh2=yes])
-    ;;
-esac
-
-if test "x${have_ssh2}" = xno; then
-    if test [ -n "$PKG_CONFIG" ] ; then
-        PKG_CHECK_MODULES([libssh2], [libssh2],
-                          [CPPFLAGS="${libssh2_CFLAGS} ${CPPFLAGS}"
-                           LIBS="${libssh2_LIBS} ${LIBS}"
-                           have_ssh2=yes], [ ])
-    fi
-fi
-
-if test "x${have_ssh2}" = xno; then
-    AC_MSG_WARN([
-  ---------------------------------------------
-   Unable to find the LibSSH2 library on this
-   system. Building a version without support
-   for SSH transport.
-
-   To build with SSH support, please install:
-     libssh2-1-dev (package on e.g. Debian and Ubuntu)
-     libssh2-devel (package on e.g. Fedora, CentOS and RHEL)
-     libssh2       (Homebrew package on OS X)
-   and try again.
-
-   If the LibSSH2 library is installed on
-   your system but the git2r configuration
-   is unable to find it, you can specify
-   the include and lib path to LibSSH2 with:
-   R CMD INSTALL --configure-args='--with-libssh2-include=INCLUDE_PATH --with-libssh2-lib=LIB_PATH' git2r
-  ---------------------------------------------])
-fi
-
-# Check for iconv
-have_iconv=no
-case "${host_os}" in
-    darwin*)
-        AM_ICONV
-        if test "x${am_cv_func_iconv}" = xyes; then
-            have_iconv=yes
-        fi
-    ;;
-esac
-
-# Check for libcurl
-LIBCURL_CHECK_CONFIG(, , [have_libcurl=yes], [have_libcurl=no])
-
-# Configuration specific for solaris
-case "${host_os}" in
-    solaris*)
-        AC_SEARCH_LIBS(connect, [socket])
-        AC_SEARCH_LIBS(gethostbyname, [nsl socket])
-
-        # Include and use regex on solaris
-        CPPFLAGS="-Ilibgit2/deps/regex ${CPPFLAGS}"
-        GIT2R_SRC_REGEX=libgit2/deps/regex/regex.o
-    ;;
-esac
-
 # Add include paths for git2r
-CPPFLAGS="-I. -Ilibgit2/src -Ilibgit2/include -Ilibgit2/deps/http-parser ${CPPFLAGS}"
+CPPFLAGS="-I. ${CPPFLAGS}"
 
 # Add definitions
-CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DGIT_OPENSSL -DLIBGIT2_NO_FEATURES_H"
-
-# Specify sha1 implementation
-case "${host_os}" in
-    darwin*)
-        PKG_CFLAGS="-Wno-deprecated-declarations"
-        CPPFLAGS="${CPPFLAGS} -DGIT_SHA1_COMMON_CRYPTO"
-    ;;
-    *)
-        CPPFLAGS="${CPPFLAGS} -DGIT_SHA1_OPENSSL"
-    ;;
-esac
-
-# Add definition for ssh
-if test "x${have_ssh2}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_SSH"
-fi
+CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
 
-# Add definition for curl
-if test "x${have_libcurl}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_CURL"
-fi
-
-# Add definition for iconv
-if test "x${have_iconv}" = xyes; then
-    CPPFLAGS="${CPPFLAGS} -DGIT_USE_ICONV"
-fi
-
-# Add definitions specific for solaris
-case "${host_os}" in
-    solaris*)
-        CPPFLAGS="${CPPFLAGS} -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
-    ;;
-esac
-
-# Checks for structures
-AC_CHECK_MEMBER([struct stat.st_mtim],
-                [CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIM"],
-                [],
-                [#ifdef HAVE_SYS_TYPES_H
-                 # include <sys/types.h>
-                 #endif
-                 #ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif])
-
-AC_CHECK_MEMBER([struct stat.st_mtimespec],
-                [CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIMESPEC"],
-                [],
-                [#ifdef HAVE_SYS_TYPES_H
-                 # include <sys/types.h>
-                 #endif
-                 #ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif])
-
-AC_CHECK_MEMBER([struct stat.st_mtime_nsec],
-                [CPPFLAGS="${CPPFLAGS} -DGIT_USE_STAT_MTIME_NSEC"],
-                [],
-                [#ifdef HAVE_SYS_STAT_H
-                 # include <sys/stat.h>
-                 #endif])
-
-if test "x$ac_cv_member_struct_stat_st_mtim" = "xyes"; then
-    AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec],
-                    [CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"],
-                    [],
-                    [#ifdef HAVE_SYS_STAT_H
-                     # include <sys/stat.h>
-                     #endif])
-elif test "x$ac_cv_member_struct_stat_st_mtimespec" = "xyes"; then
-    AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec],
-                    [CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"],
-                    [],
-                    [#ifdef HAVE_SYS_STAT_H
-                     # include <sys/stat.h>
-                     #endif])
-else
-    CPPFLAGS="${CPPFLAGS} -DGIT_USE_NSEC"
-fi
-
-# Checks for library functions.
-AC_CHECK_FUNCS([futimens qsort_r qsort_s])
-
-if test $ac_cv_func_futimens = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_FUTIMENS"
-fi
-
-if test $ac_cv_func_qsort_r = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_QSORT_R"
-fi
-
-if test $ac_cv_func_qsort_s = yes; then
-    CPPFLAGS="${CPPFLAGS} -DHAVE_QSORT_S"
-fi
-
-AC_SUBST(GIT2R_SRC_REGEX)
-AC_SUBST([PKG_CFLAGS], ["${PKG_CFLAGS} ${LIBSSH2_CFLAGS}"])
-AC_SUBST([PKG_CPPFLAGS], ["${CPPFLAGS} ${LIBCURL_CPPFLAGS}"])
-AC_SUBST([PKG_LIBS], ["${LIBS} ${LIBSSH2_LIBS} ${LIBCURL} ${LIBICONV}"])
+AC_SUBST([PKG_CFLAGS], ["${PKG_CFLAGS}"])
+AC_SUBST([PKG_CPPFLAGS], ["${CPPFLAGS}"])
+AC_SUBST([PKG_LIBS], ["${LIBS}"])
 
 AC_CONFIG_FILES([src/Makevars])
 
-echo "
-  ----- Results of the git2r package configure -----
-
-    OpenSSL to talk over HTTPS...........: ${have_ssl}
-    LibSSH2 to enable the SSH transport..: ${have_ssh2}
-
-  --------------------------------------------------
-"
-
 AC_OUTPUT
diff --git a/src/Makevars.in b/src/Makevars.in
index 429ad1e2..4baf4f6c 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -2,70 +2,12 @@
 
 PKG_CFLAGS = @PKG_CFLAGS@
 PKG_CPPFLAGS = @PKG_CPPFLAGS@
-PKG_LIBS = -L. -lmygit @PKG_LIBS@
+PKG_LIBS = @PKG_LIBS@
 
-OBJECTS.libgit2 = libgit2/src/annotated_commit.o libgit2/src/apply.o libgit2/src/attr_file.o \
-    libgit2/src/attr.o libgit2/src/attrcache.o libgit2/src/blame_git.o \
-    libgit2/src/blame.o libgit2/src/blob.o libgit2/src/branch.o \
-    libgit2/src/buf_text.o libgit2/src/buffer.o libgit2/src/cache.o \
-    libgit2/src/checkout.o libgit2/src/cherrypick.o libgit2/src/clone.o \
-    libgit2/src/commit_list.o libgit2/src/commit.o libgit2/src/config_cache.o \
-    libgit2/src/config_file.o libgit2/src/config.o libgit2/src/crlf.o \
-    libgit2/src/curl_stream.o libgit2/src/date.o libgit2/src/delta.o \
-    libgit2/src/describe.o libgit2/src/diff_driver.o libgit2/src/diff_file.o \
-    libgit2/src/diff_generate.o libgit2/src/diff_parse.o libgit2/src/diff_print.o \
-    libgit2/src/diff_stats.o libgit2/src/diff_tform.o libgit2/src/diff_xdiff.o \
-    libgit2/src/diff.o libgit2/src/errors.o libgit2/src/fetch.o \
-    libgit2/src/fetchhead.o libgit2/src/filebuf.o libgit2/src/fileops.o \
-    libgit2/src/filter.o libgit2/src/fnmatch.o libgit2/src/global.o \
-    libgit2/src/graph.o libgit2/src/hash.o libgit2/src/hashsig.o \
-    libgit2/src/ident.o libgit2/src/idxmap.o libgit2/src/ignore.o \
-    libgit2/src/index.o libgit2/src/indexer.o libgit2/src/iterator.o \
-    libgit2/src/merge_driver.o libgit2/src/merge_file.o libgit2/src/merge.o \
-    libgit2/src/message.o libgit2/src/mwindow.o libgit2/src/netops.o \
-    libgit2/src/notes.o libgit2/src/object_api.o libgit2/src/object.o \
-    libgit2/src/odb_loose.o libgit2/src/odb_mempack.o libgit2/src/odb_pack.o \
-    libgit2/src/odb.o libgit2/src/offmap.o libgit2/src/oid.o \
-    libgit2/src/oidarray.o libgit2/src/oidmap.o libgit2/src/openssl_stream.o \
-    libgit2/src/pack-objects.o libgit2/src/pack.o libgit2/src/patch_generate.o \
-    libgit2/src/patch_parse.o libgit2/src/patch.o libgit2/src/path.o \
-    libgit2/src/pathspec.o libgit2/src/pool.o libgit2/src/posix.o \
-    libgit2/src/pqueue.o libgit2/src/proxy.o libgit2/src/push.o \
-    libgit2/src/rebase.o libgit2/src/refdb_fs.o libgit2/src/refdb.o \
-    libgit2/src/reflog.o libgit2/src/refs.o libgit2/src/refspec.o \
-    libgit2/src/remote.o libgit2/src/repository.o libgit2/src/reset.o \
-    libgit2/src/revert.o libgit2/src/revparse.o libgit2/src/revwalk.o \
-    libgit2/src/settings.o libgit2/src/sha1_lookup.o libgit2/src/signature.o \
-    libgit2/src/socket_stream.o libgit2/src/sortedcache.o libgit2/src/stash.o \
-    libgit2/src/status.o libgit2/src/strmap.o libgit2/src/submodule.o \
-    libgit2/src/sysdir.o libgit2/src/tag.o libgit2/src/thread-utils.o \
-    libgit2/src/tls_stream.o libgit2/src/trace.o libgit2/src/transaction.o \
-    libgit2/src/transport.o libgit2/src/tree-cache.o libgit2/src/tree.o \
-    libgit2/src/tsort.o libgit2/src/util.o libgit2/src/varint.o \
-    libgit2/src/vector.o libgit2/src/worktree.o libgit2/src/zstream.o
 
-OBJECTS.libgit2.transports = libgit2/src/transports/auth.o libgit2/src/transports/cred_helpers.o libgit2/src/transports/cred.o \
-    libgit2/src/transports/git.o libgit2/src/transports/http.o libgit2/src/transports/local.o \
-    libgit2/src/transports/smart_pkt.o libgit2/src/transports/smart_protocol.o libgit2/src/transports/smart.o \
-    libgit2/src/transports/ssh.o
-
-OBJECTS.libgit2.unix = libgit2/src/unix/map.o libgit2/src/unix/realpath.o
-
-OBJECTS.libgit2.xdiff = libgit2/src/xdiff/xdiffi.o libgit2/src/xdiff/xemit.o libgit2/src/xdiff/xhistogram.o \
-    libgit2/src/xdiff/xmerge.o libgit2/src/xdiff/xpatience.o libgit2/src/xdiff/xprepare.o \
-    libgit2/src/xdiff/xutils.o
-
-OBJECTS.http_parser = libgit2/deps/http-parser/http_parser.o
-
-LIBGIT = $(OBJECTS.libgit2) $(OBJECTS.libgit2.transports) $(OBJECTS.libgit2.unix) \
-    $(OBJECTS.libgit2.xdiff) $(OBJECTS.http_parser) @GIT2R_SRC_REGEX@
-
-$(SHLIB): libmygit.a
-
-libmygit.a: $(LIBGIT)
-	$(AR) rcs libmygit.a $(LIBGIT)
+$(SHLIB):
 
 clean:
-	rm -f *.o libmygit.a git2r.so $(LIBGIT)
+	rm -f *.o git2r.so
 
 .PHONY: all clean
diff --git a/src/git2r_branch.c b/src/git2r_branch.c
index b169e6c8..14a95ea8 100644
--- a/src/git2r_branch.c
+++ b/src/git2r_branch.c
@@ -17,7 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "refs.h"
+#include "git2.h"
 
 #include "git2r_arg.h"
 #include "git2r_branch.h"
@@ -404,7 +404,10 @@ SEXP git2r_branch_upstream_canonical_name(SEXP branch)
     SEXP repo;
     const char *name;
     git_branch_t type;
-    git_buf buf = GIT_BUF_INIT;
+    const char *branch_name;
+    size_t branch_name_len;
+    char *buf = NULL;
+    size_t buf_len;
     git_config *cfg = NULL;
     git_repository *repository = NULL;
 
@@ -424,16 +427,22 @@ SEXP git2r_branch_upstream_canonical_name(SEXP branch)
     if (err)
         goto cleanup;
 
-    err = git_buf_join3(
-        &buf,
-        '.',
-        "branch",
-        CHAR(STRING_ELT(GET_SLOT(branch, Rf_install("name")), 0)),
-        "merge");
-    if (err)
+    branch_name = CHAR(STRING_ELT(GET_SLOT(branch, Rf_install("name")), 0));
+    branch_name_len = strlen(branch_name);
+    while (branch_name[0] == '.') {
+        branch_name++;
+        branch_name_len--;
+    }
+    while (branch_name_len >= 1 && branch_name[branch_name_len - 1] == '.') {
+        branch_name_len--;
+    }
+    buf_len = branch_name_len + sizeof("branch") + sizeof("merge") + 1;
+    buf = malloc(buf_len);
+    err = snprintf(buf, buf_len, "branch.%.*s.merge", (int)branch_name_len, branch_name);
+    if (err < 0 || err >= buf_len)
         goto cleanup;
 
-    err = git_config_get_string(&name, cfg, buf.ptr);
+    err = git_config_get_string(&name, cfg, buf);
     if (err)
         goto cleanup;
 
@@ -441,7 +450,8 @@ SEXP git2r_branch_upstream_canonical_name(SEXP branch)
     SET_STRING_ELT(result, 0, mkChar(name));
 
 cleanup:
-    git_buf_free(&buf);
+    if (buf)
+        free(buf);
 
     if (cfg)
         git_config_free(cfg);
diff --git a/src/git2r_checkout.c b/src/git2r_checkout.c
index aa416406..7d0d4627 100644
--- a/src/git2r_checkout.c
+++ b/src/git2r_checkout.c
@@ -18,7 +18,6 @@
 
 #include <Rdefines.h>
 #include "git2.h"
-#include "refs.h"
 
 #include "git2r_arg.h"
 #include "git2r_checkout.h"
diff --git a/src/git2r_commit.c b/src/git2r_commit.c
index 892db39a..4bd7346c 100644
--- a/src/git2r_commit.c
+++ b/src/git2r_commit.c
@@ -17,9 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "buffer.h"
-#include "commit.h"
+#include <git2.h>
 
 #include "git2r_arg.h"
 #include "git2r_commit.h"
diff --git a/src/git2r_cred.c b/src/git2r_cred.c
index ad964555..6d4d4256 100644
--- a/src/git2r_cred.c
+++ b/src/git2r_cred.c
@@ -20,8 +20,8 @@
 #include <Rinternals.h>
 #include <Rdefines.h>
 
-#include "buffer.h"
-#include "common.h"
+#include <git2.h>
+#define GIT_UNUSED(x)
 
 #include "git2r_cred.h"
 #include "git2r_transfer.h"
@@ -83,44 +83,33 @@ static int git2r_cred_env(
 {
     if (GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types) {
         int err;
-        git_buf username = GIT_BUF_INIT;
-        git_buf password = GIT_BUF_INIT;
+        const char *username = NULL;
+        const char *password = NULL;
 
         /* Read value of the username environment variable */
-        err = git__getenv(&username,
-                          CHAR(STRING_ELT(
+        username = getenv(CHAR(STRING_ELT(
                                    GET_SLOT(credentials,
                                             Rf_install("username")), 0)));
-        if (err)
-            goto cleanup;
-
-        if (!git_buf_len(&username)) {
+        if (username == NULL || username[0] == '\0') {
             err = -1;
             goto cleanup;
         }
 
         /* Read value of the password environment variable */
-        err = git__getenv(&password,
-                          CHAR(STRING_ELT(
+        password = getenv(CHAR(STRING_ELT(
                                    GET_SLOT(credentials,
                                             Rf_install("password")), 0)));
-        if (err)
-            goto cleanup;
-
-        if (!git_buf_len(&password)) {
+        if (password == NULL || password[0] == '\0') {
             err = -1;
             goto cleanup;
         }
 
         err = git_cred_userpass_plaintext_new(
             cred,
-            git_buf_cstr(&username),
-            git_buf_cstr(&password));
+            username,
+            password);
 
     cleanup:
-        git_buf_free(&username);
-        git_buf_free(&password);
-
         if (err)
             return -1;
 
@@ -145,21 +134,20 @@ static int git2r_cred_token(
 {
     if (GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types) {
         int err;
-        git_buf token = GIT_BUF_INIT;
+        const char *token = NULL;
 
         /* Read value of the personal access token from the
          * environment variable */
-        err = git__getenv(&token,
-                          CHAR(STRING_ELT(GET_SLOT(credentials,
-                                                   Rf_install("token")), 0)));
-        if (err)
+        token = getenv(CHAR(STRING_ELT(GET_SLOT(credentials,
+                                                Rf_install("token")), 0)));
+        if (token == NULL) {
+            err = -1;
             goto cleanup;
+        }
 
-        err = git_cred_userpass_plaintext_new(cred, " ", git_buf_cstr(&token));
+        err = git_cred_userpass_plaintext_new(cred, " ", token);
 
     cleanup:
-        git_buf_free(&token);
-
         if (err)
             return -1;
 
diff --git a/src/git2r_diff.c b/src/git2r_diff.c
index 1f07023c..965293a7 100644
--- a/src/git2r_diff.c
+++ b/src/git2r_diff.c
@@ -22,9 +22,9 @@
 #include "git2r_tree.h"
 #include "git2r_repository.h"
 
-#include "git2.h"
-#include "buffer.h"
-#include "diff.h"
+#include <git2.h>
+#include <git2/sys/diff.h>
+#define GIT_UNUSED(x)
 
 #include <stdlib.h>
 #include <string.h>
@@ -148,13 +148,12 @@ SEXP git2r_diff_index_to_wd(SEXP repo, SEXP filename)
         SET_SLOT(result, s_new, mkString("workdir"));
         err = git2r_diff_format_to_r(diff, result);
     } else if (0 == length(filename)) {
-        git_buf buf = GIT_BUF_INIT;
+        git_buf buf = {0};
 
-        err = git_diff_print(
+        err = git_diff_to_buf(
+            &buf,
             diff,
-            GIT_DIFF_FORMAT_PATCH,
-            git_diff_print_callback__to_buf,
-            &buf);
+            GIT_DIFF_FORMAT_PATCH);
         if (0 == err) {
             PROTECT(result = mkString(buf.ptr));
             nprotect++;
@@ -247,13 +246,12 @@ SEXP git2r_diff_head_to_index(SEXP repo, SEXP filename)
         SET_SLOT(result, s_new, mkString("index"));
         err = git2r_diff_format_to_r(diff, result);
     } else if (0 == length(filename)) {
-        git_buf buf = GIT_BUF_INIT;
+        git_buf buf = {0};
 
-        err = git_diff_print(
+        err = git_diff_to_buf(
+            &buf,
             diff,
-            GIT_DIFF_FORMAT_PATCH,
-            git_diff_print_callback__to_buf,
-            &buf);
+            GIT_DIFF_FORMAT_PATCH);
         if (0 == err) {
             PROTECT(result = mkString(buf.ptr));
             nprotect++;
@@ -351,13 +349,12 @@ SEXP git2r_diff_tree_to_wd(SEXP tree, SEXP filename)
         SET_SLOT(result, s_new, mkString("workdir"));
         err = git2r_diff_format_to_r(diff, result);
     } else if (0 == length(filename)) {
-        git_buf buf = GIT_BUF_INIT;
+        git_buf buf = {0};
 
-        err = git_diff_print(
+        err = git_diff_to_buf(
+            &buf,
             diff,
-            GIT_DIFF_FORMAT_PATCH,
-            git_diff_print_callback__to_buf,
-            &buf);
+            GIT_DIFF_FORMAT_PATCH);
         if (0 == err) {
             PROTECT(result = mkString(buf.ptr));
             nprotect++;
@@ -460,13 +457,12 @@ SEXP git2r_diff_tree_to_index(SEXP tree, SEXP filename)
         SET_SLOT(result, s_new, mkString("index"));
         err = git2r_diff_format_to_r(diff, result);
     } else if (0 == length(filename)) {
-        git_buf buf = GIT_BUF_INIT;
+        git_buf buf = {0};
 
-        err = git_diff_print(
+        err = git_diff_to_buf(
+            &buf,
             diff,
-            GIT_DIFF_FORMAT_PATCH,
-            git_diff_print_callback__to_buf,
-            &buf);
+            GIT_DIFF_FORMAT_PATCH);
         if (0 == err) {
             PROTECT(result = mkString(buf.ptr));
             nprotect++;
@@ -580,13 +576,12 @@ SEXP git2r_diff_tree_to_tree(SEXP tree1, SEXP tree2, SEXP filename)
         SET_SLOT(result, Rf_install("new"), tree2);
         err = git2r_diff_format_to_r(diff, result);
     } else if (0 == length(filename)) {
-        git_buf buf = GIT_BUF_INIT;
+        git_buf buf = {0};
 
-        err = git_diff_print(
+        err = git_diff_to_buf(
+            &buf,
             diff,
-            GIT_DIFF_FORMAT_PATCH,
-            git_diff_print_callback__to_buf,
-            &buf);
+            GIT_DIFF_FORMAT_PATCH);
         if (0 == err) {
             PROTECT(result = mkString(buf.ptr));
             nprotect++;
diff --git a/src/git2r_merge.c b/src/git2r_merge.c
index 759daa41..43911b0b 100644
--- a/src/git2r_merge.c
+++ b/src/git2r_merge.c
@@ -17,8 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "buffer.h"
+#include <git2.h>
 
 #include "git2r_arg.h"
 #include "git2r_commit.h"
@@ -122,7 +121,8 @@ static int git2r_fast_forward_merge(
 {
     int err;
     const git_oid *oid;
-    git_buf buf = GIT_BUF_INIT;
+    char *buf = NULL;
+    size_t buf_len;
     git_commit *commit = NULL;
     git_tree *tree = NULL;
     git_reference *reference = NULL;
@@ -148,8 +148,10 @@ static int git2r_fast_forward_merge(
             goto cleanup;
     }
 
-    err = git_buf_printf(&buf, "%s: Fast-forward", log_message);
-    if (err)
+    buf_len = strlen(log_message) + sizeof(": Fast-forward");
+    buf = malloc(buf_len);
+    err = snprintf(buf, buf_len, "%s: Fast-forward", log_message);
+    if (err < 0 || err >= buf_len)
         goto cleanup;
 
     if (GIT_ENOTFOUND == err) {
@@ -159,7 +161,7 @@ static int git2r_fast_forward_merge(
             "HEAD",
             git_commit_id(commit),
             0, /* force */
-            buf.ptr);
+            buf);
     } else {
         git_reference *target_ref = NULL;
 
@@ -167,7 +169,7 @@ static int git2r_fast_forward_merge(
             &target_ref,
             reference,
             git_commit_id(commit),
-            buf.ptr);
+            buf);
 
         if (target_ref)
             git_reference_free(target_ref);
@@ -184,7 +186,8 @@ static int git2r_fast_forward_merge(
         ScalarLogical(0));
 
 cleanup:
-    git_buf_free(&buf);
+    if (buf)
+        free(buf);
 
     if (commit)
         git_commit_free(commit);
@@ -441,7 +444,8 @@ SEXP git2r_merge_branch(SEXP branch, SEXP merger, SEXP commit_on_success)
     int err;
     SEXP result = R_NilValue;
     const char *name;
-    git_buf buf = GIT_BUF_INIT;
+    char *buf = NULL;
+    size_t buf_len;
     git_branch_t type;
     git_annotated_commit **merge_heads = NULL;
     git_reference *reference = NULL;
@@ -482,8 +486,10 @@ SEXP git2r_merge_branch(SEXP branch, SEXP merger, SEXP commit_on_success)
     if (err)
         goto cleanup;
 
-    err = git_buf_printf(&buf, "merge %s", name);
-    if (err)
+    buf_len = strlen(name) + sizeof("merge ");
+    buf = malloc(buf_len);
+    err = snprintf(buf, buf_len, "merge %s", name);
+    if (err < 0 || err >= buf_len)
         goto cleanup;
 
     PROTECT(result = NEW_OBJECT(MAKE_CLASS("git_merge_result")));
@@ -493,12 +499,13 @@ SEXP git2r_merge_branch(SEXP branch, SEXP merger, SEXP commit_on_success)
         (const git_annotated_commit **)merge_heads,
         1,
         GIT_MERGE_PREFERENCE_NONE,
-        buf.ptr,
+        buf,
         who,
         LOGICAL(commit_on_success)[0]);
 
 cleanup:
-    git_buf_free(&buf);
+    if (buf)
+        free(buf);
 
     if (who)
         git_signature_free(who);
diff --git a/src/git2r_note.c b/src/git2r_note.c
index fe3baa75..bd8ef9aa 100644
--- a/src/git2r_note.c
+++ b/src/git2r_note.c
@@ -17,8 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "buffer.h"
+#include <git2.h>
 
 #include "git2r_arg.h"
 #include "git2r_error.h"
@@ -199,7 +198,7 @@ SEXP git2r_note_default_ref(SEXP repo)
 {
     int err;
     SEXP result = R_NilValue;
-    git_buf buf = GIT_BUF_INIT;
+    git_buf buf = {0};
     git_repository *repository = NULL;
 
     repository = git2r_repository_open(repo);
@@ -280,7 +279,7 @@ SEXP git2r_notes(SEXP repo, SEXP ref)
 {
     int err;
     SEXP result = R_NilValue;
-    git_buf buf = GIT_BUF_INIT;
+    git_buf buf = {0};
     git2r_note_foreach_cb_data cb_data = {0, R_NilValue, R_NilValue, NULL, NULL};
     git_repository *repository = NULL;
 
@@ -294,7 +293,9 @@ SEXP git2r_notes(SEXP repo, SEXP ref)
         git2r_error(__func__, NULL, git2r_err_invalid_repository, NULL);
 
     if (!isNull(ref)) {
-        git_buf_sets(&buf, CHAR(STRING_ELT(ref, 0)));
+        git_buf_set(&buf,
+                    CHAR(STRING_ELT(ref, 0)),
+                    strlen(CHAR(STRING_ELT(ref, 0))));
     } else {
         err = git_note_default_ref(&buf, repository);
         if (err)
@@ -304,7 +305,7 @@ SEXP git2r_notes(SEXP repo, SEXP ref)
     /* Count number of notes before creating the list */
     err = git_note_foreach(
         repository,
-        git_buf_cstr(&buf),
+        buf.ptr,
         &git2r_note_foreach_cb,
         &cb_data);
     if (err) {
@@ -321,8 +322,8 @@ SEXP git2r_notes(SEXP repo, SEXP ref)
     cb_data.list = result;
     cb_data.repo = repo;
     cb_data.repository = repository;
-    cb_data.notes_ref = git_buf_cstr(&buf);
-    err = git_note_foreach(repository, git_buf_cstr(&buf),
+    cb_data.notes_ref = buf.ptr;
+    err = git_note_foreach(repository, buf.ptr,
                            &git2r_note_foreach_cb, &cb_data);
 
 cleanup:
diff --git a/src/git2r_odb.c b/src/git2r_odb.c
index e4c379b1..151b2e55 100644
--- a/src/git2r_odb.c
+++ b/src/git2r_odb.c
@@ -17,8 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "buffer.h"
+#include <git2.h>
 
 #include "git2r_arg.h"
 #include "git2r_error.h"
@@ -358,7 +357,9 @@ static int git2r_odb_tree_blobs(
         switch (git_tree_entry_type(entry)) {
         case GIT_OBJ_TREE:
         {
-            git_buf buf = GIT_BUF_INIT;
+            char *buf = NULL;
+            size_t buf_len;
+            const char *sep;
             git_tree *sub_tree = NULL;
 
             err = git_tree_lookup(
@@ -368,19 +369,26 @@ static int git2r_odb_tree_blobs(
             if (err)
                 return err;
 
-            err = git_buf_joinpath(&buf, path, git_tree_entry_name(entry));
+            buf_len = strlen(path) + strlen(git_tree_entry_name(entry)) + 2;
+            buf = malloc(buf_len);
+            if (strlen(path)) {
+                sep = "/";
+            } else {
+                sep = "";
+            }
+            err = snprintf(buf, buf_len, "%s%s%s", path, sep, git_tree_entry_name(entry));
 
-            if (GIT_OK == err) {
+            if (err >= 0 && err < buf_len) {
                 err = git2r_odb_tree_blobs(
                     sub_tree,
-                    buf.ptr,
+                    buf,
                     commit,
                     author,
                     when,
                     data);
             }
 
-            git_buf_free(&buf);
+            free(buf);
 
             if (sub_tree)
                 git_tree_free(sub_tree);
diff --git a/src/git2r_remote.c b/src/git2r_remote.c
index 8f31d601..b8932586 100644
--- a/src/git2r_remote.c
+++ b/src/git2r_remote.c
@@ -17,8 +17,7 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "common.h"
+#include <git2.h>
 
 #include "git2r_arg.h"
 #include "git2r_cred.h"
diff --git a/src/git2r_repository.c b/src/git2r_repository.c
index f70d1572..d6cc16e1 100644
--- a/src/git2r_repository.c
+++ b/src/git2r_repository.c
@@ -27,7 +27,7 @@
 #include "git2r_signature.h"
 #include "git2r_tag.h"
 #include "git2r_tree.h"
-#include "buffer.h"
+#include <git2.h>
 
 /**
  * Get repo slot from S4 class git_repository
@@ -535,7 +535,7 @@ SEXP git2r_repository_discover(SEXP path, SEXP ceiling)
 {
     int err;
     SEXP result = R_NilValue;
-    git_buf buf = GIT_BUF_INIT;
+    git_buf buf = {0};
     const char *ceiling_dirs = NULL;
 
     if (git2r_arg_check_string(path))
diff --git a/src/git2r_stash.c b/src/git2r_stash.c
index e68b2298..376fdde2 100644
--- a/src/git2r_stash.c
+++ b/src/git2r_stash.c
@@ -17,8 +17,8 @@
  */
 
 #include <Rdefines.h>
-#include "git2.h"
-#include "cc-compat.h"
+#include <git2.h>
+#define GIT_UNUSED(x)
 
 #include "git2r_arg.h"
 #include "git2r_commit.h"
diff --git a/src/git2r_tag.c b/src/git2r_tag.c
index 0bb12e0a..d1544d5a 100644
--- a/src/git2r_tag.c
+++ b/src/git2r_tag.c
@@ -27,7 +27,7 @@
 #include "git2r_tag.h"
 #include "git2r_tree.h"
 
-#include "util.h"
+#include <git2.h>
 
 /**
  * Init slots in S4 class git_tag
@@ -242,7 +242,7 @@ static int git2r_tag_foreach_cb(const char *name, git_oid *oid, void *payload)
             git2r_error(__func__, NULL, git2r_err_object_type, NULL);
         }
 
-        if (git__prefixcmp(name, "refs/tags/") == 0)
+        if (strncmp(name, "refs/tags/", sizeof("refs/tags/") - 1) == 0)
             skip = strlen("refs/tags/");
         PROTECT(tag = mkChar(name + skip));
         SET_STRING_ELT(
-- 
2.14.3