Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1459,10 +1459,17 @@ AC_DEFINE(OF_HAVE_IPX, 1, [Whether we have IPX/SPX]) AC_SUBST(USE_SRCS_IPX, '${SRCS_IPX}') ]) ]) + AC_CHECK_HEADERS(afunix.h, [ + AC_DEFINE(OF_HAVE_AFUNIX_H, 1, [Whether we have afunix.h]) + ], [], [ + #ifdef _WIN32 + # include + #endif + ]) AC_CHECK_MEMBER(struct sockaddr_un.sun_path, [ AC_DEFINE(OF_HAVE_UNIX_SOCKETS, 1, [Whether we have UNIX sockets]) AC_SUBST(USE_SRCS_UNIX_SOCKETS, '${SRCS_UNIX_SOCKETS}') ], [], [ @@ -1470,10 +1477,16 @@ # include #endif #ifdef OF_HAVE_SYS_UN_H # include #endif + #ifdef _WIN32 + # include + #endif + #ifdef HAVE_AFUNIX_H + # include + #endif #ifdef __morphos__ # error MorphOS has the struct but does not support it #endif ]) Index: src/OFSocket.h ================================================================== --- src/OFSocket.h +++ src/OFSocket.h @@ -38,10 +38,13 @@ #ifdef OF_HAVE_NETIPX_IPX_H # include #endif #ifdef OF_HAVE_SYS_UN_H # include +#endif +#ifdef OF_HAVE_AFUNIX_H +# include #endif #ifdef OF_WINDOWS # include # include Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -1,8 +1,9 @@ #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN +#undef OF_HAVE_AFUNIX_H #undef OF_HAVE_ATOMIC_BUILTINS #undef OF_HAVE_ATOMIC_OPS #undef OF_HAVE_BUILTIN_BSWAP16 #undef OF_HAVE_BUILTIN_BSWAP32 #undef OF_HAVE_BUILTIN_BSWAP64 Index: tests/OFUNIXDatagramSocketTests.m ================================================================== --- tests/OFUNIXDatagramSocketTests.m +++ tests/OFUNIXDatagramSocketTests.m @@ -40,15 +40,29 @@ */ path = [OFString stringWithFormat: @"/tmp/%@", [[OFUUID UUID] UUIDString]]; #endif - @try { - TEST(@"+[socket]", (sock = [OFUNIXDatagramSocket socket])) + TEST(@"+[socket]", (sock = [OFUNIXDatagramSocket socket])) + @try { TEST(@"-[bindToPath:]", R(address1 = [sock bindToPath: path])) + } @catch (OFBindFailedException *e) { + if (e.errNo == EAFNOSUPPORT) { + [OFStdOut setForegroundColor: [OFColor lime]]; + [OFStdOut writeLine: + @"\r[OFUNIXDatagramSocket] -[bindToPath:]: " + @"UNIX datagram sockets unsupported, skipping " + @"tests"]; + + objc_autoreleasePoolPop(pool); + return; + } else + @throw e; + } + @try { TEST(@"-[sendBuffer:length:receiver:]", R([sock sendBuffer: "Hello" length: 5 receiver: &address1])) TEST(@"-[receiveIntoBuffer:length:sender:]", [sock receiveIntoBuffer: buffer