summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--ChangeLog.adoc1
-rw-r--r--Makefile.am1
-rw-r--r--cmake/FindSocketpair.cmake40
-rw-r--r--config.h.cmake1
-rw-r--r--configure.ac74
-rw-r--r--src/core/wee-hook.h2
7 files changed, 96 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ba1bd461..e82dfda7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,6 +191,9 @@ if(ICONV_FOUND)
add_definitions(-DHAVE_ICONV)
endif()
+# Check for socketpair() supporting SOCK_DGRAM
+find_package(Socketpair)
+
# Check for CURL
find_package(CURL REQUIRED)
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index d937536a3..1e86e6af5 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -31,6 +31,7 @@ Improvements::
Bug fixes::
+ * api: fix connection to servers with hook_connect() on Windows 10 with Windows subsystem for Linux (issue #770)
* api: fix crash in function string_split_command() when the separator is not a semicolon (issue #731)
* irc: fix NULL pointer dereference in 734 command callback (issue #738)
* relay: return an empty hdata when the requested hdata or pointer is not found (issue #767)
diff --git a/Makefile.am b/Makefile.am
index 577f95980..552269a5e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,6 +57,7 @@ EXTRA_DIST = AUTHORS.adoc \
cmake/FindPkgConfig.cmake \
cmake/FindPython.cmake \
cmake/FindRuby.cmake \
+ cmake/FindSocketpair.cmake \
cmake/FindTCL.cmake \
cmake/FindV8.cmake \
cmake/FindZLIB.cmake \
diff --git a/cmake/FindSocketpair.cmake b/cmake/FindSocketpair.cmake
new file mode 100644
index 000000000..cc6c7d968
--- /dev/null
+++ b/cmake/FindSocketpair.cmake
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2016 Sébastien Helleu <flashcode@flashtux.org>
+#
+# This file is part of WeeChat, the extensible chat client.
+#
+# WeeChat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# WeeChat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# - Find Socketpair
+# This module finds if socketpair function is available and supports SOCK_DGRAM.
+#
+
+if(SOCKETPAIR_FOUND)
+ # Already in cache, be silent
+ set(SOCKETPAIR_FIND_QUIETLY TRUE)
+endif()
+
+include(CheckCSourceRuns)
+
+set(CMAKE_REQUIRED_FLAGS -Werror)
+check_c_source_runs("
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ int main() {
+ int socket[2];
+ int rc = socketpair (AF_LOCAL, SOCK_DGRAM, 0, socket);
+ return (rc == 0) ? 0 : 1;
+ }
+" HAVE_SOCKETPAIR_SOCK_DGRAM)
diff --git a/config.h.cmake b/config.h.cmake
index 82be05c6e..2f34efe97 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -6,6 +6,7 @@
#cmakedefine ICONV_2ARG_IS_CONST 1
#cmakedefine HAVE_MALLINFO
#cmakedefine HAVE_EAT_NEWLINE_GLITCH
+#cmakedefine HAVE_SOCKETPAIR_SOCK_DGRAM
#cmakedefine HAVE_ASPELL_VERSION_STRING
#cmakedefine HAVE_ENCHANT_GET_VERSION
#cmakedefine HAVE_GUILE_GMP_MEMORY_FUNCTIONS
diff --git a/configure.ac b/configure.ac
index 3f9ee5220..81cf53c3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
AH_VERBATIM([HAVE_EAT_NEWLINE_GLITCH], [#undef HAVE_EAT_NEWLINE_GLITCH])
+AH_VERBATIM([HAVE_SOCKETPAIR_SOCK_DGRAM], [#undef HAVE_SOCKETPAIR_SOCK_DGRAM])
AH_VERBATIM([HAVE_ASPELL_VERSION_STRING], [#undef HAVE_ASPELL_VERSION_STRING])
AH_VERBATIM([HAVE_ENCHANT_GET_VERSION], [#undef HAVE_ENCHANT_GET_VERSION])
AH_VERBATIM([HAVE_GUILE_GMP_MEMORY_FUNCTIONS], [#undef HAVE_GUILE_GMP_MEMORY_FUNCTIONS])
@@ -1048,6 +1049,28 @@ else
fi
# ------------------------------------------------------------------------------
+# socketpair (SOCK_DGRAM)
+# ------------------------------------------------------------------------------
+
+enable_socketpair_sock_dgram="no"
+AC_CACHE_CHECK([for socketpair with SOCK_DGRAM support], ac_cv_have_socketpair_sock_dgram, [
+AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ int main() {
+ int socket[2];
+ int rc = socketpair (AF_LOCAL, SOCK_DGRAM, 0, socket);
+ return (rc == 0) ? 0 : 1;
+ }],ac_have_socketpair_sock_dgram="yes", ac_have_socketpair_sock_dgram="no", ac_have_socketpair_sock_dgram="assume-yes")])
+
+if test "x$ac_have_socketpair_sock_dgram" = "xyes"; then
+ enable_have_socketpair_sock_dgram="yes"
+ AC_DEFINE(HAVE_SOCKETPAIR_SOCK_DGRAM)
+else
+ not_found="$not_found socketpair(SOCK_DGRAM)"
+fi
+
+# ------------------------------------------------------------------------------
# zlib
# ------------------------------------------------------------------------------
@@ -1236,31 +1259,32 @@ CPPFLAGS="$CPPFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LI
# output Makefiles
# ------------------------------------------------------------------------------
-AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
-AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
-AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes")
-AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
-AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes")
-AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
-AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
-AM_CONDITIONAL(PLUGIN_EXEC, test "$enable_exec" = "yes")
-AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
-AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
-AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
-AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
-AM_CONDITIONAL(PLUGIN_SCRIPT, test "$enable_script" = "yes")
-AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
-AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
-AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
-AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
-AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
-AM_CONDITIONAL(PLUGIN_GUILE, test "$enable_guile" = "yes")
-AM_CONDITIONAL(PLUGIN_JAVASCRIPT, test "$enable_javascript" = "yes")
-AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
-AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
-AM_CONDITIONAL(TESTS, test "$enable_tests" = "yes")
-AM_CONDITIONAL(MAN, test "$enable_man" = "yes")
-AM_CONDITIONAL(DOC, test "$enable_doc" = "yes")
+AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
+AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
+AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes")
+AM_CONDITIONAL(HAVE_SOCKETPAIR_SOCK_DGRAM, test "$enable_socketpair_sock_dgram" = "yes")
+AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
+AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes")
+AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
+AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
+AM_CONDITIONAL(PLUGIN_EXEC, test "$enable_exec" = "yes")
+AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
+AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
+AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
+AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
+AM_CONDITIONAL(PLUGIN_SCRIPT, test "$enable_script" = "yes")
+AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
+AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
+AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
+AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
+AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
+AM_CONDITIONAL(PLUGIN_GUILE, test "$enable_guile" = "yes")
+AM_CONDITIONAL(PLUGIN_JAVASCRIPT, test "$enable_javascript" = "yes")
+AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
+AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
+AM_CONDITIONAL(TESTS, test "$enable_tests" = "yes")
+AM_CONDITIONAL(MAN, test "$enable_man" = "yes")
+AM_CONDITIONAL(DOC, test "$enable_doc" = "yes")
AC_OUTPUT([Makefile
doc/Makefile
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index cdbba4027..ae6ba5600 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -27,7 +27,7 @@
#include <gnutls/gnutls.h>
#endif
-#if defined(__CYGWIN__) || defined(__APPLE__) || defined(__MACH__)
+#if !defined(HAVE_SOCKETPAIR_SOCK_DGRAM) || defined(__CYGWIN__) || defined(__APPLE__) || defined(__MACH__)
/*
* For the connect hook, when this is defined an array of sockets will
* be passed from the parent process to the child process instead of using