diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 194fb851446..db214731846 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-05-23 Pedro Alves + + * 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 Pedro Alves * dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp) diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c index e7af3a5cf4a..daf96d9655c 100644 --- a/gdb/common/filestuff.c +++ b/gdb/common/filestuff.c @@ -34,10 +34,12 @@ #ifdef USE_WIN32API #include #include -#else +#define HAVE_SOCKETS 1 +#elif defined HAVE_SYS_SOCKET_H #include /* Define HAVE_F_GETFD if we plan to use F_GETFD. */ #define HAVE_F_GETFD F_GETFD +#define HAVE_SOCKETS 1 #endif #ifdef HAVE_SYS_RESOURCE_H @@ -277,6 +279,8 @@ maybe_mark_cloexec (int fd) mark_cloexec (fd); } +#ifdef HAVE_SOCKETS + /* Like maybe_mark_cloexec, but for callers that use SOCK_CLOEXEC. */ static void @@ -286,6 +290,8 @@ socket_mark_cloexec (int fd) mark_cloexec (fd); } +#endif + /* See filestuff.h. */ @@ -335,6 +341,7 @@ gdb_fopen_cloexec (const char *filename, const char *opentype) return result; } +#ifdef HAVE_SOCKETS /* See filestuff.h. */ int @@ -367,6 +374,7 @@ gdb_socket_cloexec (int namespace, int style, int protocol) return result; } +#endif /* See filestuff.h. */ diff --git a/gdb/config.in b/gdb/config.in index 6223b9284bc..7cd22e315c6 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -509,6 +509,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/gdb/configure b/gdb/configure index 5de43e7e28b..383d6348f90 100755 --- a/gdb/configure +++ b/gdb/configure @@ -8911,7 +8911,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # elf_hp.h is for HP/UX 64-bit shared library support. -for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \ +for ac_header in nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \ thread_db.h signal.h stddef.h \ stdlib.h string.h memory.h strings.h sys/fault.h \ sys/file.h sys/filio.h sys/ioctl.h sys/param.h \ diff --git a/gdb/configure.ac b/gdb/configure.ac index 5fcec522d37..46a97bd0dc1 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1089,7 +1089,7 @@ fi AC_HEADER_DIRENT AC_HEADER_STDC # elf_hp.h is for HP/UX 64-bit shared library support. -AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \ +AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \ thread_db.h signal.h stddef.h \ stdlib.h string.h memory.h strings.h sys/fault.h \ sys/file.h sys/filio.h sys/ioctl.h sys/param.h \