From e2aab4b5db88c368c11cee81368b9ad41399e585 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 12 Feb 2013 15:35:32 -0500 Subject: [PATCH] Improve checks for setmode() As reported by Jonathan, OS X has setmode() that is something other than what setmode() is on Win32. So, limit invocation to Windows platforms only. --- configure.ac | 4 ++-- util/options.cc | 4 ++-- util/options.hh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8ae0d0141..370cba3ea 100644 --- a/configure.ac +++ b/configure.ac @@ -55,8 +55,8 @@ dnl GOBJECT_INTROSPECTION_CHECK([0.9.0]) dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) # Functions and headers -AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap setmode isatty) -AC_CHECK_HEADERS(unistd.h sys/mman.h io.h) +AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty) +AC_CHECK_HEADERS(unistd.h sys/mman.h) # Compiler flags AC_CANONICAL_HOST diff --git a/util/options.cc b/util/options.cc index bd4d55e3e..5e575482c 100644 --- a/util/options.cc +++ b/util/options.cc @@ -413,7 +413,7 @@ font_options_t::get_font (void) const /* read it */ GString *gs = g_string_new (NULL); char buf[BUFSIZ]; -#ifdef HAVE_SETMODE +#if defined(_WIN32) || defined(__CYGWIN__) setmode (fileno (stdin), _O_BINARY); #endif while (!feof (stdin)) { @@ -557,7 +557,7 @@ output_options_t::get_file_handle (void) if (output_file) fp = fopen (output_file, "wb"); else { -#ifdef HAVE_SETMODE +#if defined(_WIN32) || defined(__CYGWIN__) setmode (fileno (stdout), _O_BINARY); #endif fp = stdout; diff --git a/util/options.hh b/util/options.hh index 298a3f268..89440671f 100644 --- a/util/options.hh +++ b/util/options.hh @@ -43,7 +43,7 @@ #ifdef HAVE_UNISTD_H #include /* for isatty() */ #endif -#ifdef HAVE_IO_H +#if defined(_WIN32) || defined(__CYGWIN__) #include /* for setmode() under Windows */ #endif