mirror of
git://git.sv.gnu.org/autoconf
synced 2025-03-13 14:36:50 +08:00
113 lines
3.0 KiB
Tcl
113 lines
3.0 KiB
Tcl
# -*- TCL -*-
|
||
# Test-specific TCL procedures required by DejaGNU.
|
||
# Copyright (C) 1994 Free Software Foundation, Inc.
|
||
|
||
# This program is free software; you can redistribute it and/or modify
|
||
# it under the terms of the GNU General Public License as published by
|
||
# the Free Software Foundation; either version 2 of the License, or
|
||
# (at your option) any later version.
|
||
#
|
||
# This program is distributed in the hope that it will be useful,
|
||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
# GNU General Public License for more details.
|
||
#
|
||
# You should have received a copy of the GNU General Public License
|
||
# along with this program; if not, write to the Free Software
|
||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||
|
||
# Modified by David MacKenzie <djm@gnu.ai.mit.edu> from the gcc files
|
||
# written by Rob Savoye <rob@cygnus.com>.
|
||
|
||
#
|
||
# Called by runtest.
|
||
# Extract and print the version number of autoconf.
|
||
#
|
||
proc autoconf_version {} {
|
||
global AUTOCONF
|
||
global AUTOCONFFLAGS
|
||
|
||
if {[which $AUTOCONF] != 0} then {
|
||
set tmp [ eval exec $AUTOCONF $AUTOCONFFLAGS --version /dev/null ]
|
||
regexp "version.*$" $tmp version
|
||
if [info exists version] then {
|
||
clone_output "[which $AUTOCONF] $version\n"
|
||
} else {
|
||
warning "cannot get version from $tmp."
|
||
}
|
||
} else {
|
||
warning "$AUTOCONF, program does not exist"
|
||
}
|
||
}
|
||
|
||
#
|
||
# Compile a configure.in using autoconf.
|
||
# Runs autoconf and leaves the output in $comp_output.
|
||
# Called by individual test scripts.
|
||
# Return 1 if ok, 0 if not.
|
||
proc autoconf_start { configout } {
|
||
global verbose
|
||
global AUTOCONF
|
||
global AUTOCONFFLAGS
|
||
global comp_output
|
||
|
||
if {[which $AUTOCONF] == 0} then {
|
||
error "$AUTOCONF, program does not exist"
|
||
exit 1
|
||
}
|
||
|
||
set configin "$configout.in"
|
||
|
||
send_log "$AUTOCONF $AUTOCONFFLAGS $configin > $configout\n"
|
||
if $verbose>1 then {
|
||
send_user "Spawning \"$AUTOCONF $AUTOCONFFLAGS $configin > $configout\"\n"
|
||
}
|
||
|
||
catch "exec $AUTOCONF $AUTOCONFFLAGS $configin > $configout" comp_output
|
||
if ![string match "" $comp_output] then {
|
||
send_log "$comp_output\n"
|
||
if $verbose>1 then {
|
||
send_user "$comp_output\n"
|
||
}
|
||
}
|
||
catch "exec chmod +x $configout"
|
||
return 1
|
||
}
|
||
|
||
#
|
||
# Execute the configure script.
|
||
# Leaves the output in $exec_output.
|
||
# Called by individual test scripts.
|
||
# Return 1 if successful so far, 0 if failure already.
|
||
proc autoconf_load { args } {
|
||
global verbose
|
||
global exec_output
|
||
|
||
if ![file exists $args] then {
|
||
error "$args, configure script does not exist"
|
||
return 0
|
||
}
|
||
|
||
# Capture only stderr in exec_output, not "creating Makefile" etc.
|
||
catch "exec $args >/dev/null" exec_output
|
||
if $verbose>1 then {
|
||
send_user "Executed $args\n"
|
||
}
|
||
if ![string match "" $exec_output] then {
|
||
fail "$args, problem with executing"
|
||
send_log "$exec_output\n"
|
||
return 0
|
||
} else {
|
||
return 1
|
||
}
|
||
}
|
||
|
||
#
|
||
# Called by runtest.
|
||
# Clean up (remove temporary files) before runtest exits.
|
||
#
|
||
proc autoconf_exit {} {
|
||
}
|
||
|
||
load_lib common.exp
|