diff options
author | Jacob Bachmeyer <jcb@gnu.org> | 2021-04-16 16:34:56 -0500 |
---|---|---|
committer | Jacob Bachmeyer <jcb@gnu.org> | 2021-04-16 16:34:56 -0500 |
commit | d0f104991b9e6134f04bc674af115bc288c9e137 (patch) | |
tree | 9b56d4988d55ac78419223d04f30ae632e82d879 | |
parent | 408cfae9ecf4ec3a586fc50a31a8f05a218b004d (diff) | |
download | dejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.zip dejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.tar.gz dejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.tar.bz2 |
Allow environment to specify a shell for running config.guess
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | runtest.exp | 51 |
2 files changed, 51 insertions, 6 deletions
@@ -15,6 +15,12 @@ * configure.ac: Remove experimental support for propagating CONFIG_SHELL to scripts in the source directory. + * runtest.exp: Use CONFIG_SHELL or SHELL environment variable when + running config.guess. Check the result carefully and stop with an + error immediately if running config.guess does not produce + something that plausibly resembles a triplet. Advise the user + that SHELL or CONFIG_SHELL may need to be set in the environment. + 2021-04-15 Jacob Bachmeyer <jcb@gnu.org> PR47382 diff --git a/runtest.exp b/runtest.exp index 3220485..93ae2ab 100644 --- a/runtest.exp +++ b/runtest.exp @@ -823,13 +823,52 @@ if {[expr {$build_triplet eq "" && $host_triplet eq ""}]} { send_error "ERROR: Couldn't find config.guess program.\n" exit 1 } - catch "exec $config_guess" build_triplet - switch -- $build_triplet { - "No uname command or uname output not recognized" - - "Unable to guess system type" { - verbose "WARNING: Uname output not recognized" - set build_triplet unknown + if { [info exists ::env(CONFIG_SHELL)] } { + if { [catch {exec $::env(CONFIG_SHELL) $config_guess} build_triplet] } { + if { [lindex $::errorCode 0] eq "CHILDSTATUS" } { + send_error "ERROR: Running config.guess with\ + CONFIG_SHELL=$::env(CONFIG_SHELL)\ + exited on code\ + [lindex $::errorCode 2].\n" + } else { + send_error "ERROR: Running config.guess with\ + CONFIG_SHELL=$::env(CONFIG_SHELL)\ + produced error:\n" + send_error " $::errorCode\n" + } + } + } elseif { [info exists ::env(SHELL)] } { + if { [catch {exec $::env(SHELL) $config_guess} build_triplet] } { + if { [lindex $::errorCode 0] eq "CHILDSTATUS" } { + send_error "ERROR: Running config.guess with\ + SHELL=$::env(SHELL)\ + exited on code\ + [lindex $::errorCode 2].\n" + } else { + send_error "ERROR: Running config.guess with\ + SHELL=$::env(SHELL)\ + produced error:\n" + send_error " $::errorCode\n" + } } + } else { + if { [catch {exec $config_guess} build_triplet] } { + if { [lindex $::errorCode 0] eq "CHILDSTATUS" } { + send_error "ERROR: Running config.guess exited on code\ + [lindex $::errorCode 2].\n" + } else { + send_error "ERROR: Running config.guess produced error:\n" + send_error " $::errorCode\n" + } + } + } + if { ![regexp -- {^[^-]+-[^-]+-[^-]+} $build_triplet] } { + send_error "ERROR: Running config.guess produced bogus build triplet:\n" + send_error " $build_triplet\n" + send_error " (Perhaps you need to set CONFIG_SHELL or\ + SHELL in your environment\n" + send_error " to the absolute file name of a POSIX shell?)\n" + exit 1 } verbose "Assuming build host is $build_triplet" if { $host_triplet eq "" } { |