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 # Enable the errexit shell flag early.
26 ## ------------------ ##
27 ## Early variables. ##
28 ## ------------------ ##
30 # A single whitespace character.
32 # A tabulation character.
34 # A newline character.
37 # A literal escape character. Used by test checking colored output.
40 # As autoconf-generated configure scripts do, ensure that IFS
41 # is defined initially, so that saving and restoring $IFS works.
45 ## ---------------------- ##
46 ## Environment cleanup. ##
47 ## ---------------------- ##
49 # Temporarily disable this, since some shells (e.g., older version
50 # of Bash) can return a non-zero exit status upon the when a non-set
54 # Unset some make-related variables that may cause $MAKE to act like
55 # a recursively invoked sub-make. Any $MAKE invocation in a test is
56 # conceptually an independent invocation, not part of the main
58 unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
59 unset __MKLVL__ MAKE_JOBS_FIFO # For BSD make.
60 unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
61 # Unset verbosity flag.
63 # Also unset variables that will let "make -e install" divert
64 # files into unwanted directories.
66 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
67 unset htmldir includedir infodir libdir libexecdir localedir mandir
68 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
69 # Unset variables that might change the "make distcheck" behaviour.
70 unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
71 # Used by install rules for info files.
72 unset AM_UPDATE_INFO_DIR
73 # The tests call "make -e" but we do not want $srcdir from the environment
74 # to override the definition from the Makefile.
76 # Also unset variables that control our test driver. While not
77 # conceptually independent, they cause some changed semantics we
78 # need to control (and test for) in some of the tests to ensure
79 # backward-compatible behavior.
80 unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
81 unset DISABLE_HARD_ERRORS
89 for pfx in TEST_ SH_ TAP_ ''; do
90 unset ${pfx}LOG_COMPILER
91 unset ${pfx}LOG_COMPILE # Not a typo!
93 unset AM_${pfx}LOG_FLAGS
94 unset ${pfx}LOG_DRIVER
95 unset ${pfx}LOG_DRIVER_FLAGS
96 unset AM_${pfx}LOG_DRIVER_FLAGS
100 # Re-enable, it had been temporarily disabled above.
103 ## ---------------------------- ##
104 ## Auxiliary shell functions. ##
105 ## ---------------------------- ##
107 # Tell whether we should keep the test directories around, even in
108 # case of success. By default, we don't.
109 am_keeping_testdirs ()
111 case $keep_testdirs in
112 ""|n|no|NO) return 1;;
117 # This is used in '_am_exit' and in the exit trap. See comments in
118 # the latter for more information.
121 # We use a trap below for cleanup. This requires us to go through
122 # hoops to get the right exit status transported through the signal.
123 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
124 # sh inside this function (FIXME: is this still relevant now that we
125 # require a POSIX shell?).
129 # See comments in the exit trap for the reason we do this.
130 test 77 = $1 && am__test_skipped=yes
131 # Spurious escaping to ensure we do not call our 'exit' alias.
136 if test $am_using_tap = yes; then
137 am_funcs_file=tap-functions.sh
139 am_funcs_file=plain-functions.sh
142 if test -f "$am_testauxdir/$am_funcs_file"; then
143 . "$am_testauxdir/$am_funcs_file" || {
144 echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
148 echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
155 # Tell whether we are cross-compiling. This is especially useful to skip
156 # tests (or portions of them) that requires a native compiler.
159 # Quoting from the autoconf manual:
160 # ... [$host_alias and $build both] default to the result of running
161 # config.guess, unless you specify either --build or --host. In
162 # this case, the default becomes the system type you specified.
163 # If you specify both, *and they're different*, configure enters
164 # cross compilation mode (so it doesn't run any tests that require
166 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
169 # is_blocked_signal SIGNAL-NUMBER
170 # --------------------------------
171 # Return success if the given signal number is blocked in the shell,
172 # return a non-zero exit status and print a proper diagnostic otherwise.
175 # Use perl, since trying to do this portably in the shell can be
176 # very tricky, if not downright impossible. For reference, see:
177 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
180 use warnings FATAL => "all";
182 my %oldsigaction = ();
183 sigaction('"$1"', 0, \%oldsigaction);
184 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
187 elif test $? -eq 77; then
190 fatal_ "couldn't determine whether signal $1 is blocked"
194 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
195 # -----------------------------------------------------------------
196 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
197 # STATUS. Should be polymorphic for TAP and "plain" tests. The
198 # DESCRIPTION, when provided, is used for console reporting, only if
199 # the TAP protocol is in use in the current test script.
204 while test $# -gt 0; do
206 -d) am__desc=$2; shift;;
207 -e) am__exp_rc=$2; shift;;
209 # Don't fail on unknown option: assume they (and the rest of the
210 # command line) are to be passed verbatim to automake (so stop our
211 # own option parsing).
217 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
220 if test $am_using_tap != yes; then
221 test $am__got_rc -eq $am__exp_rc || exit 1
224 if test -z "$am__desc"; then
225 if test $am__got_rc -eq $am__exp_rc; then
226 am__desc="automake exited $am__got_rc"
228 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
231 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
234 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
235 # --------------------------------------------
236 # Run automake with OPTIONS, and fail if doesn't exit with status 1.
237 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
238 # when provided, is used for console reporting, only if the TAP
239 # protocol is in use in the current test script.
242 AUTOMAKE_run -e 1 ${1+"$@"}
245 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
246 # -----------------------------------------------------------
247 # Use this to extract from the output of "./configure --help" (or similar)
248 # the description or help message associated to the given --OPTION or
250 extract_configure_help ()
252 am__opt_re='' am__var_re=''
254 --*'=') am__opt_re="^ $1";;
255 --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
256 --*) am__opt_re="^ $1( .*|$)";;
257 *) am__var_re="^ $1( .*|$)";;
260 if test x"$am__opt_re" != x; then
262 /'"$am__opt_re"'/ { print; do_print = 1; next; }
263 /^$/ { do_print = 0; next }
264 /^ --/ { do_print = 0; next }
265 (do_print == 1) { print }
269 /'"$am__var_re"'/ { print; do_print = 1; next; }
270 /^$/ { do_print = 0; next }
271 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
272 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
273 (do_print == 1) { print }
278 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
279 # -------------------------------------------------------
280 # Grep the section of "./configure --help" output associated with either
281 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
282 grep_configure_help ()
284 ./configure --help > am--all-help \
285 || { cat am--all-help; exit 1; }
287 extract_configure_help "$1" am--all-help > am--our-help \
288 || { cat am--our-help; exit 1; }
290 $EGREP "$2" am--our-help || exit 1
295 # Return success if $MAKE is GNU make, return failure otherwise.
296 # Caches the result for speed reasons.
299 case $am__using_gmake in
305 # Use --version AND -v, because SGI Make doesn't fail on --version.
306 # Also grep for GNU because newer versions of FreeBSD make do
307 # not complain about --version (they seem to silently ignore it).
308 if $MAKE --version -v | grep GNU; then
316 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
319 am__using_gmake="" # Avoid interferences from the environment.
321 # make_can_chain_suffix_rules
322 # ---------------------------
323 # Return 0 if $MAKE is a make implementation that can chain suffix rules
324 # automatically, return 1 otherwise. Caches the result for speed reasons.
325 make_can_chain_suffix_rules ()
327 if test -z "$am__can_chain_suffix_rules"; then
329 am__can_chain_suffix_rules=yes
332 mkdir am__chain.dir$$
334 unindent > Makefile << 'END'
339 echo make can chain suffix rules > foo.u
340 if $MAKE foo.w && diff foo.u foo.w; then
341 am__can_chain_suffix_rules=yes
343 am__can_chain_suffix_rules=no
346 rm -rf am__chain.dir$$
349 case $am__can_chain_suffix_rules in
352 *) fatal_ "make_can_chain_suffix_rules: internal error";;
355 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
357 # useless_vpath_rebuild
358 # ---------------------
359 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
360 # For example, this happens with FreeBSD make, since in a VPATH build
361 # it tends to rebuilt files for which there is an explicit or even just
362 # a suffix rule, even if said files are already available in the VPATH
364 useless_vpath_rebuild ()
366 if test -z "$am__useless_vpath_rebuild"; then
368 am__useless_vpath_rebuild=no
371 mkdir am__vpath.dir$$
373 touch foo.a foo.b bar baz
376 unindent > Makefile << 'END'
382 baz: bar ; cp ../baz bar
384 if $MAKE all && test ! -e foo.b && test ! -e bar; then
385 am__useless_vpath_rebuild=no
387 am__useless_vpath_rebuild=yes
390 rm -rf am__vpath.dir$$
392 case $am__useless_vpath_rebuild in
396 *) fatal_ "no_useless_builddir_remake: internal error";;
399 am__useless_vpath_rebuild=""
401 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
403 # seq_ - print a sequence of numbers
404 # ----------------------------------
405 # This function simulates GNU seq(1) portably. Valid usages:
408 # - seq FIRST INCREMENT LAST
412 0) fatal_ "seq_: missing argument";;
413 1) seq_first=1 seq_incr=1 seq_last=$1;;
414 2) seq_first=$1 seq_incr=1 seq_last=$2;;
415 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
416 *) fatal_ "seq_: too many arguments";;
419 while test $i -le $seq_last; do
421 i=$(($i + $seq_incr))
425 # rm_rf_ [FILES OR DIRECTORIES ...]
426 # ---------------------------------
427 # Recursively remove the given files or directory, also handling the case
428 # of non-writable subdirectories.
431 test $# -gt 0 || return 0
432 # Ignore failures in find, we are only interested in failures of the
434 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
438 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
439 # -----------------------------------------------------------------------
440 # Check that a testsuite run driven by the parallel-tests harness has
441 # had the specified numbers of test results (specified by kind).
442 # This function assumes that the output of "make check" or "make recheck"
443 # has been saved in the 'stdout' file in the current directory, and its
444 # log in the 'test-suite.log' file.
445 count_test_results ()
447 # Use a subshell so that we won't pollute the script namespace.
449 # TODO: Do proper checks on the arguments?
450 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
453 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
455 # Avoid spurious failures with shells with "overly sensible"
456 # errexit shell flag, such as e.g., Solaris /bin/sh.
458 test $(grep -c '^PASS:' stdout) -eq $pass || rc=1
459 test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
460 test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1
461 test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1
462 test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
463 test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
464 grep "^# TOTAL: *$total$" stdout || rc=1
465 grep "^# PASS: *$pass$" stdout || rc=1
466 grep "^# XFAIL: *$xfail$" stdout || rc=1
467 grep "^# SKIP: *$skip$" stdout || rc=1
468 grep "^# FAIL: *$fail$" stdout || rc=1
469 grep "^# XPASS: *$xpass$" stdout || rc=1
470 grep "^# ERROR: *$error$" stdout || rc=1
475 commented_sed_unindent_prog='
476 /^$/b # Nothing to do for empty lines.
477 x # Get x<indent> into pattern space.
478 /^$/{ # No prior x<indent>, go prepare it.
479 g # Copy this 1st non-blank line into pattern space.
480 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
481 } # Now: x<indent> in pattern and <line> in hold.
482 G # Build x<indent>\n<line> in pattern space, and
483 h # duplicate it into hold space.
484 s/\n.*$// # Restore x<indent> in pattern space, and
485 x # exchange with the above duplicate in hold space.
486 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
487 s/^x.*\n// # Restore <line> when there is no leading <indent>.
490 # unindent [input files...]
491 # -------------------------
492 # Remove the "proper" amount of leading whitespace from the given files,
493 # and output the result on stdout. That amount is determined by looking
494 # at the leading whitespace of the first non-blank line in the input
495 # files. If no input file is specified, standard input is implied.
498 if test x"$sed_unindent_prog" = x; then
499 sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
500 | sed -e "s/ *# .*//")
502 sed "$sed_unindent_prog" ${1+"$@"}
504 sed_unindent_prog="" # Avoid interferences from the environment.
506 # get_shell_script SCRIPT-NAME
507 # -----------------------------
508 # Fetch an Automake-provided shell script from the 'lib/' directory into
509 # the current directory, and, if the '$am_test_prefer_config_shell'
510 # variable is set to "yes", modify its shebang line to use $SHELL instead
514 test ! -f "$1" || rm -f "$1" || return 99
515 if test x"$am_test_prefer_config_shell" = x"yes"; then
516 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
520 cp -f "$am_scriptdir/$1" . || return 99
522 sed 10q "$1" # For debugging.
527 # Skip the test if the given shell fails to support common XSI constructs.
530 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
531 echo "$me: trying some XSI constructs with $1"
532 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
534 # Shell code supposed to work only with XSI shells. Keep this in sync
535 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
538 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
540 && eval '\''test $(( 1 + 1 )) -eq 2 \
541 && test "${#_lt_dummy}" -eq 5'\'
545 # Fetch the Automake-provided TAP driver from the 'lib/' directory into
546 # the current directory, and edit its shebang line so that it will be
547 # run with the perl interpreter determined at configure time.
550 # TODO: we should devise a way to make the shell TAP driver tested also
551 # TODO: with /bin/sh, for better coverage.
552 case $am_tap_implementation in
553 # Extra quoting required to avoid maintainer-check spurious failures.
555 $PERL -MTAP::Parser -e 1 \
556 || skip_all_ "cannot import TAP::Parser perl module"
557 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
560 AM_TAP_AWK=$AWK; export AM_TAP_AWK
561 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
564 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
566 && chmod a+x tap-driver \
567 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
568 sed 10q tap-driver # For debugging.
570 # The shell/awk implementation of the TAP driver is still mostly dummy, so
571 # use the perl implementation by default for the moment.
572 am_tap_implementation=${am_tap_implementation-shell}
574 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
578 0) fatal_ "require_compiler_: missing argument";;
580 *) fatal_ "require_compiler_: too many arguments";;
586 am__comp_flag_vars='CFLAGS CPPFLAGS'
591 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
594 am__comp_lang="Fortran"
596 am__comp_flag_vars='FCFLAGS'
599 am__comp_lang="Fortran 77"
601 am__comp_flag_vars='FFLAGS'
605 eval "am__comp_prog=\${$am__comp_var}" \
606 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
607 case $am__comp_prog in
609 fatal_ "botched configuration: \$$am__comp_var is empty";;
611 skip_all_ "no $am__comp_lang compiler available";;
612 autodetect|autodetected)
613 # Let the ./configure commands in the test script try to determine
614 # these automatically.
615 unset $am__comp_var $am__comp_flag_vars;;
617 # Pre-set these for the ./configure commands in the test script.
618 export $am__comp_var $am__comp_flag_vars;;
620 # Delete private variables.
621 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
624 ## ----------------------------------------------------------- ##
625 ## Checks for required tools, and additional setups (if any) ##
626 ## required by them. ##
627 ## ----------------------------------------------------------- ##
633 cc|c++|fortran|fortran77)
634 require_compiler_ $1;;
636 if test x"$am_test_prefer_config_shell" = x"yes"; then
639 require_xsi "/bin/sh"
643 # Do not use --version, older versions bzip2 still tries to compress
645 echo "$me: running bzip2 --help"
647 || skip_all_ "required program 'bzip2' not available"
651 # Don't export CFLAGS, as that could have been initialized to only
652 # work with the C compiler detected at configure time. If the user
653 # wants CFLAGS to also influence 'cl', he can still export CFLAGS
654 # in the environment "by hand" before calling the testsuite.
656 echo "$me: running $CC -?"
657 $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
660 # Exuberant Ctags will create a TAGS file even
661 # when asked for --help or --version. (Emacs's etags
662 # does not have such problem.) Use -o /dev/null
663 # to make sure we do not pollute the build directory.
664 echo "$me: running etags --version -o /dev/null"
665 etags --version -o /dev/null \
666 || skip_all_ "required program 'etags' not available"
669 for make_ in "$MAKE" gmake gnumake :; do
670 MAKE=$make_ am__using_gmake=''
671 test "$MAKE" = : && break
672 echo "$me: determine whether $MAKE is GNU make"
674 : For shells with busted 'set -e'.
676 test "$MAKE" = : && skip_all_ "this test requires GNU make"
681 GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
682 test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
683 : For shells with busted 'set -e'.
686 CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
687 test "$CC" = false && skip_all_ "GNU C compiler unavailable"
688 : For shells with busted 'set -e'.
691 CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
692 test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
693 : For shells with busted 'set -e'.
696 FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
697 test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
698 case " $required " in
700 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
704 F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
705 test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
706 case " $required " in
708 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
712 # Check that grep can parse nonprinting characters correctly.
713 # BSD 'grep' works from a pipe, but not a seekable file.
714 # GNU or BSD 'grep -a' works on files, but is not portable.
715 case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
717 *) skip_ "grep can't handle nonprinting characters correctly";;
721 # The Java compiler from JDK 1.5 (and presumably earlier versions)
722 # cannot handle the '-version' option by itself: it bails out
723 # telling that source files are missing. Adding also the '-help'
724 # option seems to solve the problem.
725 echo "$me: running javac -version -help"
726 javac -version -help || skip_all_ "Sun Java compiler not available"
729 # See the comments above about 'javac' for why we use also '-help'.
730 echo "$me: running java -version -help"
731 java -version -help || skip_all_ "Sun Java interpreter not found"
736 # Attempting to create an empty archive will actually not
737 # create the archive, but lib will output its version.
738 echo "$me: running $AR -out:defstest.lib"
739 $AR -out:defstest.lib \
740 || skip_all_ "Microsoft 'lib' utility not available"
743 echo "$me: running makedepend -f-"
745 || skip_all_ "required program 'makedepend' not available"
748 # Make sure we have makeinfo, and it understands '--html'.
749 echo "$me: running makeinfo --html --version"
750 makeinfo --html --version \
751 || skip_all_ "cannot find a makeinfo program that groks" \
752 "the '--html' option"
755 uname_s=$(uname -s || echo UNKNOWN)
756 echo "$me: system name: $uname_s"
759 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
764 # Skip this test case if the user is root.
765 # We try to append to a read-only file to detect this.
766 priv_check_temp=priv-check.$$
767 touch $priv_check_temp && chmod a-w $priv_check_temp \
768 || framework_failure_ "creating unwritable file $priv_check_temp"
769 # Not a useless use of subshell: lesser shells might bail
770 # out if a builtin fails.
772 (echo foo >> $priv_check_temp) || overwrite_status=$?
773 rm -f $priv_check_temp
774 if test $overwrite_status -eq 0; then
775 skip_all_ "cannot drop file write permissions"
777 unset priv_check_temp overwrite_status
779 # Extra quoting required to avoid maintainer-check spurious failures.
781 if test "$WANT_NO_THREADS" = "yes"; then
782 skip_all_ "Devel::Cover cannot cope with threads"
786 # Don't use "&&" here, to avoid a bug of 'set -e' present in
787 # some (even relatively recent) versions of the BSD shell.
788 # We add the dummy "else" branch for extra safety.
789 ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
792 # Python doesn't support --version, it has -V
793 echo "$me: running python -V"
794 python -V || skip_all_ "python interpreter not available"
797 # Skip this test case if read-only directories aren't supported
799 ro_dir_temp=ro_dir.$$
800 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
801 || framework_failure_ "creating unwritable directory $ro_dir_temp"
802 # Not a useless use of subshell: lesser shells might bail
803 # out if a builtin fails.
805 (: > $ro_dir_temp/probe) || create_status=$?
807 if test $create_status -eq 0; then
808 skip_all_ "cannot drop directory write permissions"
810 unset ro_dir_temp create_status
813 # DejaGnu's runtest program. We rely on being able to specify
814 # the program on the runtest command-line. This requires
815 # DejaGnu 1.4.3 or later.
816 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
817 runtest SOMEPROGRAM=someprogram --version \
818 || skip_all_ "DejaGnu is not available"
821 # No all versions of Tex support '--version', so we use
823 if test -z "$TEX"; then
824 skip_all_ "TeX is required, but it wasn't found by configure"
828 # Texi2dvi supports '-o' since Texinfo 4.1.
829 echo "$me: running texi2dvi -o /dev/null --version"
830 texi2dvi -o /dev/null --version \
831 || skip_all_ "required program 'texi2dvi' not available"
834 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
838 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
843 echo "$me: running flex --version"
844 flex --version || skip_all_ "required program 'flex' not available"
847 YACC='bison -y'; export YACC
848 echo "$me: running bison --version"
849 bison --version || skip_all_ "required program 'bison' not available"
852 # Generic case: the tool must support --version.
853 echo "$me: running $1 --version"
854 # It is not likely but possible that the required tool is a special
855 # builtin, in which case the shell is allowed to exit after an error.
856 # So we need the subshell here. Also, some tools, like Sun cscope,
857 # can be interactive without redirection.
858 ($1 --version) </dev/null \
859 || skip_all_ "required program '$1' not available"
864 process_requirements ()
866 # Look for (and maybe set up) required tools and/or system features;
867 # skip the current test if they are not found.
868 for am_tool in $*; do
869 require_tool $am_tool
872 # We might need extra macros, e.g., from Libtool or Gettext.
873 case " $required " in
874 *\ libtool*) . ./t/libtool-macros.dir/get.sh;;
876 case " $required " in
877 *\ gettext*) . ./t/gettext-macros.dir/get.sh;;
881 ## ---------------------------------------------------------------- ##
882 ## Create and set up of the temporary directory used by the test. ##
883 ## Set up of the exit trap for cleanup of said directory. ##
884 ## ---------------------------------------------------------------- ##
886 # This might be used in testcases checking distribution-related features.
887 # Test scripts are free to override this if they need to.
890 # Set up the exit trap.
895 cd "$am_top_builddir"
896 if test $am_using_tap = yes; then
897 if test "$planned_" = later && test $exit_status -eq 0; then
900 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
903 # This is to ensure that a test script does give a SKIP outcome just
904 # because a command in it happens to exit with status 77. This
905 # behaviour, while from time to time useful to developers, is not
906 # meant to be enabled by default, as it could cause spurious failures
907 # in the wild. Thus it will be enabled only when the variable
908 # "am_explicit_skips" is set to a "true" value.
909 case $am_explicit_skips in
911 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
912 echo "$me: implicit skip turned into failure"
916 test $exit_status -eq 0 || keep_testdirs=yes
918 am_keeping_testdirs || rm_rf_ $am_test_subdir
920 echo "$me: exit $exit_status"
921 # Spurious escaping to ensure we do not call our "exit" alias.
927 trap 'am_exit_trap $?' 0
928 trap "fatal_ 'caught signal SIGHUP'" 1
929 trap "fatal_ 'caught signal SIGINT'" 2
930 trap "fatal_ 'caught signal SIGTERM'" 15
931 # Various shells seems to just ignore SIGQUIT under some circumstances,
932 # even if the signal is not blocked; however, if the signal it trapped,
933 # the trap gets correctly executed. So we also trap SIGQUIT.
934 # Here is a list of some shells that have been verified to exhibit the
935 # problematic behavior with SIGQUIT:
936 # - zsh 4.3.12 on Debian GNU/Linux
937 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
938 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
939 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
940 # OTOH, at least these shells that do *not* exhibit that behaviour:
941 # - modern version of the Almquist Shell (at least 0.5.5.1), on
942 # both Solaris and GNU/Linux
943 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
944 trap "fatal_ 'caught signal SIGQUIT'" 3
945 # Ignore further SIGPIPE in the trap code. This is required to avoid
946 # a very weird issue with some shells, at least when the execution of
947 # the automake testsuite is driven by the 'prove' utility: if prove
948 # (or the make process that has spawned it) gets interrupted with
949 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
950 # sometimes finally dumping core, other times hanging indefinitely.
951 # See also Test::Harness bug [rt.cpan.org #70855], archived at
952 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
953 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
958 # The subdirectory where the current test script will run and write its
959 # temporary/data files. This will be created shortly, and will be removed
960 # by the cleanup trap below if the test passes. If the test doesn't pass,
961 # this directory will be kept, to facilitate debugging.
962 am_test_subdir=${argv0#$am_rel_srcdir/}
963 case $am_test_subdir in
964 */*) am_test_subdir=${am_test_subdir%/*}/$me.dir;;
965 *) am_test_subdir=$me.dir;;
967 test ! -e $am_test_subdir || rm_rf_ $am_test_subdir \
968 || framework_failure_ "removing old test subdirectory"
969 $MKDIR_P $am_test_subdir \
970 || framework_failure_ "creating test subdirectory"
972 || framework_failure_ "cannot chdir into test subdirectory"
973 if test x"$am_create_testdir" != x"empty"; then
974 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
975 "$am_scriptdir"/depcomp . \
976 || framework_failure_ "fetching common files from $am_scriptdir"
977 # Build appropriate environment in test directory. E.g., create
978 # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
979 # but AC_CONFIG_FILES so that appending still produces a valid
980 # configure.ac. But then, tests running config.status really need
981 # to append AC_OUTPUT.
983 echo "AC_INIT([$me], [1.0])"
984 if test x"$am_serial_tests" = x"yes"; then
985 echo "AM_INIT_AUTOMAKE"
987 echo "AM_INIT_AUTOMAKE([parallel-tests])"
989 echo "AC_CONFIG_FILES([Makefile])"
990 } >configure.ac || framework_failure_ "creating configure.ac skeleton"
996 process_requirements $required
998 # Create and populate the temporary directory, if required.
999 if test x"$am_create_testdir" = x"no"; then
1004 echo "Running from installcheck: $am_running_installcheck"
1005 echo "Using TAP: $am_using_tap"
1011 ## ---------------- ##
1012 ## Ready to go... ##
1013 ## ---------------- ##