Skip to content

Commit

Permalink
curl: enable IPv6 support
Browse files Browse the repository at this point in the history
The support is already there, of course, it was just not auto-detected
correctly.

This fixes git-for-windows/git#370

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 17, 2015
1 parent 2b9e955 commit 9253d0b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 3 deletions.
71 changes: 71 additions & 0 deletions mingw-w64-curl/0003-curl-detect-ipv6-on-windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Thu, 17 Sep 2015 20:03:34 +0200
Subject: [PATCH] Auto-detect IPv6 support even on Windows

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
configure.ac | 11 ++++++++++-
m4/curl-functions.m4 | 10 ++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index be2634a..9ff200d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1081,7 +1081,11 @@ AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),

AC_TRY_RUN([ /* is AF_INET6 available? */
#include <sys/types.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
#include <sys/socket.h>
+#endif
#include <stdlib.h> /* for exit() */
main()
{
@@ -1108,7 +1112,12 @@ if test "$ipv6" = yes; then
AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
AC_TRY_COMPILE([
#include <sys/types.h>
-#include <netinet/in.h>] ,
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
+#include <netinet/in.h>
+#endif] ,
struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
if test "$have_sin6_scope_id" = yes; then
AC_MSG_RESULT([yes])
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 0d65421..9f04661 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -44,6 +44,10 @@ curl_includes_arpa_inet="\
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
@@ -2098,6 +2102,12 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
struct addrinfo *ai = 0;
int error;

+ #ifdef HAVE_WINSOCK2_H
+ WSADATA wsa;
+ if (WSAStartup(MAKEWORD(2,2), &wsa))
+ exit(2);
+ #endif
+
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
--
2.5.2.windows.2

9 changes: 6 additions & 3 deletions mingw-w64-curl/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _realname=curl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=7.44.0
pkgrel=1
pkgrel=2
pkgdesc="An URL retrival utility and library. (mingw-w64)"
arch=('any')
url="http://curl.haxx.se"
Expand All @@ -29,18 +29,21 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
options=('staticlibs')
source=("$url/download/${_realname}-${pkgver}.tar.bz2"{,.asc}
"0001-curl-relocation.patch"
"0002-curl-mingw-enable-static.patch")
"0002-curl-mingw-enable-static.patch"
"0003-curl-detect-ipv6-on-windows.patch")
md5sums=('6b952ca00e5473b16a11f05f06aa8dae'
'SKIP'
'58520051c4ed77781d233c3fa40a5435'
'eac9e212e619490966ae47004bec547b')
'eac9e212e619490966ae47004bec547b'
'f1c5b8648af0dfab7bde4d68a6b65f25')
validpgpkeys=('914C533DF9B2ADA2204F586D78E11C6B279D5C91') # Daniel Stenberg

prepare() {
cd "${_realname}-${pkgver}"
rm -f lib/pathtools.h lib/pathtools.c > /dev/null 2>&1 || true
patch -p1 -i "${srcdir}/0001-curl-relocation.patch"
patch -p1 -i "${srcdir}/0002-curl-mingw-enable-static.patch"
patch -p1 -i "${srcdir}/0003-curl-detect-ipv6-on-windows.patch"
autoreconf -vfi
}

Expand Down

0 comments on commit 9253d0b

Please sign in to comment.