Add a configure check for -gdawrf-5. Set GDWARF_5_FLAG in atlocal.in to yes or no. Use AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) in debugedit.at. Signed-off-by: Mark Wielaard <mark@klomp.org> --- configure.ac | 10 ++++++++++ tests/atlocal.in | 2 +- tests/debugedit.at | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 09cc82e..b4bd749 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,16 @@ AC_FUNC_MMAP AC_FUNC_REALLOC AC_CHECK_FUNCS([memchr memset munmap strchr strdup strerror strrchr]) +# Checks for compiler flags. +AC_CACHE_CHECK([whether gcc supports -gdwarf-5], ac_cv_gdwarf_5, [dnl +save_CFLAGS="$CFLAGS" +CFLAGS="-gdwarf-5" +AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_gdwarf_5=yes, ac_cv_gdwarf_5=no) +CFLAGS="$save_CFLAGS" +]) +GDWARF_5_FLAG=$ac_cv_gdwarf_5 +AC_SUBST([GDWARF_5_FLAG]) + # And generate the output files. AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/tests/atlocal.in b/tests/atlocal.in index 4b7303b..1324898 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -2,4 +2,4 @@ # Configurable variable values for test suite. PATH=@abs_builddir@:@abs_top_builddir@:$top_srcdir:$srcdir:$PATH - +GDWARF_5_FLAG=@GDWARF_5_FLAG@ diff --git a/tests/debugedit.at b/tests/debugedit.at index 2d1870b..9e6606a 100644 --- a/tests/debugedit.at +++ b/tests/debugedit.at @@ -120,6 +120,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_str/line_str objects DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) # Capture strings that start with the testdir (pwd) directory path @@ -184,6 +185,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_str/line_str partial DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) # Capture strings that start with the testdir (pwd) directory path @@ -245,6 +247,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_str/line_str exe DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) # Capture strings that start with the testdir (pwd) directory path @@ -484,6 +487,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_line objects DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], @@ -530,6 +534,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_line partial DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], @@ -574,6 +579,7 @@ AT_CLEANUP # === AT_SETUP([debugedit .debug_line exe DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) +AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) RPM_DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], -- 2.20.1