aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-07-26 19:35:48 +0300
committerEli Zaretskii <eliz@gnu.org>2020-07-26 19:35:48 +0300
commit05a6b8c28baad097147eb06329ce3be940682aa9 (patch)
tree09c28fe9a94587458ab279827dd076028252ad1f /gdbserver
parent3abf97582679343f1708252712e9254d3e0f132c (diff)
downloadgdb-05a6b8c28baad097147eb06329ce3be940682aa9.zip
gdb-05a6b8c28baad097147eb06329ce3be940682aa9.tar.gz
gdb-05a6b8c28baad097147eb06329ce3be940682aa9.tar.bz2
Don't unnecessarily redefine 'socklen_t' type in MinGW builds.
The original configure-time tests in gdb/ and gdbserver/ failed to detect that 'socklen_t' is defined in MinGW headers because the test program included only sys/socket.h, which is absent in MinGW system headers. However on MS-Windows this data type is declared in another header, ws2tcpip.h. The modified test programs try using ws2tcpip.h if sys/socket.h is unavailable. Thanks to Joel Brobecker who helped me regenerate the configure scripts and the config.in files. gdb/ChangeLog: 2020-07-26 Eli Zaretskii <eliz@gnu.org> * configure.ac (AC_CHECK_HEADERS): Check for sys/socket.h and ws2tcpip.h. When checking whether socklen_t type is defined, use ws2tcpip.h if it is available and sys/socket.h isn't. * configure: Regenerate. * config.in: Regenerate. gdbserver/ChangeLog: 2020-07-26 Eli Zaretskii <eliz@gnu.org> * configure.ac (AC_CHECK_HEADERS): Add ws2tcpip.h. When checking whether socklen_t type is defined, use ws2tcpip.h if it is available and sys/socket.h isn't. * configure: Regenerate. * config.in: Regenerate.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/ChangeLog8
-rw-r--r--gdbserver/config.in3
-rwxr-xr-xgdbserver/configure8
-rw-r--r--gdbserver/configure.ac8
4 files changed, 23 insertions, 4 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index f42b5c7..ee80fce 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,11 @@
+2020-07-26 Eli Zaretskii <eliz@gnu.org>
+
+ * configure.ac (AC_CHECK_HEADERS): Add ws2tcpip.h.
+ When checking whether socklen_t type is defined, use ws2tcpip.h if
+ it is available and sys/socket.h isn't.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2020-07-22 Pedro Alves <pedro@palves.net>
* inferiors.cc (switch_to_process): New, moved here from
diff --git a/gdbserver/config.in b/gdbserver/config.in
index 07213aa..c2ac4fe 100644
--- a/gdbserver/config.in
+++ b/gdbserver/config.in
@@ -378,6 +378,9 @@
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
diff --git a/gdbserver/configure b/gdbserver/configure
index 0f77ac6..1f9c3f8 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -9148,7 +9148,7 @@ else CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
fi
-for ac_header in termios.h sys/reg.h string.h sys/procfs.h linux/elf.h fcntl.h signal.h sys/file.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h
+for ac_header in termios.h sys/reg.h string.h sys/procfs.h linux/elf.h fcntl.h signal.h sys/file.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h ws2tcpip.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -10044,7 +10044,11 @@ _ACEOF
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h>
-#include <sys/socket.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
"
if test "x$ac_cv_type_socklen_t" = xyes; then :
diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac
index 10f2f4c..4c7e392 100644
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -75,7 +75,7 @@ AC_CHECK_HEADERS(termios.h sys/reg.h string.h dnl
sys/procfs.h linux/elf.h dnl
fcntl.h signal.h sys/file.h dnl
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
- netinet/tcp.h arpa/inet.h)
+ netinet/tcp.h arpa/inet.h ws2tcpip.h)
AC_FUNC_FORK
AC_CHECK_FUNCS(pread pwrite pread64)
@@ -147,7 +147,11 @@ AC_CHECK_DECLS([perror, vasprintf, vsnprintf])
AC_CHECK_TYPES(socklen_t, [], [],
[#include <sys/types.h>
-#include <sys/socket.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
])
case "${target}" in