3 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
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, or (at your option)
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.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 ########################################################
19 ### IMPORTANT NOTE: keep this file 'set -e' clean. ###
20 ########################################################
22 # NOTE: This file should execute correctly with any system's /bin/sh
23 # shell, and not only with configure-time detected $CONFIG_SHELL,
24 # *until differently and explicitly specified*.
26 ## -------------------------------------------------------- ##
27 ## Source static setup and definitions for the testsuite. ##
28 ## -------------------------------------------------------- ##
30 # Ensure we are running from the right directory.
31 test -f ./defs-static || {
32 echo "$0: ./defs-static: not found in current directory" >&2
36 # Source the shell sanitization and variables' definitions.
37 . ./defs-static || exit 99
39 # Enable the errexit shell flag early.
42 # The name of the current test (without the `.test' suffix).
43 # Test scripts can override it if they need to (but this should
44 # be done carefully, and *before* including ./defs).
45 if test -z "$me"; then
46 # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
47 me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//;s/\.tap$//;'` \
49 || { echo "$argv0: failed to define \$me" >&2; exit 99; }
52 ## ---------------------- ##
53 ## Early sanity checks. ##
54 ## ---------------------- ##
56 # A single whitespace character.
58 # A tabulation character.
60 # A newline character.
64 # As autoconf-generated configure scripts do, ensure that IFS
65 # is defined initially, so that saving and restoring $IFS works.
68 # Ensure $testsrcdir is set correctly.
69 test -f "$testsrcdir/defs-static.in" || {
70 echo "$me: $testsrcdir/defs-static.in not found, check \$testsrcdir" >&2
74 # Ensure $testbuilddir is set correctly.
75 test -f "$testbuilddir/defs-static" || {
76 echo "$me: $testbuilddir/defs-static not found, check \$testbuilddir" >&2
81 ## ------------------------------------ ##
82 ## Ensure we run with a proper shell. ##
83 ## ------------------------------------ ##
85 # Make sure we run with the shell detected at configure time (unless
86 # the user forbids it).
87 case ${AM_TESTS_REEXEC-yes} in
91 # Ensure we can find ourselves.
92 if test ! -f "$0"; then
93 echo "$me: unable to find myself: $0" >&2
96 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
97 # Cannot simply do `opts=$-', since the content of $- is not
98 # portable among different shells. So try to propagate only
99 # the portable and interesting options.
101 *x*v*|*v*x) opts=-vx;;
106 echo $me: exec $SHELL $opts "$0" "$*"
107 exec $SHELL $opts "$0" ${1+"$@"} || {
108 echo "$me: failed to re-execute with $SHELL" >&2
114 # NOTE: From this point on, we can assume this file is being executed
115 # by the configure-time detected $CONFIG_SHELL.
118 ## ----------------------- ##
119 ## Early debugging info. ##
120 ## ----------------------- ##
122 echo "Running from installcheck: $am_running_installcheck"
123 echo "Using TAP: $am_using_tap"
127 ## ---------------------- ##
128 ## Environment cleanup. ##
129 ## ---------------------- ##
131 # Temporarily disable this, since some shells (e.g., older version
132 # of Bash) can return a non-zero exit status upon the when a non-set
136 # Unset some make-related variables that may cause $MAKE to act like
137 # a recursively invoked sub-make. Any $MAKE invocation in a test is
138 # conceptually an independent invocation, not part of the main
140 unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
141 unset __MKLVL__ MAKE_JOBS_FIFO # For BSD make.
142 unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
143 # Unset verbosity flag.
145 # Also unset variables that will let `make -e install' divert
146 # files into unwanted directories.
148 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
149 unset htmldir includedir infodir libdir libexecdir localedir mandir
150 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
151 # Unset variables that might change the "make distcheck" behaviour.
152 unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
153 # The tests call `make -e' but we do not want $srcdir from the environment
154 # to override the definition from the Makefile.
156 # Also unset variables that control our test driver. While not
157 # conceptually independent, they cause some changed semantics we
158 # need to control (and test for) in some of the tests to ensure
159 # backward-compatible behavior.
160 unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
161 unset DISABLE_HARD_ERRORS
169 for pfx in TEST_ TAP_ ''; do
170 unset ${pfx}LOG_COMPILER
171 unset ${pfx}LOG_COMPILE # Not a typo!
172 unset ${pfx}LOG_FLAGS
173 unset AM_${pfx}LOG_FLAGS
174 unset ${pfx}LOG_DRIVER
175 unset ${pfx}LOG_DRIVER_FLAGS
176 unset AM_${pfx}LOG_DRIVER_FLAGS
180 # Re-enable, it had been temporarily disabled above.
183 ## ---------------------------- ##
184 ## Auxiliary shell functions. ##
185 ## ---------------------------- ##
187 # Tell whether we should keep the test directories around, even in
188 # case of success. By default, we don't.
189 am_keeping_testdirs ()
191 case $keep_testdirs in
192 ""|n|no|NO) return 1;;
197 # This is used in `Exit' and in the exit trap. See comments in the latter
198 # for more information,
201 # We use a trap below for cleanup. This requires us to go through
202 # hoops to get the right exit status transported through the signal.
203 # So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
204 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
205 # sh inside this function.
209 # See comments in the exit trap for the reason we do this.
210 test 77 = $1 && am__test_skipped=yes
214 if test $am_using_tap = yes; then
215 am_funcs_file=tap-functions.sh
217 am_funcs_file=plain-functions.sh
220 if test -f "$testsrcdir/$am_funcs_file"; then
221 . "$testsrcdir/$am_funcs_file" || {
222 echo "$me: error sourcing $testsrcdir/$am_funcs_file" >&2
226 echo "$me: $testsrcdir/$am_funcs_file not found, check \$testsrcdir" >&2
233 # Tell whether we are cross-compiling. This is especially useful to skip
234 # tests (or portions of them) that requires a native compiler.
237 # Quoting from the autoconf manual:
238 # ... [$host_alias and $build both] default to the result of running
239 # config.guess, unless you specify either --build or --host. In
240 # this case, the default becomes the system type you specified.
241 # If you specify both, *and they're different*, configure enters
242 # cross compilation mode (so it doesn't run any tests that require
244 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
247 # is_newest FILE FILES
248 # --------------------
249 # Return false if any file in FILES is newer than FILE.
250 # Resolve ties in favor of FILE.
253 is_newest_files=`find "$@" -prune -newer "$1"`
254 test -z "$is_newest_files"
257 # is_blocked_signal SIGNAL-NUMBER
258 # --------------------------------
259 # Return success if the given signal number is blocked in the shell,
260 # return a non-zero exit status and print a proper diagnostic otherwise.
263 # Use perl, since trying to do this portably in the shell can be
264 # very tricky, if not downright impossible. For reference, see:
265 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
268 use warnings FATAL => "all";
270 my %oldsigaction = ();
271 sigaction('"$1"', 0, \%oldsigaction);
272 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
275 elif test $? -eq 77; then
278 fatal_ "couldn't determine whether signal $1 is blocked"
282 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
283 # -----------------------------------------------------------------
284 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
285 # STATUS. Should be polymorphic for TAP and "plain" tests. The
286 # DESCRIPTION, when provided, is used for console reporting, only if
287 # the TAP protocol is in use in the current test script.
292 while test $# -gt 0; do
294 -d) am__desc=$2; shift;;
295 -e) am__exp_rc=$2; shift;;
297 # Don't fail on unknown option: assume they (and the rest of the
298 # command line) are to be passed verbatim to automake (so stop our
299 # own option parsing).
305 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
308 if test $am_using_tap != yes; then
309 test $am__got_rc -eq $am__exp_rc || Exit 1
312 if test -z "$am__desc"; then
313 if test $am__got_rc -eq $am__exp_rc; then
314 am__desc="automake exited $am__got_rc"
316 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
319 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
322 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
323 # --------------------------------------------
324 # Run automake with OPTIONS, and fail if doesn't exit with status `1'.
325 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
326 # when provided, is used for console reporting, only if the TAP
327 # protocol is in use in the current test script.
330 AUTOMAKE_run -e 1 ${1+"$@"}
333 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
334 # -----------------------------------------------------------
335 # Use this to extract from the output of `./configure --help' (or similar)
336 # the description or help message associated to the given --OPTION or
338 extract_configure_help ()
340 am__opt_re='' am__var_re=''
342 --*'=') am__opt_re="^ $1";;
343 --*'[=]') am__opt_re='^ '`printf '%s\n' "$1" | sed 's/...$//'`'\[=';;
344 --*) am__opt_re="^ $1( .*|$)";;
345 *) am__var_re="^ $1( .*|$)";;
348 if test x"$am__opt_re" != x; then
350 /'"$am__opt_re"'/ { print; do_print = 1; next; }
351 /^$/ { do_print = 0; next }
352 /^ --/ { do_print = 0; next }
353 (do_print == 1) { print }
357 /'"$am__var_re"'/ { print; do_print = 1; next; }
358 /^$/ { do_print = 0; next }
359 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
360 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
361 (do_print == 1) { print }
366 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
367 # -------------------------------------------------------
368 # Grep the section of `./configure --help' output associated with either
369 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
370 grep_configure_help ()
372 ./configure --help > am--all-help \
373 || { cat am--all-help; Exit 1; }
375 extract_configure_help "$1" am--all-help > am--our-help \
376 || { cat am--our-help; Exit 1; }
378 $EGREP "$2" am--our-help || Exit 1
383 # Return success if $MAKE is GNU make, return failure otherwise.
384 # Caches the result for speed reasons.
387 case $am__using_gmake in
393 # Use --version AND -v, because SGI Make doesn't fail on --version.
394 # Also grep for GNU because newer versions of FreeBSD make do
395 # not complain about `--version' (they seem to silently ignore it).
396 if $MAKE --version -v | grep GNU; then
404 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
407 am__using_gmake="" # Avoid interferences from the environment.
409 # make_can_chain_suffix_rules
410 # ---------------------------
411 # Return 0 if $MAKE is a make implementation that can chain suffix rules
412 # automatically, return 1 otherwise. Caches the result for speed reasons.
413 make_can_chain_suffix_rules ()
415 if test -z "$am__can_chain_suffix_rules"; then
417 am__can_chain_suffix_rules=yes
420 mkdir am__chain.dir$$
422 unindent > Makefile << 'END'
427 echo make can chain suffix rules > foo.u
428 if $MAKE foo.w && diff foo.u foo.w; then
429 am__can_chain_suffix_rules=yes
431 am__can_chain_suffix_rules=no
434 rm -rf am__chain.dir$$
437 case $am__can_chain_suffix_rules in
440 *) fatal_ "make_can_chain_suffix_rules: internal error";;
443 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
445 # useless_vpath_rebuild
446 # ---------------------
447 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
448 # For example, this happens with FreeBSD make, since in a VPATH build
449 # it tends to rebuilt files for which there is an explicit or even just
450 # a suffix rule, even if said files are already available in the VPATH
452 useless_vpath_rebuild ()
454 if test -z "$am__useless_vpath_rebuild"; then
456 am__useless_vpath_rebuild=no
459 mkdir am__vpath.dir$$
461 touch foo.a foo.b bar baz
464 unindent > Makefile << 'END'
470 baz: bar ; cp ../baz bar
472 if $MAKE all && test ! -f foo.b && test ! -f bar; then
473 am__useless_vpath_rebuild=no
475 am__useless_vpath_rebuild=yes
478 rm -rf am__vpath.dir$$
480 case $am__useless_vpath_rebuild in
484 *) fatal_ "no_useless_builddir_remake: internal error";;
487 am__useless_vpath_rebuild=""
489 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
491 # seq_ - print a sequence of numbers
492 # ----------------------------------
493 # This function simulates GNU seq(1) portably. Valid usages:
496 # - seq FIRST INCREMENT LAST
500 0) fatal_ "seq_: missing argument";;
501 1) seq_first=1 seq_incr=1 seq_last=$1;;
502 2) seq_first=$1 seq_incr=1 seq_last=$2;;
503 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
504 *) fatal_ "seq_: too many arguments";;
506 # Try to avoid forks if possible.
507 case "$BASH_VERSION" in
509 : Not bash, or a too old bash version. ;;
511 # Use eval to protect dumber shells from parsing errors.
512 eval 'for ((i = seq_first; i <= seq_last; i += seq_incr)); do
517 # Else, use GNU seq if available.
519 # Otherwise revert to a slower loop using expr(1).
521 while test $i -le $seq_last; do
523 i=`expr $i + $seq_incr`
527 # rm_rf_ [FILES OR DIRECTORIES ...]
528 # ---------------------------------
529 # Recursively remove the given files or directory, also handling the case
530 # of non-writable subdirectories.
533 test $# -gt 0 || return 0
534 # Ignore failures in find, we are only interested in failures of the
536 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
540 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
541 # -----------------------------------------------------------------------
542 # Check that a testsuite run driven by the parallel-tests harness has
543 # had the specified numbers of test results (specified by kind).
544 # This function assumes that the output of "make check" or "make recheck"
545 # has been saved in the `stdout' file in the current directory, and its
546 # log in the `test-suite.log' file.
547 count_test_results ()
549 # Use a subshell so that we won't pollute the script namespace.
551 # TODO: Do proper checks on the arguments?
552 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
555 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
557 # Avoid spurious failures with shells with "overly sensible"
558 # `errexit' shell flag, such as e.g., Solaris /bin/sh.
560 test `grep -c '^PASS:' stdout` -eq $pass || rc=1
561 test `grep -c '^XFAIL:' stdout` -eq $xfail || rc=1
562 test `grep -c '^SKIP:' stdout` -eq $skip || rc=1
563 test `grep -c '^FAIL:' stdout` -eq $fail || rc=1
564 test `grep -c '^XPASS:' stdout` -eq $xpass || rc=1
565 test `grep -c '^ERROR:' stdout` -eq $error || rc=1
566 grep "^# TOTAL: *$total$" stdout || rc=1
567 grep "^# PASS: *$pass$" stdout || rc=1
568 grep "^# XFAIL: *$xfail$" stdout || rc=1
569 grep "^# SKIP: *$skip$" stdout || rc=1
570 grep "^# FAIL: *$fail$" stdout || rc=1
571 grep "^# XPASS: *$xpass$" stdout || rc=1
572 grep "^# ERROR: *$error$" stdout || rc=1
577 commented_sed_unindent_prog='
578 /^$/b # Nothing to do for empty lines.
579 x # Get x<indent> into pattern space.
580 /^$/{ # No prior x<indent>, go prepare it.
581 g # Copy this 1st non-blank line into pattern space.
582 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
583 } # Now: x<indent> in pattern and <line> in hold.
584 G # Build x<indent>\n<line> in pattern space, and
585 h # duplicate it into hold space.
586 s/\n.*$// # Restore x<indent> in pattern space, and
587 x # exchange with the above duplicate in hold space.
588 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
589 s/^x.*\n// # Restore <line> when there is no leading <indent>.
592 # unindent [input files...]
593 # -------------------------
594 # Remove the "proper" amount of leading whitespace from the given files,
595 # and output the result on stdout. That amount is determined by looking
596 # at the leading whitespace of the first non-blank line in the input
597 # files. If no input file is specified, standard input is implied.
600 if test x"$sed_unindent_prog" = x; then
601 sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e "s/ *# .*//"`
603 sed "$sed_unindent_prog" ${1+"$@"}
605 sed_unindent_prog="" # Avoid interferences from the environment.
607 # get_shell_script SCRIPT-NAME
608 # -----------------------------
609 # Fetch an Automake-provided shell script from the `lib/' directory into
610 # the current directory, and, if the `$am_test_prefer_config_shell'
611 # variable is set to "yes", modify its shebang line to use $SHELL instead
615 if test x"$am_test_prefer_config_shell" = x"yes"; then
616 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1"
619 cp "$am_scriptdir/$1" .
621 sed 10q "$1" # For debugging.
626 # Skip the test if the given shell fails to support common XSI constructs.
629 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
630 echo "$me: trying some XSI constructs with $1"
631 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
633 # Shell code supposed to work only with XSI shells. Keep this in sync
634 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
637 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
639 && eval '\''test $(( 1 + 1 )) -eq 2 \
640 && test "${#_lt_dummy}" -eq 5'\'
644 # Fetch the Automake-provided TAP driver from the `lib/' directory into
645 # the current directory, and edit its shebang line so that it will be
646 # run with the perl interpreter determined at configure time.
649 # TODO: we should devise a way to make the shell TAP driver tested also
650 # TODO: with /bin/sh, for better coverage.
651 case $am_tap_implementation in
653 $PERL -MTAP::Parser -e 1 \
654 || skip_all_ "cannot import TAP::Parser perl module"
655 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
658 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
661 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
663 && chmod a+x tap-driver \
664 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
665 sed 10q tap-driver # For debugging.
667 # The shell/awk implementation of the TAP driver is still mostly dummy, so
668 # use the perl implementation by default for the moment.
669 am_tap_implementation=${am_tap_implementation-shell}
671 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
675 0) fatal_ "require_compiler_: missing argument";;
677 *) fatal_ "require_compiler_: too many arguments";;
683 am__comp_flag_vars='CFLAGS CPPFLAGS'
688 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
691 am__comp_lang="Fortran"
693 am__comp_flag_vars='FCFLAGS'
696 am__comp_lang="Fortran 77"
698 am__comp_flag_vars='FFLAGS'
702 eval "am__comp_prog=\${$am__comp_var}" \
703 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
704 case $am__comp_prog in
706 fatal_ "botched configuration: \$$am__comp_var is empty";;
708 skip_all_ "no $am__comp_lang compiler available";;
709 autodetect|autodetected)
710 # Let the ./configure commands in the test script try to determine
711 # these automatically.
712 unset $am__comp_var $am__comp_flag_vars;;
714 # Pre-set these for the ./configure commands in the test script.
715 export $am__comp_var $am__comp_flag_vars;;
717 # Delete private variables.
718 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
721 ## ----------------------------------------------------------- ##
722 ## Checks for required tools, and additional setups (if any) ##
723 ## required by them. ##
724 ## ----------------------------------------------------------- ##
726 # So that we can force the use of correct gcc, g++ etc., consistently
727 # with cross-compilation settings.
728 if cross_compiling; then
729 am__tool_prefix="$host_alias-"
734 # Look for (and maybe set up) required tools and/or system features; skip
735 # the current test if they are not found.
736 for tool in : $required
738 # Check that each required tool is present.
741 cc|c++|fortran|fortran77)
742 require_compiler_ $tool;;
744 require_xsi "$SHELL";;
746 require_xsi "/bin/sh";;
748 if test x"$am_test_prefer_config_shell" = x"yes"; then
751 require_xsi "/bin/sh"
755 # Do not use --version, bzip2 still tries to compress stdin.
756 echo "$me: running bzip2 --help"
758 || skip_all_ "required program \`bzip2' not available"
762 # Don't export CFLAGS, as that could have been initialized to only
763 # work with the C compiler detected at configure time. If the user
764 # wants CFLAGS to also influence `cl', he can still export CFLAGS
765 # in the environment "by hand" before calling the testsuite.
767 echo "$me: running $CC -?"
768 $CC -? || skip_all_ "Microsoft C compiler \`$CC' not available"
771 # Sun cscope is interactive without redirection.
772 echo "$me: running cscope --version </dev/null"
773 cscope --version </dev/null \
774 || skip_all_ "required program \`cscope' not available"
777 echo "$me: running cygpath --version"
778 cygpath --version || skip_all_ "cygpath not available"
781 # Exuberant Ctags will create a TAGS file even
782 # when asked for --help or --version. (Emacs's etags
783 # does not have such problem.) Use -o /dev/null
784 # to make sure we do not pollute the tests/ directory.
785 echo "$me: running etags --version -o /dev/null"
786 etags --version -o /dev/null \
787 || skip_all_ "required program \`etags' not available"
790 for make_ in "$MAKE" gmake gnumake :; do
791 MAKE=$make_ am__using_gmake=''
792 test "$MAKE" = : && break
793 echo "$me: determine whether $MAKE is GNU make"
794 # Don't use "&&" here, or a bug of 'set -e' present in some
795 # versions of the BSD shell will be triggered. We add the
796 # dummy "else" branch for extra safety.
797 if using_gmake; then break; else :; fi
799 test "$MAKE" = : && skip_all_ "this test requires GNU make"
804 # When gcc is required, export `CC=gcc' so that ./configure
805 # always use it. This is important only when the user
806 # has defined CC in his environment, otherwise ./configure will
807 # prefer gcc to other compilers.
808 CC=${am__tool_prefix}gcc
810 export CC CFLAGS CPPFLAGS
811 echo "$me: running $CC --version"
812 $CC --version || skip_all_ "GNU C compiler not available"
813 echo "$me: running $CC -v"
814 $CC -v || skip_all_ "botched installation for GNU C compiler"
817 GCJ=${am__tool_prefix}gcj
819 echo "$me: running $GCJ --version"
820 $GCJ --version || skip_all_ "GNU Java compiler not available"
821 echo "$me: running $GCJ -v"
822 $GCJ -v || skip_all_ "botched installation for GNU Java compiler"
825 CXX=${am__tool_prefix}g++
826 CXXFLAGS=$GNU_CXXFLAGS
827 export CXX CXXFLAGS CPPFLAGS
828 echo "$me: running $CXX --version"
829 $CXX --version || skip_all_ "GNU C++ compiler not available"
830 echo "$me: running $CXX -v"
831 $CXX -v || skip_all_ "botched installation for GNU C++ compiler"
834 FC=${am__tool_prefix}gfortran
837 echo "$me: running $FC --version"
838 $FC --version || skip_all_ "GNU Fortran compiler not available"
839 echo "$me: running $FC -v"
840 $FC -v || skip_all_ "botched installation for GNU Fortran compiler"
841 case " $required " in
843 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
847 F77=${am__tool_prefix}g77
850 echo "$me: running $F77 --version"
851 $F77 --version || skip_all_ "GNU Fortran 77 compiler not available"
852 echo "$me: running $F77 -v"
853 $F77 -v || skip_all_ "botched installation for GNU Fortran 77 compiler"
854 case " $required " in
856 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
861 export CC CPPFLAGS # But not CFLAGS (see comments for `cl' above).
862 # There is no way to ask *only* the compiler's version.
863 # This tool always wants to do something (by default
864 # it will try link *nothing* and complain it cannot find
865 # main(); funny). Use -help so it does not try linking anything.
866 echo "$me: running $CC -V -help"
867 $CC -V -help || skip_all_ "Intel C compiler \`$CC' not available"
870 # The Java compiler from JDK 1.5 (and presumably earlier versions)
871 # cannot handle the `-version' option by itself: it bails out
872 # telling that source files are missing. Adding also the `-help'
873 # option seems to solve the problem.
874 echo "$me: running javac -version -help"
875 javac -version -help || skip_all_ "Sun Java compiler not available"
878 # See the comments above about `javac' for why we use also `-help'.
879 echo "$me: running java -version -help"
880 java -version -help || skip_all_ "Sun Java interpreter not found"
885 # Attempting to create an empty archive will actually not
886 # create the archive, but lib will output its version.
887 echo "$me: running $AR -out:defstest.lib"
888 $AR -out:defstest.lib \
889 || skip_all_ "Microsoft \`lib' utility not available"
892 echo "$me: running makedepend -f-"
894 || skip_all_ "required program \`makedepend' not available"
897 # Make sure we have makeinfo, and it understands `--html'.
898 echo "$me: running makeinfo --html --version"
899 makeinfo --html --version \
900 || skip_all_ "cannot find a makeinfo program that groks the" \
904 uname_s=`uname -s || echo UNKNOWN`
905 echo "$me: system name: $uname_s"
908 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
912 # Skip this test case if the user is root.
913 # We try to append to a read-only file to detect this.
914 priv_check_temp=priv-check.$$
915 touch $priv_check_temp && chmod a-w $priv_check_temp \
916 || framework_failure_ "creating unwritable file $priv_check_temp"
917 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
918 # can exit if a builtin fails.
920 (echo foo >> $priv_check_temp) || overwrite_status=$?
921 rm -f $priv_check_temp
922 if test $overwrite_status -eq 0; then
923 skip_all_ "cannot drop file write permissions"
925 unset priv_check_temp overwrite_status
928 if test "$WANT_NO_THREADS" = "yes"; then
929 skip_all_ "Devel::Cover cannot cope with threads"
933 # Don't use "&&" here, to avoid a bug of 'set -e' present in
934 # some (even relatively recent) versions of the BSD shell.
935 # We add the dummy "else" branch for extra safety.
936 if cross_compiling; then
937 skip_all_ "doesn't work in cross-compile mode"
941 # Python doesn't support --version, it has -V
942 echo "$me: running python -V"
943 python -V || skip_all_ "python interpreter not available"
946 # Skip this test case if read-only directories aren't supported
948 ro_dir_temp=ro_dir.$$
949 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
950 || framework_failure_ "creating unwritable directory $ro_dir_temp"
951 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
952 # can exit if a builtin fails.
954 (: > $ro_dir_temp/probe) || create_status=$?
956 if test $create_status -eq 0; then
957 skip_all_ "cannot drop directory write permissions"
959 unset ro_dir_temp create_status
962 # DejaGnu's runtest program. We rely on being able to specify
963 # the program on the runtest command-line. This requires
964 # DejaGnu 1.4.3 or later.
965 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
966 runtest SOMEPROGRAM=someprogram --version \
967 || skip_all_ "DejaGnu is not available"
970 # No all versions of Tex support `--version', so we use
972 if test -z "$TEX"; then
973 skip_all_ "TeX is required, but it wasn't found by configure"
977 # Texi2dvi supports `-o' since Texinfo 4.1.
978 echo "$me: running texi2dvi -o /dev/null --version"
979 texi2dvi -o /dev/null --version \
980 || skip_all_ "required program \`texi2dvi' not available"
983 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
987 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
992 echo "$me: running flex --version"
993 flex --version || skip_all_ "required program \`flex' not available"
996 YACC='bison -y'; export YACC
997 echo "$me: running bison --version"
998 bison --version || skip_all_ "required program \`bison' not available"
1001 # Generic case: the tool must support --version.
1002 echo "$me: running $tool --version"
1003 # It is not likely but possible that $tool is a special builtin,
1004 # in which case the shell is allowed to exit after an error.
1005 # So, please leave the subshell here.
1006 ($tool --version) || skip_all_ "required program \`$tool' not available"
1011 # Using just `$testbuilddir' for the check here is ok, since the
1012 # further temporary subdirectory where the test will be run is
1013 # ensured not to contain any whitespace character.
1014 case $testbuilddir in
1016 case " $required " in
1017 *' libtool '* | *' libtoolize '* )
1018 skip_all_ "libtool has problems with spaces in builddir name";;
1023 # This test is necessary, although Automake's configure script bails out
1024 # when $srcdir contains spaces. This is because $testsrcdir is in not
1025 # configure-time $srcdir, but is instead configure-time $abs_srcdir, and
1026 # that is allowed to contain spaces.
1029 case " $required " in
1030 *' libtool '* | *' libtoolize '* | *' gettext '* )
1031 skip_all_ "spaces in srcdir name: libtool/gettext tests won't work";;
1036 # We might need extra macros, e.g., from Libtool or Gettext.
1037 case " $required " in *\ libtool*) . ./libtool-macros.dir/get.sh;; esac
1038 case " $required " in *\ gettext*) . ./gettext-macros.dir/get.sh;; esac
1041 ## ---------------------------------------------------------------- ##
1042 ## Create and set up of the temporary directory used by the test. ##
1043 ## Set up of the exit trap for cleanup of said directory. ##
1044 ## ---------------------------------------------------------------- ##
1046 # This might be used in testcases checking distribution-related features.
1047 # Test scripts are free to override this if they need to.
1050 # Set up the exit trap.
1051 if test "$sh_errexit_works" = yes; then
1052 trap 'exit_status=$?
1055 if test $am_using_tap = yes; then
1056 if test "$planned_" = later && test $exit_status -eq 0; then
1059 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
1060 || keep_testdirs=yes
1062 # This is to ensure that a test script does give a SKIP outcome just
1063 # because a command in it happens to exit with status 77. This
1064 # behaviour, while from time to time useful to developers, is not
1065 # meant to be enabled by default, as it could cause spurious failures
1066 # in the wild. Thus it will be enabled only when the variable
1067 # "am_explicit_skips" is set to a "true" value.
1068 case $am_explicit_skips in
1070 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
1071 echo "$me: implicit skip turned into failure"
1075 test $exit_status -eq 0 || keep_testdirs=yes
1077 am_keeping_testdirs || rm_rf_ $testSubDir
1079 echo "$me: exit $exit_status"
1082 trap "fatal_ 'caught signal SIGHUP'" 1
1083 trap "fatal_ 'caught signal SIGINT'" 2
1084 trap "fatal_ 'caught signal SIGTERM'" 15
1085 # Various shells seems to just ignore SIGQUIT under some circumstances,
1086 # even if the signal is not blocked; however, if the signal it trapped,
1087 # the trap gets correctly executed. So we also trap SIGQUIT.
1088 # Here is a list of some shells that have been verified to exhibit the
1089 # problematic behavior with SIGQUIT:
1090 # - zsh 4.3.12 on Debian GNU/Linux
1091 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
1092 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
1093 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
1094 # OTOH, at least these shells that do *not* exhibit that behaviour:
1095 # - modern version of the Almquist Shell (at least 0.5.5.1), on
1096 # both Solaris and GNU/Linux
1097 # - Solaris 10 /bin/sh
1098 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
1099 trap "fatal_ 'caught signal SIGQUIT'" 3
1100 # Ignore further SIGPIPE in the trap code. This is required to avoid
1101 # a very weird issue with some shells, at least when the execution of
1102 # the automake testsuite is driven by the `prove' utility: if prove
1103 # (or the make process that has spawned it) gets interrupted with
1104 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
1105 # sometimes finally dumping core, other times hanging indefinitely.
1106 # See also Test::Harness bug [rt.cpan.org #70855], archived at
1107 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
1108 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
1111 # Create and populate the temporary directory, if and as required.
1112 if test x"$am_create_testdir" = x"no"; then
1115 # The subdirectory where the current test script will run and write its
1116 # temporary/data files. This will be created shortly, and will be removed
1117 # by the cleanup trap below if the test passes. If the test doesn't pass,
1118 # this directory will be kept, to facilitate debugging.
1120 test ! -d $testSubDir || rm_rf_ $testSubDir \
1121 || framework_failure_ "removing old test subdirectory"
1123 || framework_failure_ "creating test subdirectory"
1125 || framework_failure_ "cannot chdir into test subdirectory"
1126 if test x"$am_create_testdir" != x"empty"; then
1127 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
1128 "$am_scriptdir"/depcomp . \
1129 || framework_failure_ "fetching common files from $am_scriptdir"
1130 # Build appropriate environment in test directory. E.g., create
1131 # configure.in, touch all necessary files, etc. Don't use AC_OUTPUT,
1132 # but AC_CONFIG_FILES so that appending still produces a valid
1133 # configure.in. But then, tests running config.status really need
1134 # to append AC_OUTPUT.
1136 echo "AC_INIT([$me], [1.0])"
1137 if test x"$am_parallel_tests" = x"yes"; then
1138 echo "AM_INIT_AUTOMAKE([parallel-tests])"
1140 echo "AM_INIT_AUTOMAKE"
1142 echo "AC_CONFIG_FILES([Makefile])"
1143 } >configure.in || framework_failure_ "creating configure.in skeleton"
1148 ## ---------------- ##
1149 ## Ready to go... ##
1150 ## ---------------- ##