From 9fc21dc294a65795c3e923fd27d411bb7306e75b Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Sat, 29 Feb 2020 22:30:28 +0100 Subject: [PATCH] Allow GNU extensions for GCC to avoid MinGW bugs Most MinGW versions work correctly with and without _POSIX_C_SOURCE or XOPEN macros [1] and don't need any special handling, but some installations refuse to work correctly. To be more precise: *some* MinGW installations turn off POSIX support after turning on -std=c++11 WITHOUT -ansi -Wpedantic, -pedantic-errors and similar. This behaviour is inconsistent between various Windows versions and MinGW distributions and manifests itself only when using GCC (Clang behaves correctly). [1] https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html --- configure.ac | 5 +++-- src/dos/drive_local.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index b7eaa78d..db106e86 100644 --- a/configure.ac +++ b/configure.ac @@ -54,8 +54,9 @@ AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(int *) -dnl Require compiler with C++11 support, do not use GNU extensions. -AX_CXX_COMPILE_STDCXX_11(noext, mandatory) +dnl Require compiler with C++11 support. +dnl Allow GNU extensions to work around MinGW bugs around POSIX compatibility. +AX_CXX_COMPILE_STDCXX_11(ext, mandatory) dnl some semi complex check for sys/socket so it works on darwin as well AC_CHECK_HEADERS([stdlib.h sys/types.h]) diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index 21a622a9..55702d52 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -19,16 +19,16 @@ // Uncomment to enable file-open diagnostic messages // #define DEBUG 1 -#include +#include "drives.h" + +#include #include #include #include #include -#include "dosbox.h" #include "dos_inc.h" #include "dos_mscdex.h" -#include "drives.h" #include "support.h" #include "cross.h" #include "inout.h"