1
0
Fork 0

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
This commit is contained in:
Patryk Obara 2020-02-29 22:30:28 +01:00 committed by Patryk Obara
parent a37664872c
commit 9fc21dc294
2 changed files with 6 additions and 5 deletions

View file

@ -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])

View file

@ -19,16 +19,16 @@
// Uncomment to enable file-open diagnostic messages
// #define DEBUG 1
#include <stdio.h>
#include "drives.h"
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "dosbox.h"
#include "dos_inc.h"
#include "dos_mscdex.h"
#include "drives.h"
#include "support.h"
#include "cross.h"
#include "inout.h"