[flac-dev] [PATCH] Fix compile with cygwin

Rosen Penev rosenp at gmail.com
Thu Feb 9 03:42:42 UTC 2017


The underscores are wrong. The comment is also correct.

Also remove the configure.ac option. Otherwise it tries to compile the
windows unicode stuff which POSIX(cygwin) does not understand.
---
 configure.ac                 | 2 +-
 include/share/compat.h       | 2 +-
 src/libFLAC/stream_decoder.c | 3 ---
 src/libFLAC/stream_encoder.c | 3 ---
 src/share/grabbag/file.c     | 8 +-------
 5 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index c5b6337..9a1570c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,7 +185,7 @@ AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
 
 os_is_windows=no
 case "$host" in
-	*-*-cygwin|*mingw*)
+	*mingw*)
 		CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
 		os_is_windows=yes
 		;;
diff --git a/include/share/compat.h b/include/share/compat.h
index f74a5c1..2ad40fb 100644
--- a/include/share/compat.h
+++ b/include/share/compat.h
@@ -98,7 +98,7 @@
 #define FLAC__STRNCASECMP strncasecmp
 #endif
 
-#if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__
+#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
 #include <io.h> /* for _setmode(), chmod() */
 #include <fcntl.h> /* for _O_BINARY */
 #else
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index 2e1fdd5..d3b6e03 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -1253,9 +1253,6 @@ FILE *get_binary_stdin_(void)
 	 */
 #if defined _MSC_VER || defined __MINGW32__
 	_setmode(_fileno(stdin), _O_BINARY);
-#elif defined __CYGWIN__
-	/* almost certainly not needed for any modern Cygwin, but let's be safe... */
-	setmode(_fileno(stdin), _O_BINARY);
 #elif defined __EMX__
 	setmode(fileno(stdin), O_BINARY);
 #endif
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c
index 1993ec5..665fe55 100644
--- a/src/libFLAC/stream_encoder.c
+++ b/src/libFLAC/stream_encoder.c
@@ -4540,9 +4540,6 @@ FILE *get_binary_stdout_(void)
 	 */
 #if defined _MSC_VER || defined __MINGW32__
 	_setmode(_fileno(stdout), _O_BINARY);
-#elif defined __CYGWIN__
-	/* almost certainly not needed for any modern Cygwin, but let's be safe... */
-	setmode(_fileno(stdout), _O_BINARY);
 #elif defined __EMX__
 	setmode(fileno(stdout), O_BINARY);
 #endif
diff --git a/src/share/grabbag/file.c b/src/share/grabbag/file.c
index 4cbef9d..3a97292 100644
--- a/src/share/grabbag/file.c
+++ b/src/share/grabbag/file.c
@@ -29,7 +29,7 @@
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
 #include <utime.h> /* for utime() */
 #endif
-#if defined __CYGWIN__ || defined __EMX__
+#if defined __EMX__
 #include <io.h> /* for setmode(), O_BINARY */
 #include <fcntl.h> /* for _O_BINARY */
 #endif
@@ -164,9 +164,6 @@ FILE *grabbag__file_get_binary_stdin(void)
 	 */
 #if defined _MSC_VER || defined __MINGW32__
 	_setmode(_fileno(stdin), _O_BINARY);
-#elif defined __CYGWIN__
-	/* almost certainly not needed for any modern Cygwin, but let's be safe... */
-	setmode(_fileno(stdin), _O_BINARY);
 #elif defined __EMX__
 	setmode(fileno(stdin), O_BINARY);
 #endif
@@ -182,9 +179,6 @@ FILE *grabbag__file_get_binary_stdout(void)
 	 */
 #if defined _MSC_VER || defined __MINGW32__
 	_setmode(_fileno(stdout), _O_BINARY);
-#elif defined __CYGWIN__
-	/* almost certainly not needed for any modern Cygwin, but let's be safe... */
-	setmode(_fileno(stdout), _O_BINARY);
 #elif defined __EMX__
 	setmode(fileno(stdout), O_BINARY);
 #endif
-- 
2.8.3



More information about the flac-dev mailing list