test defs: more environment cleanups
[platform/upstream/automake.git] / defs-static.in
1 # -*- shell-script -*-
2 # @configure_input@
3 #
4 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 # Defines and minimal setup for Automake testing environment.
20
21 # IMPORTANT NOTES AND REQUIREMENTS
22 #   - Multiple inclusions of this file should be idempotent.
23 #   - This code has to be 'set -e' clean.
24 #   - This file should execute correctly with any system's /bin/sh
25 #     shell, not only with configure-time detected $CONFIG_SHELL.
26
27 # Be more Bourne compatible.
28 # (Snippet inspired to configure's initialization in Autoconf 2.64)
29 DUALCASE=1; export DUALCASE # for MKS sh
30 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
31   emulate sh
32   NULLCMD=:
33   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
34   # is contrary to our usage.  Disable this feature.
35   alias -g '${1+"$@"}'='"$@"'
36   setopt NO_GLOB_SUBST
37   # If Zsh is not started directly in Bourne-compatibility mode, it has
38   # some incompatibilities in the handling of $0 that conflict with
39   # our usage: i.e., $0 inside a file sourced with the '.' builtin is
40   # temporarily set to the name of the sourced file.
41   # Work around this when possible, otherwise abort the script.
42   # Note that a bug in some versions of Zsh prevents us from resetting $0
43   # in a sourced script, so the use of $argv0.  For more info see:
44   #  <http://www.zsh.org/mla/workers/2009/msg01140.html>
45   # Note: the apparently useless 'eval' below are needed by at least
46   # dash 0.5.2, to prevent it from bailing out with an error like
47   # "Syntax error: Bad substitution"
48   if eval '[[ "$0" = *."test" ]]'; then
49     # Good, FUNCTION_ARGZERO option was already off when this file was
50     # sourced.  Thus we've nothing to do.
51     argv0=$0
52   elif eval 'test -n "${functrace[-1]}"'; then
53     # FUNCTION_ARGZERO option was on, but we have a easy workaround.
54     eval 'argv0=${functrace[-1]%:*}'
55   else
56     # Give up.
57     echo "$0: cannot determine the path of running test script" >&2
58     echo "$0: test was running with Zsh version $ZSH_VERSION" >&2
59     echo "$0: did you enable the NO_FUNCTION_ARGZERO option?" >&2
60     exit 99
61   fi
62 else
63   argv0=$0
64   # Avoid command substitution failure, for Tru64 sh -e and instspc*.test.
65   case `(set -o) 2>/dev/null || :` in *posix*) set -o posix;; esac
66 fi
67
68 # Check that the environment is properly sanitized.
69 # Having variables exported to the empty string is OK, since our code
70 # treats such variables as if they were unset.
71 for var in \
72   me \
73   required \
74   am_using_tap \
75   am_parallel_tests \
76   am_create_testdir \
77   am_tap_implementation \
78   am_test_prefer_config_shell \
79   am_original_AUTOMAKE \
80   am_original_ACLOCAL \
81 ; do
82   if eval "test x\"\$$var\" != x" && env | grep "^$var=" >/dev/null; then
83     echo "$argv0: variable '$var' is set in the environment:" \
84          "this is unsafe" >&2
85     exit 99
86   fi
87 done
88 unset var
89
90 # See whether the current test script is expected to use TAP or not.
91 # Use a sensible default, while allowing the scripts to override this
92 # check.
93 if test -z "$am_using_tap"; then
94   case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
95 fi
96
97 am_top_srcdir='@abs_srcdir@'
98 am_top_builddir='@abs_builddir@'
99 testprefix='@prefix@'
100
101 # Where testsuite-related helper scripts, data files and shell libraries
102 # are placed.
103 am_testauxdir=$am_top_srcdir/t/ax
104
105 # Support for the "installcheck" target.
106 case ${am_running_installcheck:=no} in
107   yes)
108     am_amdir='@amdir@'
109     am_automake_acdir='@automake_acdir@'
110     am_bindir='@bindir@'
111     am_datadir='@datadir@'
112     am_docdir='@docdir@'
113     am_pkgvdatadir='@pkgvdatadir@'
114     am_scriptdir='@scriptdir@'
115     am_system_acdir='@system_acdir@'
116     ;;
117   no)
118     am_amdir=$am_top_srcdir/lib/am
119     am_automake_acdir=$am_top_srcdir/m4
120     am_bindir=$am_top_builddir/t/wrap
121     am_datadir=$am_top_srcdir
122     am_docdir=$am_top_srcdir/doc
123     am_pkgvdatadir=$am_top_srcdir/lib
124     am_scriptdir=$am_top_srcdir/lib
125     am_system_acdir=$am_top_srcdir/m4/acdir
126     ;;
127   *)
128     echo "$argv0: variable 'am_running_installcheck' has invalid"
129          "value '$am_running_installcheck'" >&2
130     exit 99
131     ;;
132 esac
133
134 APIVERSION='@APIVERSION@'
135 PATH_SEPARATOR='@PATH_SEPARATOR@'
136
137 host_alias=${host_alias-'@host_alias@'}; export host_alias
138 build_alias=${build_alias-'@build_alias@'}; export build_alias
139
140 # Make sure we override the user shell.  And do not read the value of
141 # $SHELL from the environment (think to the non-uncommon situation where
142 # e.g., $SHELL=/bin/tcsh).
143 SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL
144
145 # User can override various tools used.  Prefer overriding specific for
146 # that automake testsuite, if they are available.
147 AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}}
148 PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}}
149 MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}}
150 YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}}
151 LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}}
152 AUTOCONF=${AM_TESTSUITE_AUTOCONF-${AUTOCONF-'@am_AUTOCONF@'}}
153 AUTOM4TE=${AM_TESTSUITE_AUTOM4TE-${AUTOM4TE-'@am_AUTOM4TE@'}}
154 AUTORECONF=${AM_TESTSUITE_AUTORECONF-${AUTORECONF-'@am_AUTORECONF@'}}
155 AUTOHEADER=${AM_TESTSUITE_AUTOHEADER-${AUTOHEADER-'@am_AUTOHEADER@'}}
156 AUTOUPDATE=${AM_TESTSUITE_AUTOUPDATE-${AUTOUPDATE-'@am_AUTOUPDATE@'}}
157
158 # Tests who want complete control over aclocal or automake command-line
159 # options should use $am_original_ACLOCAL or $am_original_AUTOMAKE.  The
160 # "test -z" tests take care not to re-initialize them if defs-static
161 # is re-sourced, as we want defs-static to remain really idempotent.
162 if test -z "$am_original_AUTOMAKE"; then
163   am_original_AUTOMAKE=${AM_TESTSUITE_AUTOMAKE-${AUTOMAKE-"automake-$APIVERSION"}}
164 fi
165 if test -z "$am_original_ACLOCAL"; then
166   am_original_ACLOCAL=${AM_TESTSUITE_ACLOCAL-${ACLOCAL-"aclocal-$APIVERSION"}}
167 fi
168
169 # Use -Werror because this also turns some Perl warnings into error.
170 # Tests for which this is inappropriate should use -Wno-error.
171 # Tests who want complete control over aclocal command-line options
172 # should use $am_original_ACLOCAL instead.
173 ACLOCAL="$am_original_ACLOCAL -Werror"
174
175 # See how Automake should be run.  We put --foreign as the default
176 # strictness to avoid having to create lots and lots of files.  A test
177 # can override this by specifying a different strictness.  Use -Wall
178 # -Werror by default.  Tests for which this is inappropriate (e.g. when
179 # testing that a warning is enabled by a specific switch) should use
180 # -Wnone or/and -Wno-error.
181 # Tests who want complete control over automake command-line options
182 # should use $am_original_AUTOMAKE instead.
183 AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror -Wall"
184
185 # POSIX no longer requires 'egrep' and 'fgrep',
186 # but some hosts lack 'grep -E' and 'grep -F'.
187 EGREP=${AM_TESTSUITE_EGREP-'@EGREP@'}
188 FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'}
189
190 # Compilers and their flags.  These can point to non-GNU compilers (and
191 # on non-Linux and non-BSD systems, they probably will).
192 CC=${AM_TESTSUITE_CC-${CC-'@CC@'}}
193 CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}}
194 F77=${AM_TESTSUITE_F77-${F77-'@F77@'}}
195 FC=${AM_TESTSUITE_FC-${FC-'@FC@'}}
196 CFLAGS=${AM_TESTSUITE_CFLAGS-${CFLAGS-'@CFLAGS@'}}
197 CXXFLAGS=${AM_TESTSUITE_CXXFLAGS-${CXXFLAGS-'@CXXFLAGS@'}}
198 FCFLAGS=${AM_TESTSUITE_FCFLAGS-${FCFLAGS-'@FCFLAGS@'}}
199 FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}}
200 CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}}
201
202 # GNU compilers and their flags.
203 GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}}
204 GNU_CXX=${AM_TESTSUITE_GNU_CXX-${GNU_CXX-'@GNU_CXX@'}}
205 GNU_F77=${AM_TESTSUITE_GNU_F77-${GNU_F77-'@GNU_F77@'}}
206 GNU_FC=${AM_TESTSUITE_GNU_FC-${GNU_FC-'@GNU_FC@'}}
207 GNU_FFLAGS=${AM_TESTSUITE_GNU_FFLAGS-${GNU_FFLAGS-'@GNU_FFLAGS@'}}
208 GNU_FCFLAGS=${AM_TESTSUITE_GNU_FCFLAGS-${GNU_FCFLAGS-'@GNU_FCFLAGS@'}}
209 GNU_CXXFLAGS=${AM_TESTSUITE_GNU_CXXFLAGS-${GNU_CXXFLAGS-'@GNU_CXXFLAGS@'}}
210 GNU_CFLAGS=${AM_TESTSUITE_GNU_CFLAGS-${GNU_CFLAGS-'@GNU_CFLAGS@'}}
211 GNU_GCJ=${AM_TESTSUITE_GNU_GCJ-${GNU_GCJ-'@GNU_GCJ@'}}
212 GNU_GCJFLAGS=${AM_TESTSUITE_GNU_GCJFLAGS-${GNU_GCJFLAGS-'@GNU_GCJFLAGS@'}}
213
214 # No all versions of Tex support '--version', so we use a configure
215 # check to decide if tex is available.  This decision is embodied in
216 # this variable.
217 TEX=${AM_TESTSUITE_TEX-'@TEX@'}
218
219 # Whether $SHELL has working 'set -e' with exit trap.
220 sh_errexit_works='@sh_errexit_works@'
221
222 # The amount we should wait after modifying files depends on the platform.
223 # For instance, Windows '95, '98 and ME have 2-second granularity
224 # and can be up to 3 seconds in the future w.r.t. the system clock.
225 sleep='sleep @MODIFICATION_DELAY@'
226
227 # An old timestamp that can be given to a file, in "touch -t" format.
228 # The time stamp should be portable to all file systems of interest.
229 # Just for fun, choose the exact time of the announcement of the GNU project
230 # in UTC; see <http://www.gnu.org/gnu/initial-announcement.html>.
231 old_timestamp=198309271735.59
232
233 # Make our wrapper script (or installed scripts, if running under
234 # "installcheck") accessible by default.  And avoid to uselessly
235 # extend $PATH multiple times if this file is sourced multiple times.
236 case $PATH in
237   $am_bindir$PATH_SEPARATOR*) ;;
238   *) PATH=$am_bindir$PATH_SEPARATOR$PATH;;
239 esac
240
241 # Make our helper script accessible by default.
242 PATH=$am_testauxdir$PATH_SEPARATOR$PATH
243
244 export PATH