configure: Allow expressing dwarf version in CFLAGS and CROSSCFLAGS.

Based on a patch from Jacek Caban.

usage:
     configure CFLAGS="-gdwarf-4 -O2"
   will enable dwarf4 compilation for ELF parts
   (and CROSSCFLAGS="-gdwarf-4 -O2" for PE parts)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-11-03 10:24:02 +01:00 committed by Alexandre Julliard
parent b9e38a41ea
commit 6c8500d05e
2 changed files with 51 additions and 19 deletions

38
configure vendored
View File

@ -10395,8 +10395,17 @@ fi ;;
esac
done
fi
case $CROSSDEBUG in
*dwarf) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5
ac_debug_format_seen=""
for ac_flag in $CROSSCFLAGS; do
case $ac_flag in
-gdwarf*|-gcodeview) ac_debug_format_seen=$ac_flag ;;
esac
done
if test "x$ac_debug_format_seen" = x
then
case $CROSSDEBUG in
*dwarf) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5
$as_echo_n "checking whether the cross-compiler supports -gdwarf-2... " >&6; }
if ${ac_cv_crosscflags__gdwarf_2+:} false; then :
$as_echo_n "(cached) " >&6
@ -10427,7 +10436,7 @@ $as_echo "$ac_cv_crosscflags__gdwarf_2" >&6; }
if test "x$ac_cv_crosscflags__gdwarf_2" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gdwarf-2"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gstrict-dwarf" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gstrict-dwarf" >&5
$as_echo_n "checking whether the cross-compiler supports -gstrict-dwarf... " >&6; }
if ${ac_cv_crosscflags__gstrict_dwarf+:} false; then :
$as_echo_n "(cached) " >&6
@ -10458,7 +10467,7 @@ $as_echo "$ac_cv_crosscflags__gstrict_dwarf" >&6; }
if test "x$ac_cv_crosscflags__gstrict_dwarf" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gstrict-dwarf"
fi ;;
pdb) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gcodeview" >&5
pdb) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gcodeview" >&5
$as_echo_n "checking whether the cross-compiler supports -gcodeview... " >&6; }
if ${ac_cv_crosscflags__gcodeview+:} false; then :
$as_echo_n "(cached) " >&6
@ -10489,7 +10498,8 @@ $as_echo "$ac_cv_crosscflags__gcodeview" >&6; }
if test "x$ac_cv_crosscflags__gcodeview" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gcodeview"
fi ;;
esac
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -fexcess-precision=standard" >&5
$as_echo_n "checking whether the cross-compiler supports -fexcess-precision=standard... " >&6; }
@ -16301,9 +16311,16 @@ $as_echo "$wine_cv_64bit_compare_swap" >&6; }
*) EXTRACFLAGS="$EXTRACFLAGS $wine_cv_64bit_compare_swap" ;;
esac
for ac_flag in $CFLAGS; do
ac_debug_format_seen=""
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
-gdwarf*) ac_debug_format_seen=yes ;;
-g) ac_debug_format_seen=${ac_debug_format_seen:-default} ;;
esac
done
if test "x$ac_debug_format_seen" = xdefault
then
{ $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
@ -16328,7 +16345,7 @@ $as_echo "$ac_cv_cflags__gdwarf_2" >&6; }
if test "x$ac_cv_cflags__gdwarf_2" = xyes; 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
@ -16352,9 +16369,8 @@ fi
$as_echo "$ac_cv_cflags__gstrict_dwarf" >&6; }
if test "x$ac_cv_cflags__gstrict_dwarf" = xyes; then :
EXTRACFLAGS="$EXTRACFLAGS -gstrict-dwarf"
fi ;;
esac
done
fi
fi
MSVCRTFLAGS=""

View File

@ -1018,11 +1018,21 @@ then
esac
done
fi
case $CROSSDEBUG in
*dwarf) WINE_TRY_CROSSCFLAGS([-gdwarf-2])
WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;;
pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;;
esac
ac_debug_format_seen=""
for ac_flag in $CROSSCFLAGS; do
case $ac_flag in
-gdwarf*|-gcodeview) ac_debug_format_seen=$ac_flag ;;
esac
done
if test "x$ac_debug_format_seen" = x
then
case $CROSSDEBUG in
*dwarf) WINE_TRY_CROSSCFLAGS([-gdwarf-2])
WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;;
pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;;
esac
fi
WINE_TRY_CROSSCFLAGS([-fexcess-precision=standard],[AC_SUBST(EXCESS_PRECISION_CFLAGS,"-fexcess-precision=standard")])
@ -1822,13 +1832,19 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=
*) EXTRACFLAGS="$EXTRACFLAGS $wine_cv_64bit_compare_swap" ;;
esac
dnl Default to dwarf-2 debug info
dnl Determine debug info format
ac_debug_format_seen=""
for ac_flag in $CFLAGS; do
case $ac_flag in
-g) WINE_TRY_CFLAGS([-gdwarf-2])
WINE_TRY_CFLAGS([-gstrict-dwarf]) ;;
-gdwarf*) ac_debug_format_seen=yes ;;
-g) ac_debug_format_seen=${ac_debug_format_seen:-default} ;;
esac
done
if test "x$ac_debug_format_seen" = xdefault
then
WINE_TRY_CFLAGS([-gdwarf-2])
WINE_TRY_CFLAGS([-gstrict-dwarf])
fi
dnl Disable gcc builtins except for Mingw
AC_SUBST(MSVCRTFLAGS,"")