]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
GDB: Only build for "unix:" connections if AF_LOCAL is supported.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 28 Oct 2018 19:14:24 +0000 (20:14 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 29 Oct 2018 07:07:32 +0000 (08:07 +0100)
Commit f19c7ff839d7a32ebb48482ae7d318fb46ca823d added a new member to the
prefixes array which included a use of the symbol AF_LOCAL.   Unfortunately,
not all systems declare this symbol.    This change only compiles the "unix:"
member if the system knows about AF_LOCAL.

gdb/ChangeLog:

* configure.ac: New test HAVE_AF_LOCAL
* common/netstuff.c (parse_connection_spec) [prefixes]: Only compile "unix:"
   if HAVE_AF_LOCAL is true.
* configure: regenerate.
* config.in: regenerate.

gdb/ChangeLog
gdb/common/netstuff.c
gdb/config.in
gdb/configure
gdb/configure.ac

index 6742fad0148a3bcde13a4f17a2fed40618e8e945..2d89f831116e25b4d799052525c19d8a4e892850 100644 (file)
@@ -1,3 +1,11 @@
+2018-10-29   John Darrington <john@darrington.wattle.id.au>
+
+       * configure.ac: New test HAVE_AF_LOCAL
+       * common/netstuff.c (parse_connection_spec) [prefixes]: Only compile "unix:"
+       if HAVE_AF_LOCAL is true.
+       * configure: regenerate.
+       * config.in: regenerate.
+
 2018-10-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
index 11182c1e87ed81712714d4b07258c784fd54274d..56bcdfca72e51c3386459574d4e16d17c2c16d79 100644 (file)
@@ -145,7 +145,9 @@ parse_connection_spec (const char *spec, struct addrinfo *hint)
       { "tcp4:", AF_INET,   SOCK_STREAM },
       { "udp6:", AF_INET6,  SOCK_DGRAM },
       { "tcp6:", AF_INET6,  SOCK_STREAM },
+#if HAVE_AF_LOCAL
       { "unix:", AF_LOCAL,  SOCK_STREAM },
+#endif
     };
 
   for (const host_prefix prefix : prefixes)
index f0d14143520218de008d1b39d4fa83b9d4ea95c2..a9d7edc209d665532c11f2db46fb3285eb3b7848 100644 (file)
@@ -68,6 +68,9 @@
 /* Define if self-testing features should be enabled */
 #undef GDB_SELF_TEST
 
+/* Define to 1 if AF_LOCAL is defined or declared by sys/socket.h. */
+#undef HAVE_AF_LOCAL
+
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
index 3652455322f5bfe5f9caf967ddc6f785372eb976..a2e7f026f398694c1eb09f114c6f96265aadfdbe 100755 (executable)
@@ -13997,6 +13997,27 @@ _ACEOF
 fi
 
 
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/socket.h>
+
+int
+main ()
+{
+int x = AF_LOCAL
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_AF_LOCAL 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 if test "$cross_compiling" = no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setpgrp takes no argument" >&5
 $as_echo_n "checking whether setpgrp takes no argument... " >&6; }
index b2343a90e5fa6d2810465caff9441ce042f51282..7d5e027ada6e0f5fb405b34fcd256f7eb2a0c996 100644 (file)
@@ -1366,6 +1366,16 @@ GDB_AC_COMMON
 # Check the return and argument types of ptrace.
 GDB_AC_PTRACE
 
+dnl Check to see if sys/socket.h knows about AF_LOCAL
+AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM([[
+#include <sys/socket.h>
+]],
+        [[int x = AF_LOCAL]])],
+[AC_DEFINE([HAVE_AF_LOCAL], [1],
+     [Define to 1 if AF_LOCAL is defined or declared by sys/socket.h.])])
+
+
 dnl AC_FUNC_SETPGRP does not work when cross compiling
 dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
 if test "$cross_compiling" = no; then