diff --git a/Headers/GNUstepBase/config.h.in b/Headers/GNUstepBase/config.h.in index d6d02a022..7416d509e 100644 --- a/Headers/GNUstepBase/config.h.in +++ b/Headers/GNUstepBase/config.h.in @@ -601,6 +601,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* if struct sockaddr_storage is defined */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + /* Define to 1 if `st_birthtimespec' is a member of `struct stat64'. */ #undef HAVE_STRUCT_STAT64_ST_BIRTHTIMESPEC diff --git a/Source/GSSocketStream.h b/Source/GSSocketStream.h index e71445e95..d7d44f747 100644 --- a/Source/GSSocketStream.h +++ b/Source/GSSocketStream.h @@ -38,6 +38,9 @@ typedef union { #ifndef _WIN32 struct sockaddr_un u; #endif +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage m; +#endif } sockaddr_any; #define SOCKIVARS \ diff --git a/configure b/configure index afb6ee65f..0c3cc7654 100755 --- a/configure +++ b/configure @@ -5487,7 +5487,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -5533,7 +5533,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -5557,7 +5557,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -5602,7 +5602,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -5626,7 +5626,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -9254,6 +9254,40 @@ _ACEOF fi +#-------------------------------------------------------------------- +# This needed by GSSocketStream.h +#-------------------------------------------------------------------- +ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " +#undef inline +#ifdef HAVE_WINDOWS_H +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +" +if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : + +$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h + +fi + + + #-------------------------------------------------------------------- # These headers/functions needed for stacktrace in NSException.m #-------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 7bc918587..c3d5fa6f7 100644 --- a/configure.ac +++ b/configure.ac @@ -2398,6 +2398,35 @@ AC_CHECK_FUNCS(time ctime tzset) #-------------------------------------------------------------------- AC_CHECK_HEADERS(sys/socket.h netinet/in.h) AC_CHECK_TYPES([socklen_t]) + +#-------------------------------------------------------------------- +# This needed by GSSocketStream.h +#-------------------------------------------------------------------- +AC_CHECK_TYPE([struct sockaddr_storage], + AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, + [if struct sockaddr_storage is defined]), ,[ +#undef inline +#ifdef HAVE_WINDOWS_H +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif +]) + dnl AC_REPLACE_FUNCS(recvfrom) #--------------------------------------------------------------------