Blame testsuite/config/unix.exp

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