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
This commit is contained in:
Sam Lantinga 2022-10-04 16:46:29 -07:00
parent cbb1cf0c93
commit f18fae4c68
2 changed files with 57 additions and 0 deletions

36
configure vendored
View File

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

View File

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