]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
binutils: Require GNU tail for 'objdump -Wi' test
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 7 Sep 2025 12:10:40 +0000 (05:10 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 8 Sep 2025 12:44:09 +0000 (05:44 -0700)
testsuite/binutils-all/objdump.exp has

set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]

But the default Solaris tail doesn't support "tail -n +4".  Add
ACX_PROG_GNU_TAIL to use GNU tail for 'objdump -Wi' test.

Tested on Linux and Solaris.

binutils/

PR binutils/33396
* Makefile.am (check-DEJAGNU): Also export TAIL.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
* configure.ac: Add ACX_PROG_GNU_TAIL.
* testsuite/binutils-all/objdump.exp: Require GNU tail for
'objdump -Wi' test and replace tail with $env(TAIL).

config/

PR binutils/33396
* acx.m4 (ACX_PROG_GNU_TAIL): New.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
binutils/Makefile.am
binutils/Makefile.in
binutils/aclocal.m4
binutils/configure
binutils/configure.ac
binutils/testsuite/binutils-all/objdump.exp
config/acx.m4

index 1528302ea6179d3f38f684dc72a7f890bdb412d8..f1df54ffcafcb1a9bef88e84a964b72f67681da3 100644 (file)
@@ -208,6 +208,7 @@ check-DEJAGNU: site.exp
        r=`pwd`; export r; \
        LC_ALL=C; export LC_ALL; \
        EXPECT=$(EXPECT); export EXPECT; \
+       TAIL=$(TAIL); export TAIL; \
        runtest=$(RUNTEST); \
        if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
          $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
index 549b5a361c87d0415f88e8717100c0dcd01520dd..bad324fb1186af8ea7fa17317748be965dc65820 100644 (file)
@@ -138,7 +138,7 @@ EXTRA_PROGRAMS = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) \
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
-       $(top_srcdir)/../bfd/warning.m4 \
+       $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
        $(top_srcdir)/../config/enable.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
@@ -573,6 +573,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TAIL = @TAIL@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
@@ -1836,6 +1837,7 @@ check-DEJAGNU: site.exp
        r=`pwd`; export r; \
        LC_ALL=C; export LC_ALL; \
        EXPECT=$(EXPECT); export EXPECT; \
+       TAIL=$(TAIL); export TAIL; \
        runtest=$(RUNTEST); \
        if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
          $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
index eb1433a68bd8fc24059d2eae3fe58dcaaa7921b3..5909ff0d3618e874e17a97944bcc05383383ffc8 100644 (file)
@@ -1187,6 +1187,7 @@ AC_SUBST([am__untar])
 
 m4_include([../bfd/acinclude.m4])
 m4_include([../bfd/warning.m4])
+m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/enable.m4])
 m4_include([../config/gettext-sister.m4])
index 6f54be9906625c758d89f492d554d7044ba97338..e7fce6858b5255f27895a134fc8be2dadaee51f0 100755 (executable)
@@ -656,6 +656,7 @@ zlibdir
 DEMANGLER_NAME
 EXEEXT_FOR_BUILD
 CC_FOR_BUILD
+TAIL
 HDEFINES
 GENINSRC_NEVER_FALSE
 GENINSRC_NEVER_TRUE
@@ -863,6 +864,7 @@ DEBUGINFOD_CFLAGS
 DEBUGINFOD_LIBS
 YACC
 YFLAGS
+TAIL
 ZSTD_CFLAGS
 ZSTD_LIBS
 MSGPACK_CFLAGS
@@ -1567,6 +1569,8 @@ Some influential environment variables:
   YFLAGS      The list of arguments that will be passed by default to $YACC.
               This script will default YFLAGS to the empty string to avoid a
               default value of `-d' given by some make applications.
+  TAIL        Location of GNU tail. Defaults to the first GNU version of
+              `tail', `gtail' on PATH.
   ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
   ZSTD_LIBS   linker flags for ZSTD, overriding pkg-config
   MSGPACK_CFLAGS
@@ -11081,7 +11085,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11084 "configure"
+#line 11088 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11187,7 +11191,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11190 "configure"
+#line 11194 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 
 
 
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU tail" >&5
+$as_echo_n "checking for GNU tail... " >&6; }
+if ${ac_cv_path_TAIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$TAIL"; then
+  ac_path_TAIL_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in tail gtail; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_TAIL="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_TAIL" || continue
+# Check for GNU $ac_path_TAIL
+case `"$ac_path_TAIL" --version 2>&1` in
+*GNU*)
+  ac_cv_path_TAIL=$ac_path_TAIL && ac_path_TAIL_found=:;;
+esac
+
+      $ac_path_TAIL_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_TAIL"; then
+    :
+  fi
+else
+  ac_cv_path_TAIL=$TAIL
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_TAIL" >&5
+$as_echo "$ac_cv_path_TAIL" >&6; }
+  TAIL=$ac_cv_path_TAIL
+
+
 # Put a plausible default for CC_FOR_BUILD in Makefile.
 if test -z "$CC_FOR_BUILD"; then
   if test "x$cross_compiling" = "xno"; then
index 93e8a4b093425979d3462437f4a3a7281ff23c9f..ba1ab4e6d7fc30f653e346b0cd78269f47cf9e8d 100644 (file)
@@ -180,6 +180,8 @@ AC_SUBST(AR)
 AC_PROG_RANLIB
 AC_PROG_INSTALL
 
+ACX_PROG_GNU_TAIL
+
 BFD_CC_FOR_BUILD
 
 DEMANGLER_NAME=c++filt
index f3142b104425f4d129508f92d6562375aaefc8cc..95c09fe2b9cb5bbf7f903877222c9b45320acafe 100644 (file)
@@ -595,7 +595,14 @@ if { ![is_elf_format] } then {
        send_log "\n"
     }
 
-    set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]
+    if {![info exists env(TAIL)]} {
+       # If no GNU tail is available, skip this test.
+       verbose "Need GNU tail for 'objdump -Wi' test"
+       untested "objdump -Wi"
+       return
+    }
+
+    set got [remote_exec host "$env(TAIL) -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]
     set output [remote_upload host tmpdir/objdump.tail]
 
     if ![file size $output] then {
index db54ccf1c7c112113fdbf87212deb95ae3bd5828..3c4960cedf68d4db82d5fa16362a866ba22260fe 100644 (file)
@@ -684,3 +684,16 @@ export SHELLOPTS
   ])
 fi
 ])
+
+# ACX_PROG_GNU_TAIL
+# --------------------
+# Check for GNU tail.
+AC_DEFUN([ACX_PROG_GNU_TAIL],
+  [AC_ARG_VAR([TAIL], [Location of GNU tail.  Defaults to the first
+    GNU version of `tail', `gtail' on PATH.])
+  AC_CACHE_CHECK([for GNU tail], [ac_cv_path_TAIL],
+    [AC_PATH_PROGS_FEATURE_CHECK([TAIL], [tail gtail],
+      [_AC_PATH_PROG_FLAVOR_GNU([$ac_path_TAIL],
+       [ac_cv_path_TAIL=$ac_path_TAIL && ac_path_TAIL_found=:])])])
+  TAIL=$ac_cv_path_TAIL
+])