tOnly add -mno-cygwin if it's supported - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
commit 4c555ca0b733003f4715ff6e2fe246cc7b3d9945
parent 5c386c4f9e1a127012940dac10ce33ec14f23eb0
Author: Ben Webb 
Date:   Sat,  7 Nov 2020 01:03:39 -0800

Only add -mno-cygwin if it's supported

For example, the mingw64 compilers do not need
tthis flag to generate Windows binaries
(and won't understand it).

Diffstat:
  M configure.ac                        |      20 ++++++++++++++------

1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
t@@ -88,14 +88,22 @@ if test "$CYGWIN" = "yes" ; then
    AC_MSG_RESULT($mscompat)
    CFLAGS="$bkp_CFLAGS"
 
+   dnl If using older Cygwin -mno-cygwin is included in CPPFLAGS so the
+   dnl right headers are detected (in /usr/include/mingw/ rather than
+   dnl /usr/include) later on - e.g. sys/param.h isn't in mingw.
+   bkp_CFLAGS="$CFLAGS"
+   AC_MSG_CHECKING(for no-Cygwin flag)
+   CFLAGS="$CFLAGS -no-cygwin"
+   AC_COMPILE_IFELSE([ AC_LANG_PROGRAM() ], [ nocyg="-no-cygwin" ],
+                     [ nocyg="" ])
+   AC_MSG_RESULT($nocyg)
+   CFLAGS="$bkp_CFLAGS"
+
    dnl Libraries and flags
-   dnl N.B. -mno-cygwin is included in CPPFLAGS so the right headers
-   dnl are detected (in /usr/include/mingw/ rather than /usr/include)
-   dnl later on - e.g. sys/param.h isn't in mingw.
-   CFLAGS="$CFLAGS -mwindows $mscompat"
-   CPPFLAGS="$CPPFLAGS -mno-cygwin"
+   CFLAGS="$CFLAGS -mwindows $mscompat $nocyg"
+   CPPFLAGS="$CPPFLAGS $nocyg"
    LIBS="$LIBS -lwsock32 -lcomctl32 -lmpr"
-   LDFLAGS="$LDFLAGS -mno-cygwin"
+   LDFLAGS="$LDFLAGS $nocyg"
 
    AM_PATH_GLIB_2_0(2.0.0, , [AC_MSG_ERROR(GLib is required)])