diff --git a/Makefile.am b/Makefile.am index 4ac80e2..186fa85 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,7 +72,8 @@ config_include_HEADERS = \ include/libcork/config/gcc.h \ include/libcork/config/macosx.h \ include/libcork/config/bsd.h \ - include/libcork/config/linux.h \ + include/libcork/config/gnu.h \ + include/libcork/config/cygwin.h \ include/libcork/config/config.h core_include_HEADERS = \ diff --git a/include/libcork/config/config.h b/include/libcork/config/config.h index ca49047..adf9a5b 100644 --- a/include/libcork/config/config.h +++ b/include/libcork/config/config.h @@ -44,9 +44,9 @@ #include #endif -#if defined(__linux) || defined(__FreeBSD_kernel__) || defined(__GNU__) -/* Do some Linux, kFreeBSD or GNU/Hurd specific autodetection. */ -#include +#ifdef __GLIBC__ +/* Do some GNU specific autodetection. */ +#include #elif defined(__APPLE__) && defined(__MACH__) /* Do some Mac OS X-specific autodetection. */ @@ -56,6 +56,10 @@ /* Do some BSD (4.3 code base or newer)specific autodetection. */ #include +#elif defined(__CYGWIN__) +/* Do some Cygwin autodectection. */ +#include + #endif /* platforms */ diff --git a/include/libcork/config/cygwin.h b/include/libcork/config/cygwin.h new file mode 100644 index 0000000..b950de5 --- /dev/null +++ b/include/libcork/config/cygwin.h @@ -0,0 +1,33 @@ +/* -*- coding: utf-8 -*- + * ---------------------------------------------------------------------- + * Copyright © 2019, libcork authors + * All rights reserved. + * + * Please see the COPYING file in this distribution for license details. + * ---------------------------------------------------------------------- + */ + +#ifndef LIBCORK_CONFIG_CYGWIN_H +#define LIBCORK_CONFIG_CYGWIN_H + +/*----------------------------------------------------------------------- + * Endianness + */ + +#include + +#if __BYTE_ORDER == __BIG_ENDIAN +#define CORK_CONFIG_IS_BIG_ENDIAN 1 +#define CORK_CONFIG_IS_LITTLE_ENDIAN 0 +#elif __BYTE_ORDER == __LITTLE_ENDIAN +#define CORK_CONFIG_IS_BIG_ENDIAN 0 +#define CORK_CONFIG_IS_LITTLE_ENDIAN 1 +#else +#error "Cannot determine system endianness" +#endif + +#define CORK_HAVE_REALLOCF 1 +#define CORK_HAVE_PTHREADS 1 + + +#endif /* LIBCORK_CONFIG_CYGWIN_H */ diff --git a/include/libcork/config/linux.h b/include/libcork/config/gnu.h similarity index 88% rename from include/libcork/config/linux.h rename to include/libcork/config/gnu.h index de4a3d9..b8e6f9a 100644 --- a/include/libcork/config/linux.h +++ b/include/libcork/config/gnu.h @@ -7,8 +7,8 @@ * ---------------------------------------------------------------------- */ -#ifndef LIBCORK_CONFIG_LINUX_H -#define LIBCORK_CONFIG_LINUX_H +#ifndef LIBCORK_CONFIG_GNU_H +#define LIBCORK_CONFIG_GNU_H /*----------------------------------------------------------------------- * Endianness @@ -30,4 +30,4 @@ #define CORK_HAVE_PTHREADS 1 -#endif /* LIBCORK_CONFIG_LINUX_H */ +#endif /* LIBCORK_CONFIG_GNU_H */ diff --git a/src/libcork/posix/subprocess.c b/src/libcork/posix/subprocess.c index b1d23a5..904240e 100644 --- a/src/libcork/posix/subprocess.c +++ b/src/libcork/posix/subprocess.c @@ -497,7 +497,7 @@ cork_subprocess_is_finished(struct cork_subprocess *self) #if defined(__APPLE__) #include #define THREAD_YIELD pthread_yield_np -#elif defined(__linux__) || defined(BSD) || defined(__FreeBSD_kernel__) || defined(__GNU__) +#elif defined(__linux__) || defined(BSD) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__CYGWIN__) #include #define THREAD_YIELD sched_yield #else