Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -937,11 +937,11 @@ AC_MSG_RESULT(no) ]) OBJCFLAGS="$old_OBJCFLAGS" ]) -AC_CHECK_HEADERS(fcntl.h) +AC_CHECK_HEADERS(fcntl.h dirent.h) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl]) AC_CHECK_HEADERS(xlocale.h) AC_CHECK_FUNCS([strtod_l strtof_l asprintf_l]) Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -20,11 +20,14 @@ #include #include #include #include -#include + +#ifdef HAVE_UNISTD_H +# include +#endif #import "OFApplication.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -16,12 +16,16 @@ #include "config.h" #include -#include -#include +#ifdef HAVE_FCNTL_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif #include "platform.h" #ifdef OF_WII # define BOOL OGC_BOOL Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -16,12 +16,16 @@ #include "config.h" #include -#include -#include +#ifdef HAVE_DIRENT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif #ifdef HAVE_PWD_H # include #endif #ifdef HAVE_GRP_H Index: src/OFKernelEventObserver_epoll.m ================================================================== --- src/OFKernelEventObserver_epoll.m +++ src/OFKernelEventObserver_epoll.m @@ -17,12 +17,16 @@ #include "config.h" #include #include -#include -#include +#ifdef HAVE_FCNTL_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif #include #import "OFKernelEventObserver.h" #import "OFKernelEventObserver+Private.h" Index: src/OFKernelEventObserver_kqueue.m ================================================================== --- src/OFKernelEventObserver_kqueue.m +++ src/OFKernelEventObserver_kqueue.m @@ -18,12 +18,16 @@ #include #include #include -#include -#include +#ifdef HAVE_FCNTL_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -24,13 +24,17 @@ # undef __USE_XOPEN #endif #include "platform.h" -#ifndef OF_WINDOWS +#include + +#ifdef HAVE_UNISTD_H # include -# include +#endif + +#ifndef OF_WINDOWS # include #endif #ifdef HAVE_SPAWN_H # include Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -21,11 +21,14 @@ #ifdef __GLIBC__ # undef __USE_XOPEN #endif #include -#include + +#ifdef HAVE_UNISTD_H +# include +#endif #ifdef HAVE_SYS_IOCTL_H # include #endif #ifdef HAVE_SYS_TTYCOM_H Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -22,11 +22,13 @@ #include /* include any libc header to get the libc defines */ #ifdef __GLIBC__ # undef __USE_XOPEN #endif -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include "platform.h" #ifdef OF_MACOS # include Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -23,11 +23,13 @@ #include #include #include #include -#include +#ifdef HAVE_FCNTL_H +# include +#endif #import "OFTCPSocket.h" #import "OFTCPSocket+SOCKS5.h" #import "OFString.h" #import "OFThread.h" Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -29,11 +29,11 @@ # undef __USE_XOPEN #endif #include "platform.h" -#ifndef OF_WINDOWS +#ifdef HAVE_UNISTD_H # include #endif #ifdef OF_HAVE_SCHED_YIELD # include Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -18,11 +18,13 @@ #include #include #include -#include +#ifdef HAVE_FCNTL_H +# include +#endif #import "OFUDPSocket.h" #ifdef OF_HAVE_THREADS # import "OFThread.h" #endif Index: src/socket_helpers.h ================================================================== --- src/socket_helpers.h +++ src/socket_helpers.h @@ -19,11 +19,13 @@ /* Work around __block being used by glibc */ #ifdef __GLIBC__ # undef __USE_XOPEN #endif -#include +#ifdef HAVE_UNISTD_H +# include +#endif #ifdef HAVE_ARPA_INET_H # include #endif #ifdef HAVE_NETDB_H