Eric Pouech : configure: Allow expressing dwarf version in CFLAGS and CROSSCFLAGS.

Alexandre Julliard julliard at winehq.org
Wed Nov 3 16:42:02 CDT 2021


Module: wine
Branch: master
Commit: 6c8500d05eb23453be7185e4b87975fcb8b4bc09
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6c8500d05eb23453be7185e4b87975fcb8b4bc09

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Wed Nov  3 10:24:02 2021 +0100

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 at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure    | 38 +++++++++++++++++++++++++++-----------
 configure.ac | 32 ++++++++++++++++++++++++--------
 2 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/configure b/configure
index 84c5b9bd996..6ace5856d32 100755
--- a/configure
+++ b/configure
@@ -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=""
 
diff --git a/configure.ac b/configure.ac
index 7c1e446814b..39c8e3a2a4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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,"")




More information about the wine-cvs mailing list