From cbe4ee4a9959610a5ab9d32a06c719f7f0d522ba Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Mon, 4 Jun 2012 15:16:35 +0200 Subject: [PATCH] Open stdout in binary mode to avoid inserting CR+LF line endings On windows files are openend by default in text mode, which inserts CR+LF line endings. This breaks most configure scripts that redirect pkg-config to a variable (eg: GLIB_CFLAGS) and then concatenates them. --- main.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index b42df6f..132160e 100644 --- a/main.c +++ b/main.c @@ -32,6 +32,7 @@ #ifdef G_OS_WIN32 #define STRICT #include +#include #undef STRICT #endif @@ -301,6 +302,12 @@ main (int argc, char **argv) { NULL, 0, 0, 0, NULL, NULL, NULL } }; +#ifndef G_OS_WIN32 + /* Open stdout in binary mode to avoid breaking concatenation of + * pkg-config results in configure scripts with CLRF line endings */ + _setmode(_fileno(stdout), _O_BINARY); +#endif + /* This is here so that we get debug spew from the start, * during arg parsing */ -- 1.7.5.4