]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix hard-coded bash path in gprofng
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Fri, 3 May 2024 01:29:28 +0000 (18:29 -0700)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Thu, 9 May 2024 05:18:24 +0000 (22:18 -0700)
When running 'make check', the default gprofng test suite creates a
shell script for which it used a hardcoded shebang of '/usr/bin/bash'
this script would not run if bash is in a different location, like
/bin/bash

This commit adds 'AC_PATH_PROG(BASH, bash)' to configure.ac so the
installation path of bash is detected at configuration time. The
configuration is propagated to the runtest command line where it is
needed.

gprofng/Makefile.am
gprofng/Makefile.in
gprofng/configure
gprofng/configure.ac
gprofng/doc/Makefile.in
gprofng/gp-display-html/Makefile.in
gprofng/src/Makefile.in
gprofng/testsuite/config/default.exp

index 5d26441c304622d9b85bacfdedb4fce7fe525b72..a5ee9dd63f39364932d2170270e06287420bd5ea 100644 (file)
@@ -68,6 +68,7 @@ if TCL_TRY
                CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \
                CHECK_TARGET=$@ \
                PREFIX="$(prefix)" \
+               BASH="$(BASH)" \
                GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
                MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
                LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
index dbc868191b783a3215af092984b7353a3e399b25..5ced0e012eb0d12febaae4b2dcc976ff770ab7d6 100644 (file)
@@ -238,6 +238,7 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BASH = @BASH@
 BISON = @BISON@
 BUILD_SUBDIRS = @BUILD_SUBDIRS@
 CC = @CC@
@@ -932,6 +933,7 @@ check-small check-extra check-install: site.exp development.exp
 @TCL_TRY_TRUE@         CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \
 @TCL_TRY_TRUE@         CHECK_TARGET=$@ \
 @TCL_TRY_TRUE@         PREFIX="$(prefix)" \
+@TCL_TRY_TRUE@         BASH="$(BASH)" \
 @TCL_TRY_TRUE@         GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
 @TCL_TRY_TRUE@         MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
 @TCL_TRY_TRUE@         LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
index 17d1c500830999475f96f7b038324c669e6fc8ef..980553561bfd986b81b8700da5f68fe52329a389 100755 (executable)
@@ -639,6 +639,7 @@ GPROFNG_CPPFLAGS
 GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS
 GPROFNG_CFLAGS
 LD_NO_AS_NEEDED
+BASH
 BUILD_DOC_FALSE
 BUILD_DOC_TRUE
 BUILD_MAN_FALSE
@@ -12248,7 +12249,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12251 "configure"
+#line 12252 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12354,7 +12355,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12357 "configure"
+#line 12358 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16861,6 +16862,48 @@ else
 fi
 
 
+# Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BASH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BASH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
+  ;;
+  *)
+  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_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
 LD_NO_AS_NEEDED=${no_as_needed}
 
 GPROFNG_CFLAGS=${gprofng_cflags}
index a7221d9eaf0a142f48048d9b4c66df8993d2fdd0..794e95793fc75f4f41350ad19d70031730a85523 100644 (file)
@@ -228,6 +228,9 @@ fi
 AM_CONDITIONAL([BUILD_MAN], [test x$build_man = xtrue])
 AM_CONDITIONAL([BUILD_DOC], [test x$build_doc = xtrue])
 
+AC_PATH_PROG([BASH], [bash])
+AC_SUBST([BASH])
+
 AC_SUBST(LD_NO_AS_NEEDED, [${no_as_needed}])
 AC_SUBST(GPROFNG_CFLAGS, [${gprofng_cflags}])
 AC_SUBST(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS)
index 27a073e86b67cc4ee4d3fdf58e3047a03c8ff06a..5b57544d91a49715440c458fae85cf40d64f8073 100644 (file)
@@ -222,6 +222,7 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BASH = @BASH@
 BISON = @BISON@
 BUILD_SUBDIRS = @BUILD_SUBDIRS@
 CC = @CC@
index 61c00cd6e46556752713858f58a93bedcc33995a..b667ae91617570daa7be8e67164d1d2ffd81702a 100644 (file)
@@ -182,6 +182,7 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BASH = @BASH@
 BISON = @BISON@
 BUILD_SUBDIRS = @BUILD_SUBDIRS@
 CC = @CC@
index db763ef71b2d6836c546e0a63f95b582de48ce68..cef4b275305427473a9bce85b9d751cdc2adaad7 100644 (file)
@@ -306,6 +306,7 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BASH = @BASH@
 BISON = @BISON@
 BUILD_SUBDIRS = @BUILD_SUBDIRS@
 CC = @CC@
index 6b51d578d9fa8859e8445561f58ddec892f42f2c..74d1dad1b48b8669cfccb990780538b28b2c5152 100644 (file)
@@ -54,7 +54,7 @@ if { "$CHECK_TARGET" == "check-install" } {
     }
 
     set f [open "gprofng_wraper" w+]
-    puts $f "#!/usr/bin/bash"
+    puts $f "#!$BASH"
     puts $f "LD_LIBRARY_PATH=$ld_library_path:$orig_ld_library_path"
     puts $f "GPROFNG_SYSCONFDIR=$env(srcroot)/src"
     puts $f "GPROFNG_PRELOAD_LIBDIRS=$BUILDDIR/libcollector/.libs"