diff --git a/configure b/configure index d067b54a304..29b50e82970 100755 --- a/configure +++ b/configure @@ -12287,7 +12287,10 @@ $as_echo "$ac_cv_cflags__Wwrite_strings" >&6; } if test $ac_cv_cflags__Wwrite_strings = yes; then : EXTRACFLAGS="$EXTRACFLAGS -Wwrite-strings" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -gdwarf-2" >&5 + + for ac_flag in $CFLAGS; do + case $ac_flag in + -g) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -gdwarf-2" >&5 $as_echo_n "checking whether the compiler supports -gdwarf-2... " >&6; } if ${ac_cv_cflags__gdwarf_2+:} false; then : $as_echo_n "(cached) " >&6 @@ -12312,7 +12315,7 @@ $as_echo "$ac_cv_cflags__gdwarf_2" >&6; } if test $ac_cv_cflags__gdwarf_2 = yes; then : EXTRACFLAGS="$EXTRACFLAGS -gdwarf-2" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -gstrict-dwarf" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -gstrict-dwarf" >&5 $as_echo_n "checking whether the compiler supports -gstrict-dwarf... " >&6; } if ${ac_cv_cflags__gstrict_dwarf+:} false; then : $as_echo_n "(cached) " >&6 @@ -12336,7 +12339,9 @@ fi $as_echo "$ac_cv_cflags__gstrict_dwarf" >&6; } if test $ac_cv_cflags__gstrict_dwarf = yes; then : EXTRACFLAGS="$EXTRACFLAGS -gstrict-dwarf" -fi +fi ;; + esac + done case $host_cpu in *i[3456789]86*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-omit-frame-pointer" >&5 diff --git a/configure.ac b/configure.ac index 15ada869a6e..a6be56fb662 100644 --- a/configure.ac +++ b/configure.ac @@ -1748,8 +1748,14 @@ then WINE_TRY_CFLAGS([-Wtype-limits]) WINE_TRY_CFLAGS([-Wunused-but-set-parameter]) WINE_TRY_CFLAGS([-Wwrite-strings]) - WINE_TRY_CFLAGS([-gdwarf-2]) - WINE_TRY_CFLAGS([-gstrict-dwarf]) + + dnl Default to dwarf-2 debug info + for ac_flag in $CFLAGS; do + case $ac_flag in + -g) WINE_TRY_CFLAGS([-gdwarf-2]) + WINE_TRY_CFLAGS([-gstrict-dwarf]) ;; + esac + done dnl gcc-4.6+ omits frame pointers by default, breaking some copy protections case $host_cpu in