#include <stdlib.h> /* before the following definitions */
#include <unistd.h> /* before the following definitions */
+#include <fcntl.h>
+#include <sys/stat.h>
#define chdir _chdir2
#define getcwd _getcwd2
#define PERLIO_IS_BINMODE_FD(fd) _PERLIO_IS_BINMODE_FD(fd)
+#ifdef __GNUG__
+# define HAS_BOOL
+#endif
+#ifndef HAS_BOOL
+# define bool char
+# define HAS_BOOL 1
+#endif
+
+#include <emx/io.h> /* for _fd_flags() prototype */
+
static inline bool
_PERLIO_IS_BINMODE_FD(int fd)
{