Fix hard-coded bash path in gprofng

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.
This commit is contained in:
Vladimir Mezentsev 2024-05-02 18:29:28 -07:00
parent 46b6ba96d0
commit e5b12a313f
8 changed files with 55 additions and 3 deletions

View 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)" \

View 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)" \

47
gprofng/configure vendored
View File

@ -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}

View 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)

View File

@ -222,6 +222,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@

View File

@ -182,6 +182,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@

View File

@ -306,6 +306,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@

View 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"