Use DWARF 4 debug information when building using mingw See this bug for more information: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 Fixes https://github.com/libsdl-org/SDL/issues/6139
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
diff --git a/configure b/configure
index f626d12..c592ce2 100755
--- a/configure
+++ b/configure
@@ -22773,6 +22773,41 @@ printf "%s\n" "$have_clang_objc_arc" >&6; }
fi
}
+CheckGDwarf4()
+{
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -gdwarf-4 option" >&5
+printf %s "checking for GCC -gdwarf-4 option... " >&6; }
+ have_gcc_gdwarf4=no
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$save_CFLAGS -gdwarf-4"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int x = 0;
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ have_gcc_gdwarf4=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_gdwarf4" >&5
+printf "%s\n" "$have_gcc_gdwarf4" >&6; }
+ CFLAGS="$save_CFLAGS"
+
+ if test x$have_gcc_gdwarf4 = xyes; then
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4"
+ fi
+}
+
CheckVisibilityHidden()
{
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
@@ -28503,6 +28538,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h
if test x$enable_loadso = xyes; then
have_loadso=yes
fi
+ CheckGDwarf4
CheckDeclarationAfterStatement
CheckDummyVideo
CheckOffscreenVideo
diff --git a/configure.ac b/configure.ac
index 4a4023e..b75a9e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1515,6 +1515,26 @@ CheckObjectiveCARC()
fi
}
+dnl See if GCC's -gdwarf-4 is supported
+dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows
+CheckGDwarf4()
+{
+ AC_MSG_CHECKING(for GCC -gdwarf-4 option)
+ have_gcc_gdwarf4=no
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$save_CFLAGS -gdwarf-4"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ int x = 0;
+ ]],[])], [have_gcc_gdwarf4=yes],[])
+ AC_MSG_RESULT($have_gcc_gdwarf4)
+ CFLAGS="$save_CFLAGS"
+
+ if test x$have_gcc_gdwarf4 = xyes; then
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4"
+ fi
+}
+
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
@@ -3969,6 +3989,7 @@ case "$host" in
if test x$enable_loadso = xyes; then
have_loadso=yes
fi
+ CheckGDwarf4
CheckDeclarationAfterStatement
CheckDummyVideo
CheckOffscreenVideo