aboutsummaryrefslogtreecommitdiff
path: root/runtest.exp
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb@gnu.org>2021-04-16 16:34:56 -0500
committerJacob Bachmeyer <jcb@gnu.org>2021-04-16 16:34:56 -0500
commitd0f104991b9e6134f04bc674af115bc288c9e137 (patch)
tree9b56d4988d55ac78419223d04f30ae632e82d879 /runtest.exp
parent408cfae9ecf4ec3a586fc50a31a8f05a218b004d (diff)
downloaddejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.zip
dejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.tar.gz
dejagnu-d0f104991b9e6134f04bc674af115bc288c9e137.tar.bz2
Allow environment to specify a shell for running config.guess
Diffstat (limited to 'runtest.exp')
-rw-r--r--runtest.exp51
1 files changed, 45 insertions, 6 deletions
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 "" } {