pinkbyte-overlay/games-emulation/mednafen/files/mednafen-ipv6.patch
2011-09-07 21:52:54 +04:00

56 lines
1.9 KiB
Diff

--- configure.ac.orig 2011-07-03 01:21:46.937790000 +0400
+++ configure.ac 2011-07-03 01:24:57.947895000 +0400
@@ -414,5 +414,27 @@
CFLAGS="$LIBCDIO_CFLAGS $SNDFILE_CFLAGS $CFLAGS"
CPPFLAGS="$LIBCDIO_CFLAGS $SNDFILE_CFLAGS $CPPFLAGS"
+dnl ipv6 check
+AC_ARG_ENABLE(ipv6,
+[ --enable-ipv6 Use ipv6, if available. [default=yes]],enable_ipv6=$enableval,enable_ipv6=yes)
+
+AC_MSG_CHECKING(whether to enable ipv6)
+
+if test "x$enable_ipv6" = "xyes" ; then
+ AC_TRY_COMPILE([#define INET6
+#include <sys/types.h>
+#include <netinet/in.h>],
+ [int x = IPPROTO_IPV6; struct in6_addr a;],
+ [ts_cv_ipv6="yes"], [ts_cv_ipv6="no"])
+else
+ ts_cv_ipv6="no"
+fi
+
+AC_MSG_RESULT($ts_cv_ipv6)
+
+if test "x$ts_cv_ipv6" = "xyes"; then
+ AC_DEFINE([USE_IPV6], [], [Enable ipv6 support])
+fi
+
dnl Output Makefiles
AC_OUTPUT([Makefile src/Makefile src/tremor/Makefile src/mpcdec/Makefile src/trio/Makefile src/gb/Makefile src/gba/Makefile src/lynx/Makefile src/pce/Makefile src/pcfx/Makefile src/sms/Makefile src/wswan/Makefile src/nes/Makefile src/ngp/Makefile po/Makefile.in intl/Makefile])
--- src/drivers/netplay.cpp.orig 2010-12-19 01:24:01.000000000 +0300
+++ src/drivers/netplay.cpp 2011-07-03 02:14:07.513970385 +0400
@@ -244,13 +244,21 @@
unsigned int remote_port = MDFN_GetSettingUI("netplay.port");
std::string game_key = MDFN_GetSettingS("netplay.gamekey");
+#ifdef USE_IPV6
+ if(SDLNet_ResolveHost(SDLNET_ANY, &IPa, remote_host.c_str(), remote_port) == -1)
+#else
if(SDLNet_ResolveHost(&IPa, remote_host.c_str(), remote_port) == -1)
+#endif
{
PrintNetError(_("*** Error resolving host \"%s\"!"), remote_host.c_str());
return(0);
}
+#ifdef USE_IPV6
+ Socket = SDLNet_TCP_Connect(&IPa);
+#else
Socket = SDLNet_TCP_Open(&IPa);
+#endif
if(!Socket)
{
PrintNetError(_("*** Error connecting to remote host \"%s\" on port %u!"), remote_host.c_str(), remote_port);