aboutsummaryrefslogtreecommitdiff
path: root/gdb
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 /gdb
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 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/config.in6
-rwxr-xr-xgdb/configure31
-rw-r--r--gdb/configure.ac9
4 files changed, 52 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0c2c655..c8af86b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2020-07-25 Andrew Burgess <andrew.burgess@embecosm.com>
PR fortran/23051
diff --git a/gdb/config.in b/gdb/config.in
index 340c421..2605347 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -505,6 +505,9 @@
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
+/* Define to 1 if you have the <sys/sockets.h> header file. */
+#undef HAVE_SYS_SOCKETS_H
+
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
@@ -568,6 +571,9 @@
/* Define to 1 if you have the `wresize' function. */
#undef HAVE_WRESIZE
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
/* Define to 1 if you have the `XML_StopParser' function. */
#undef HAVE_XML_STOPPARSER
diff --git a/gdb/configure b/gdb/configure
index 06b11e2..c9a4b42 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -11844,6 +11844,31 @@ fi
done
+for ac_header in sys/sockets.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/sockets.h" "ac_cv_header_sys_sockets_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_sockets_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SOCKETS_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in ws2tcpip.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default"
+if test "x$ac_cv_header_ws2tcpip_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_WS2TCPIP_H 1
+_ACEOF
+
+fi
+
+done
+
+
# ------------------------- #
# Checks for declarations. #
# ------------------------- #
@@ -12059,7 +12084,11 @@ $as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h
# ------------------ #
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/gdb/configure.ac b/gdb/configure.ac
index f9461b2..3bec215 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1248,6 +1248,9 @@ AC_CHECK_HEADERS(term.h, [], [],
#endif
])
+AC_CHECK_HEADERS([sys/sockets.h])
+AC_CHECK_HEADERS([ws2tcpip.h])
+
# ------------------------- #
# Checks for declarations. #
# ------------------------- #
@@ -1263,7 +1266,11 @@ AM_LC_MESSAGES
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
])
# ------------------------------------- #