1 | # -*- TCL -*-
|
---|
2 | # Test-specific TCL procedures required by DejaGNU.
|
---|
3 | # Copyright (C) 1994 Free Software Foundation, Inc.
|
---|
4 |
|
---|
5 | # This program is free software; you can redistribute it and/or modify
|
---|
6 | # it under the terms of the GNU General Public License as published by
|
---|
7 | # the Free Software Foundation; either version 2 of the License, or
|
---|
8 | # (at your option) any later version.
|
---|
9 | #
|
---|
10 | # This program is distributed in the hope that it will be useful,
|
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | # GNU General Public License for more details.
|
---|
14 | #
|
---|
15 | # You should have received a copy of the GNU General Public License
|
---|
16 | # along with this program; if not, write to the Free Software
|
---|
17 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 |
|
---|
19 | # Modified by David MacKenzie <djm@gnu.ai.mit.edu> from the gcc files
|
---|
20 | # written by Rob Savoye <rob@cygnus.com>.
|
---|
21 | |
---|
22 |
|
---|
23 | #
|
---|
24 | # Called by runtest.
|
---|
25 | # Extract and print the version number of autoconf.
|
---|
26 | #
|
---|
27 | proc autoconf_version {} {
|
---|
28 | global AUTOCONF
|
---|
29 | global AUTOCONFFLAGS
|
---|
30 |
|
---|
31 | if {[which $AUTOCONF] != 0} then {
|
---|
32 | set tmp [ eval exec $AUTOCONF $AUTOCONFFLAGS --version /dev/null ]
|
---|
33 | regexp "version.*$" $tmp version
|
---|
34 | if [info exists version] then {
|
---|
35 | clone_output "[which $AUTOCONF] $version\n"
|
---|
36 | } else {
|
---|
37 | warning "cannot get version from $tmp."
|
---|
38 | }
|
---|
39 | } else {
|
---|
40 | warning "$AUTOCONF, program does not exist"
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | #
|
---|
45 | # Compile a configure.in using autoconf.
|
---|
46 | # Runs autoconf and leaves the output in $comp_output.
|
---|
47 | # Called by individual test scripts.
|
---|
48 | # Return 1 if ok, 0 if not.
|
---|
49 | proc autoconf_start { configout } {
|
---|
50 | global verbose
|
---|
51 | global AUTOCONF
|
---|
52 | global AUTOCONFFLAGS
|
---|
53 | global comp_output
|
---|
54 |
|
---|
55 | if {[which $AUTOCONF] == 0} then {
|
---|
56 | error "$AUTOCONF, program does not exist"
|
---|
57 | exit 1
|
---|
58 | }
|
---|
59 |
|
---|
60 | set configin "$configout.in"
|
---|
61 |
|
---|
62 | send_log "$AUTOCONF $AUTOCONFFLAGS $configin > $configout\n"
|
---|
63 | if $verbose>1 then {
|
---|
64 | send_user "Spawning \"$AUTOCONF $AUTOCONFFLAGS $configin > $configout\"\n"
|
---|
65 | }
|
---|
66 |
|
---|
67 | catch "exec $AUTOCONF $AUTOCONFFLAGS $configin > $configout" comp_output
|
---|
68 | if ![string match "" $comp_output] then {
|
---|
69 | send_log "$comp_output\n"
|
---|
70 | if $verbose>1 then {
|
---|
71 | send_user "$comp_output\n"
|
---|
72 | }
|
---|
73 | }
|
---|
74 | catch "exec chmod +x $configout"
|
---|
75 | return 1
|
---|
76 | }
|
---|
77 |
|
---|
78 | #
|
---|
79 | # Execute the configure script.
|
---|
80 | # Leaves the output in $exec_output.
|
---|
81 | # Called by individual test scripts.
|
---|
82 | # Return 1 if successful so far, 0 if failure already.
|
---|
83 | proc autoconf_load { args } {
|
---|
84 | global verbose
|
---|
85 | global exec_output
|
---|
86 |
|
---|
87 | if ![file exists $args] then {
|
---|
88 | error "$args, configure script does not exist"
|
---|
89 | return 0
|
---|
90 | }
|
---|
91 |
|
---|
92 | # Check whether m4 processing left any icky residue.
|
---|
93 | # The autoconf script does this already, pretty much.
|
---|
94 | # catch "exec sed -n -e /dnl/p -e /AC_/p $args" exec_output
|
---|
95 | # if $verbose>1 then {
|
---|
96 | # send_user "Checked $args for unexpanded m4 macros\n"
|
---|
97 | # }
|
---|
98 | # if ![string match "" $exec_output] then {
|
---|
99 | # fail "$args, unexpanded m4 macros"
|
---|
100 | # send_log "$exec_output\n"
|
---|
101 | # return 0
|
---|
102 | # }
|
---|
103 |
|
---|
104 | # Capture only stderr in exec_output, not "creating Makefile" etc.
|
---|
105 | catch "exec ./$args --cache=/dev/null >/dev/null" exec_output
|
---|
106 | if $verbose>1 then {
|
---|
107 | send_user "Executed $args --cache=/dev/null\n"
|
---|
108 | }
|
---|
109 | if ![string match "" $exec_output] then {
|
---|
110 | fail "$args, problem with executing"
|
---|
111 | send_log "$exec_output\n"
|
---|
112 | return 0
|
---|
113 | } else {
|
---|
114 | return 1
|
---|
115 | }
|
---|
116 | }
|
---|
117 |
|
---|
118 | #
|
---|
119 | # Called by runtest.
|
---|
120 | # Clean up (remove temporary files) before runtest exits.
|
---|
121 | #
|
---|
122 | proc autoconf_exit {} {
|
---|
123 | }
|
---|
124 |
|
---|
125 | load_lib common.exp
|
---|