binutils-gdb/gdb/common
Pedro Alves 8658d16d9d common/filestuff.c: No sockets on DJGPP.
Building gdb with --host=i586-pc-msdosdjgpp ends up with:

 i586-pc-msdosdjgpp-gcc -g -O2 -I../../src/gdb/config/djgpp  -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I./../intl -I../../src/gdb/gnulib/import -Ibuild-gnulib/import    -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Werror -c -o filestuff.o -MT filestuff.o -MMD -MP -MF .deps/filestuff.Tpo ../../src/gdb/common/filestuff.c
 ../../src/gdb/common/filestuff.c:38:24: fatal error: sys/socket.h: No such file or directory

There are no sockets on djgpp.  This #ifdef's out the bits in the file
that use sockets, depending on whether winsock or sys/socket.h is
available.

As alternative approach, given ser-tcp.c, ser-pipe.c, etc. are split
into separate files, and which to use is selected by configure.ac:

 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
 SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
 case ${host} in
  *go32* ) SER_HARDWIRE=ser-go32.o ;;
  *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
  *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
 esac
 AC_SUBST(SER_HARDWIRE)

... I considered splitting filestuff.c similarly.  But I quickly gave
up on the idea, as it looked like a lot more complication over this
approach, for no real gain.  Plus, there are uses of these functions
outside the ser*.c framework.

gdbserver's configure.ac is already checking for sys/socket.h.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

	* common/filestuff.c [USE_WIN32API]: Define HAVE_SOCKETS.
	[HAVE_SYS_SOCKET_H]: Define HAVE_SOCKETS.
	(socket_mark_cloexec, gdb_socketpair_cloexec, gdb_socket_cloexec):
	Only define if HAVE_SOCKETS is defined.
	* configure.ac: Check for sys/socket.h.
	* config.in, configure: Regenerate.
2013-05-23 18:37:00 +00:00
..
agent.c PR gdb/7912: 2013-04-22 16:46:15 +00:00
agent.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ax.def Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
btrace-common.h Add branch trace information to struct thread_info. 2013-03-11 08:17:08 +00:00
buffer.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
buffer.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
common-utils.c Move savestring to common/common-utils.c, make gdbserver use it. 2013-02-14 17:11:41 +00:00
common-utils.h Move savestring to common/common-utils.c, make gdbserver use it. 2013-02-14 17:11:41 +00:00
filestuff.c common/filestuff.c: No sockets on DJGPP. 2013-05-23 18:37:00 +00:00
filestuff.h 2013-05-10 Joel Brobecker <brobecker@adacore.com> 2013-05-10 17:01:00 +00:00
format.c * ada-lang.c (ada_read_renaming_var_value): Pass const 2013-03-12 17:39:45 +00:00
format.h * ada-lang.c (ada_read_renaming_var_value): Pass const 2013-03-12 17:39:45 +00:00
gdb_assert.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_dirent.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_locale.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_signals.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_stat.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_string.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_thread_db.h Move fallback thread_db.h to a separate file. 2013-04-16 18:14:55 +00:00
gdb_vecs.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_vecs.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb_wait.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
glibc_thread_db.h Update glibc_thread_db.h from upstream. 2013-04-16 18:17:11 +00:00
host-defs.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-xstate.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
linux-btrace.c * common/linux-btrace.c: ARI fix: Include "gdb_wait.h" 2013-05-07 13:04:58 +00:00
linux-btrace.h Implement branch tracing on Linux based on perf_event such that it can be shared 2013-03-11 08:24:07 +00:00
linux-osdata.c PR gdb/7912: 2013-04-22 16:46:15 +00:00
linux-osdata.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
linux-procfs.c PR gdb/7912: 2013-04-22 16:46:15 +00:00
linux-procfs.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
linux-ptrace.c gdb/ 2013-03-10 18:07:57 +00:00
linux-ptrace.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptid.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptid.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
queue.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
signals.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
vec.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
vec.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
xml-utils.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
xml-utils.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00