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 sanity checks. ##
28 ## --------------------- ##
30 # Ensure $am_top_srcdir is set correctly.
31 test -f "$am_top_srcdir/defs-static.in" || {
32 echo "$me: $am_top_srcdir/defs-static.in not found," \
33 "check \$am_top_srcdir" >&2
37 # Ensure $am_top_builddir is set correctly.
38 test -f "$am_top_builddir/defs-static" || {
39 echo "$me: $am_top_builddir/defs-static not found," \
40 "check \$am_top_builddir" >&2
45 ## ------------------ ##
46 ## Early variables. ##
47 ## ------------------ ##
49 # A single whitespace character.
51 # A tabulation character.
53 # A newline character.
56 # A literal escape character. Used by test checking colored output.
59 # As autoconf-generated configure scripts do, ensure that IFS
60 # is defined initially, so that saving and restoring $IFS works.
64 ## ----------------------- ##
65 ## Early debugging info. ##
66 ## ----------------------- ##
68 echo "Running from installcheck: $am_running_installcheck"
69 echo "Using TAP: $am_using_tap"
73 ## ---------------------- ##
74 ## Environment cleanup. ##
75 ## ---------------------- ##
77 # Temporarily disable this, since some shells (e.g., older version
78 # of Bash) can return a non-zero exit status upon the when a non-set
82 # Unset some make-related variables that may cause $MAKE to act like
83 # a recursively invoked sub-make. Any $MAKE invocation in a test is
84 # conceptually an independent invocation, not part of the main
86 unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
87 unset __MKLVL__ MAKE_JOBS_FIFO # For BSD make.
88 unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
89 # Unset verbosity flag.
91 # Also unset variables that will let "make -e install" divert
92 # files into unwanted directories.
94 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
95 unset htmldir includedir infodir libdir libexecdir localedir mandir
96 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
97 # Unset variables that might change the "make distcheck" behaviour.
98 unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
99 # Used by install rules for info files.
100 unset AM_UPDATE_INFO_DIR
101 # The tests call "make -e" but we do not want $srcdir from the environment
102 # to override the definition from the Makefile.
104 # Also unset variables that control our test driver. While not
105 # conceptually independent, they cause some changed semantics we
106 # need to control (and test for) in some of the tests to ensure
107 # backward-compatible behavior.
108 unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
109 unset DISABLE_HARD_ERRORS
117 for pfx in TEST_ SH_ TAP_ ''; do
118 unset ${pfx}LOG_COMPILER
119 unset ${pfx}LOG_COMPILE # Not a typo!
120 unset ${pfx}LOG_FLAGS
121 unset AM_${pfx}LOG_FLAGS
122 unset ${pfx}LOG_DRIVER
123 unset ${pfx}LOG_DRIVER_FLAGS
124 unset AM_${pfx}LOG_DRIVER_FLAGS
128 # Re-enable, it had been temporarily disabled above.
131 ## ---------------------------- ##
132 ## Auxiliary shell functions. ##
133 ## ---------------------------- ##
135 # Tell whether we should keep the test directories around, even in
136 # case of success. By default, we don't.
137 am_keeping_testdirs ()
139 case $keep_testdirs in
140 ""|n|no|NO) return 1;;
145 # This is used in '_am_exit' and in the exit trap. See comments in
146 # the latter for more information.
149 # We use a trap below for cleanup. This requires us to go through
150 # hoops to get the right exit status transported through the signal.
151 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
152 # sh inside this function (FIXME: is this still relevant now that we
153 # require a POSIX shell?).
157 # See comments in the exit trap for the reason we do this.
158 test 77 = $1 && am__test_skipped=yes
159 # Spurious escaping to ensure we do not call our 'exit' alias.
164 if test $am_using_tap = yes; then
165 am_funcs_file=tap-functions.sh
167 am_funcs_file=plain-functions.sh
170 if test -f "$am_testauxdir/$am_funcs_file"; then
171 . "$am_testauxdir/$am_funcs_file" || {
172 echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
176 echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
183 # Tell whether we are cross-compiling. This is especially useful to skip
184 # tests (or portions of them) that requires a native compiler.
187 # Quoting from the autoconf manual:
188 # ... [$host_alias and $build both] default to the result of running
189 # config.guess, unless you specify either --build or --host. In
190 # this case, the default becomes the system type you specified.
191 # If you specify both, *and they're different*, configure enters
192 # cross compilation mode (so it doesn't run any tests that require
194 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
197 # is_blocked_signal SIGNAL-NUMBER
198 # --------------------------------
199 # Return success if the given signal number is blocked in the shell,
200 # return a non-zero exit status and print a proper diagnostic otherwise.
203 # Use perl, since trying to do this portably in the shell can be
204 # very tricky, if not downright impossible. For reference, see:
205 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
208 use warnings FATAL => "all";
210 my %oldsigaction = ();
211 sigaction('"$1"', 0, \%oldsigaction);
212 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
215 elif test $? -eq 77; then
218 fatal_ "couldn't determine whether signal $1 is blocked"
222 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
223 # -----------------------------------------------------------------
224 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
225 # STATUS. Should be polymorphic for TAP and "plain" tests. The
226 # DESCRIPTION, when provided, is used for console reporting, only if
227 # the TAP protocol is in use in the current test script.
232 while test $# -gt 0; do
234 -d) am__desc=$2; shift;;
235 -e) am__exp_rc=$2; shift;;
237 # Don't fail on unknown option: assume they (and the rest of the
238 # command line) are to be passed verbatim to automake (so stop our
239 # own option parsing).
245 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
248 if test $am_using_tap != yes; then
249 test $am__got_rc -eq $am__exp_rc || exit 1
252 if test -z "$am__desc"; then
253 if test $am__got_rc -eq $am__exp_rc; then
254 am__desc="automake exited $am__got_rc"
256 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
259 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
262 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
263 # --------------------------------------------
264 # Run automake with OPTIONS, and fail if doesn't exit with status 1.
265 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
266 # when provided, is used for console reporting, only if the TAP
267 # protocol is in use in the current test script.
270 AUTOMAKE_run -e 1 ${1+"$@"}
273 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
274 # -----------------------------------------------------------
275 # Use this to extract from the output of "./configure --help" (or similar)
276 # the description or help message associated to the given --OPTION or
278 extract_configure_help ()
280 am__opt_re='' am__var_re=''
282 --*'=') am__opt_re="^ $1";;
283 --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
284 --*) am__opt_re="^ $1( .*|$)";;
285 *) am__var_re="^ $1( .*|$)";;
288 if test x"$am__opt_re" != x; then
290 /'"$am__opt_re"'/ { print; do_print = 1; next; }
291 /^$/ { do_print = 0; next }
292 /^ --/ { do_print = 0; next }
293 (do_print == 1) { print }
297 /'"$am__var_re"'/ { print; do_print = 1; next; }
298 /^$/ { do_print = 0; next }
299 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
300 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
301 (do_print == 1) { print }
306 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
307 # -------------------------------------------------------
308 # Grep the section of "./configure --help" output associated with either
309 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
310 grep_configure_help ()
312 ./configure --help > am--all-help \
313 || { cat am--all-help; exit 1; }
315 extract_configure_help "$1" am--all-help > am--our-help \
316 || { cat am--our-help; exit 1; }
318 $EGREP "$2" am--our-help || exit 1
323 # Return success if $MAKE is GNU make, return failure otherwise.
324 # Caches the result for speed reasons.
327 case $am__using_gmake in
333 # Use --version AND -v, because SGI Make doesn't fail on --version.
334 # Also grep for GNU because newer versions of FreeBSD make do
335 # not complain about --version (they seem to silently ignore it).
336 if $MAKE --version -v | grep GNU; then
344 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
347 am__using_gmake="" # Avoid interferences from the environment.
349 # make_can_chain_suffix_rules
350 # ---------------------------
351 # Return 0 if $MAKE is a make implementation that can chain suffix rules
352 # automatically, return 1 otherwise. Caches the result for speed reasons.
353 make_can_chain_suffix_rules ()
355 if test -z "$am__can_chain_suffix_rules"; then
357 am__can_chain_suffix_rules=yes
360 mkdir am__chain.dir$$
362 unindent > Makefile << 'END'
367 echo make can chain suffix rules > foo.u
368 if $MAKE foo.w && diff foo.u foo.w; then
369 am__can_chain_suffix_rules=yes
371 am__can_chain_suffix_rules=no
374 rm -rf am__chain.dir$$
377 case $am__can_chain_suffix_rules in
380 *) fatal_ "make_can_chain_suffix_rules: internal error";;
383 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
385 # useless_vpath_rebuild
386 # ---------------------
387 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
388 # For example, this happens with FreeBSD make, since in a VPATH build
389 # it tends to rebuilt files for which there is an explicit or even just
390 # a suffix rule, even if said files are already available in the VPATH
392 useless_vpath_rebuild ()
394 if test -z "$am__useless_vpath_rebuild"; then
396 am__useless_vpath_rebuild=no
399 mkdir am__vpath.dir$$
401 touch foo.a foo.b bar baz
404 unindent > Makefile << 'END'
410 baz: bar ; cp ../baz bar
412 if $MAKE all && test ! -e foo.b && test ! -e bar; then
413 am__useless_vpath_rebuild=no
415 am__useless_vpath_rebuild=yes
418 rm -rf am__vpath.dir$$
420 case $am__useless_vpath_rebuild in
424 *) fatal_ "no_useless_builddir_remake: internal error";;
427 am__useless_vpath_rebuild=""
429 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
431 # seq_ - print a sequence of numbers
432 # ----------------------------------
433 # This function simulates GNU seq(1) portably. Valid usages:
436 # - seq FIRST INCREMENT LAST
440 0) fatal_ "seq_: missing argument";;
441 1) seq_first=1 seq_incr=1 seq_last=$1;;
442 2) seq_first=$1 seq_incr=1 seq_last=$2;;
443 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
444 *) fatal_ "seq_: too many arguments";;
447 while test $i -le $seq_last; do
449 i=$(($i + $seq_incr))
453 # rm_rf_ [FILES OR DIRECTORIES ...]
454 # ---------------------------------
455 # Recursively remove the given files or directory, also handling the case
456 # of non-writable subdirectories.
459 test $# -gt 0 || return 0
460 # Ignore failures in find, we are only interested in failures of the
462 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
466 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
467 # -----------------------------------------------------------------------
468 # Check that a testsuite run driven by the parallel-tests harness has
469 # had the specified numbers of test results (specified by kind).
470 # This function assumes that the output of "make check" or "make recheck"
471 # has been saved in the 'stdout' file in the current directory, and its
472 # log in the 'test-suite.log' file.
473 count_test_results ()
475 # Use a subshell so that we won't pollute the script namespace.
477 # TODO: Do proper checks on the arguments?
478 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
481 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
483 # Avoid spurious failures with shells with "overly sensible"
484 # errexit shell flag, such as e.g., Solaris /bin/sh.
486 test $(grep -c '^PASS:' stdout) -eq $pass || rc=1
487 test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
488 test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1
489 test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1
490 test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
491 test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
492 grep "^# TOTAL: *$total$" stdout || rc=1
493 grep "^# PASS: *$pass$" stdout || rc=1
494 grep "^# XFAIL: *$xfail$" stdout || rc=1
495 grep "^# SKIP: *$skip$" stdout || rc=1
496 grep "^# FAIL: *$fail$" stdout || rc=1
497 grep "^# XPASS: *$xpass$" stdout || rc=1
498 grep "^# ERROR: *$error$" stdout || rc=1
503 commented_sed_unindent_prog='
504 /^$/b # Nothing to do for empty lines.
505 x # Get x<indent> into pattern space.
506 /^$/{ # No prior x<indent>, go prepare it.
507 g # Copy this 1st non-blank line into pattern space.
508 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
509 } # Now: x<indent> in pattern and <line> in hold.
510 G # Build x<indent>\n<line> in pattern space, and
511 h # duplicate it into hold space.
512 s/\n.*$// # Restore x<indent> in pattern space, and
513 x # exchange with the above duplicate in hold space.
514 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
515 s/^x.*\n// # Restore <line> when there is no leading <indent>.
518 # unindent [input files...]
519 # -------------------------
520 # Remove the "proper" amount of leading whitespace from the given files,
521 # and output the result on stdout. That amount is determined by looking
522 # at the leading whitespace of the first non-blank line in the input
523 # files. If no input file is specified, standard input is implied.
526 if test x"$sed_unindent_prog" = x; then
527 sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
528 | sed -e "s/ *# .*//")
530 sed "$sed_unindent_prog" ${1+"$@"}
532 sed_unindent_prog="" # Avoid interferences from the environment.
534 # get_shell_script SCRIPT-NAME
535 # -----------------------------
536 # Fetch an Automake-provided shell script from the 'lib/' directory into
537 # the current directory, and, if the '$am_test_prefer_config_shell'
538 # variable is set to "yes", modify its shebang line to use $SHELL instead
542 test ! -f "$1" || rm -f "$1" || return 99
543 if test x"$am_test_prefer_config_shell" = x"yes"; then
544 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
548 cp -f "$am_scriptdir/$1" . || return 99
550 sed 10q "$1" # For debugging.
555 # Skip the test if the given shell fails to support common XSI constructs.
558 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
559 echo "$me: trying some XSI constructs with $1"
560 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
562 # Shell code supposed to work only with XSI shells. Keep this in sync
563 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
566 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
568 && eval '\''test $(( 1 + 1 )) -eq 2 \
569 && test "${#_lt_dummy}" -eq 5'\'
573 # Fetch the Automake-provided TAP driver from the 'lib/' directory into
574 # the current directory, and edit its shebang line so that it will be
575 # run with the perl interpreter determined at configure time.
578 # TODO: we should devise a way to make the shell TAP driver tested also
579 # TODO: with /bin/sh, for better coverage.
580 case $am_tap_implementation in
581 # Extra quoting required to avoid maintainer-check spurious failures.
583 $PERL -MTAP::Parser -e 1 \
584 || skip_all_ "cannot import TAP::Parser perl module"
585 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
588 AM_TAP_AWK=$AWK; export AM_TAP_AWK
589 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
592 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
594 && chmod a+x tap-driver \
595 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
596 sed 10q tap-driver # For debugging.
598 # The shell/awk implementation of the TAP driver is still mostly dummy, so
599 # use the perl implementation by default for the moment.
600 am_tap_implementation=${am_tap_implementation-shell}
602 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
606 0) fatal_ "require_compiler_: missing argument";;
608 *) fatal_ "require_compiler_: too many arguments";;
614 am__comp_flag_vars='CFLAGS CPPFLAGS'
619 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
622 am__comp_lang="Fortran"
624 am__comp_flag_vars='FCFLAGS'
627 am__comp_lang="Fortran 77"
629 am__comp_flag_vars='FFLAGS'
633 eval "am__comp_prog=\${$am__comp_var}" \
634 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
635 case $am__comp_prog in
637 fatal_ "botched configuration: \$$am__comp_var is empty";;
639 skip_all_ "no $am__comp_lang compiler available";;
640 autodetect|autodetected)
641 # Let the ./configure commands in the test script try to determine
642 # these automatically.
643 unset $am__comp_var $am__comp_flag_vars;;
645 # Pre-set these for the ./configure commands in the test script.
646 export $am__comp_var $am__comp_flag_vars;;
648 # Delete private variables.
649 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
652 ## ----------------------------------------------------------- ##
653 ## Checks for required tools, and additional setups (if any) ##
654 ## required by them. ##
655 ## ----------------------------------------------------------- ##
657 # Performance tests must be enabled explicitly.
660 case $AM_TESTSUITE_PERF in
662 *) skip_ "performance tests not explicitly enabled" ;;
667 # Look for (and maybe set up) required tools and/or system features; skip
668 # the current test if they are not found.
669 for tool in : $required
671 # Check that each required tool is present.
674 cc|c++|fortran|fortran77)
675 require_compiler_ $tool;;
677 if test x"$am_test_prefer_config_shell" = x"yes"; then
680 require_xsi "/bin/sh"
684 # Do not use --version, older versions bzip2 still tries to compress
686 echo "$me: running bzip2 --help"
688 || skip_all_ "required program 'bzip2' not available"
692 # Don't export CFLAGS, as that could have been initialized to only
693 # work with the C compiler detected at configure time. If the user
694 # wants CFLAGS to also influence 'cl', he can still export CFLAGS
695 # in the environment "by hand" before calling the testsuite.
697 echo "$me: running $CC -?"
698 $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
701 # Exuberant Ctags will create a TAGS file even
702 # when asked for --help or --version. (Emacs's etags
703 # does not have such problem.) Use -o /dev/null
704 # to make sure we do not pollute the build directory.
705 echo "$me: running etags --version -o /dev/null"
706 etags --version -o /dev/null \
707 || skip_all_ "required program 'etags' not available"
710 for make_ in "$MAKE" gmake gnumake :; do
711 MAKE=$make_ am__using_gmake=''
712 test "$MAKE" = : && break
713 echo "$me: determine whether $MAKE is GNU make"
715 : For shells with busted 'set -e'.
717 test "$MAKE" = : && skip_all_ "this test requires GNU make"
722 GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
723 test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
724 : For shells with busted 'set -e'.
727 CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
728 test "$CC" = false && skip_all_ "GNU C compiler unavailable"
729 : For shells with busted 'set -e'.
732 CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
733 test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
734 : For shells with busted 'set -e'.
737 FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
738 test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
739 case " $required " in
741 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
745 F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
746 test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
747 case " $required " in
749 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
753 # Check that grep can parse nonprinting characters correctly.
754 # BSD 'grep' works from a pipe, but not a seekable file.
755 # GNU or BSD 'grep -a' works on files, but is not portable.
756 case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
758 *) skip_ "grep can't handle nonprinting characters correctly";;
762 # The Java compiler from JDK 1.5 (and presumably earlier versions)
763 # cannot handle the '-version' option by itself: it bails out
764 # telling that source files are missing. Adding also the '-help'
765 # option seems to solve the problem.
766 echo "$me: running javac -version -help"
767 javac -version -help || skip_all_ "Sun Java compiler not available"
770 # See the comments above about 'javac' for why we use also '-help'.
771 echo "$me: running java -version -help"
772 java -version -help || skip_all_ "Sun Java interpreter not found"
777 # Attempting to create an empty archive will actually not
778 # create the archive, but lib will output its version.
779 echo "$me: running $AR -out:defstest.lib"
780 $AR -out:defstest.lib \
781 || skip_all_ "Microsoft 'lib' utility not available"
784 echo "$me: running makedepend -f-"
786 || skip_all_ "required program 'makedepend' not available"
789 # Make sure we have makeinfo, and it understands '--html'.
790 echo "$me: running makeinfo --html --version"
791 makeinfo --html --version \
792 || skip_all_ "cannot find a makeinfo program that groks" \
793 "the '--html' option"
796 uname_s=$(uname -s || echo UNKNOWN)
797 echo "$me: system name: $uname_s"
800 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
805 # Skip this test case if the user is root.
806 # We try to append to a read-only file to detect this.
807 priv_check_temp=priv-check.$$
808 touch $priv_check_temp && chmod a-w $priv_check_temp \
809 || framework_failure_ "creating unwritable file $priv_check_temp"
810 # Not a useless use of subshell: lesser shells might bail
811 # out if a builtin fails.
813 (echo foo >> $priv_check_temp) || overwrite_status=$?
814 rm -f $priv_check_temp
815 if test $overwrite_status -eq 0; then
816 skip_all_ "cannot drop file write permissions"
818 unset priv_check_temp overwrite_status
820 # Extra quoting required to avoid maintainer-check spurious failures.
822 if test "$WANT_NO_THREADS" = "yes"; then
823 skip_all_ "Devel::Cover cannot cope with threads"
827 # Don't use "&&" here, to avoid a bug of 'set -e' present in
828 # some (even relatively recent) versions of the BSD shell.
829 # We add the dummy "else" branch for extra safety.
830 ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
833 # Python doesn't support --version, it has -V
834 echo "$me: running python -V"
835 python -V || skip_all_ "python interpreter not available"
838 # Skip this test case if read-only directories aren't supported
840 ro_dir_temp=ro_dir.$$
841 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
842 || framework_failure_ "creating unwritable directory $ro_dir_temp"
843 # Not a useless use of subshell: lesser shells might bail
844 # out if a builtin fails.
846 (: > $ro_dir_temp/probe) || create_status=$?
848 if test $create_status -eq 0; then
849 skip_all_ "cannot drop directory write permissions"
851 unset ro_dir_temp create_status
854 # DejaGnu's runtest program. We rely on being able to specify
855 # the program on the runtest command-line. This requires
856 # DejaGnu 1.4.3 or later.
857 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
858 runtest SOMEPROGRAM=someprogram --version \
859 || skip_all_ "DejaGnu is not available"
862 # No all versions of Tex support '--version', so we use
864 if test -z "$TEX"; then
865 skip_all_ "TeX is required, but it wasn't found by configure"
869 # Texi2dvi supports '-o' since Texinfo 4.1.
870 echo "$me: running texi2dvi -o /dev/null --version"
871 texi2dvi -o /dev/null --version \
872 || skip_all_ "required program 'texi2dvi' not available"
875 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
879 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
884 echo "$me: running flex --version"
885 flex --version || skip_all_ "required program 'flex' not available"
888 YACC='bison -y'; export YACC
889 echo "$me: running bison --version"
890 bison --version || skip_all_ "required program 'bison' not available"
893 # Generic case: the tool must support --version.
894 echo "$me: running $tool --version"
895 # It is not likely but possible that $tool is a special builtin,
896 # in which case the shell is allowed to exit after an error. So
897 # we need the subshell here. Also, some tools, like Sun cscope,
898 # can be interactive without redirection.
899 ($tool --version) </dev/null \
900 || skip_all_ "required program '$tool' not available"
905 # We might need extra macros, e.g., from Libtool or Gettext.
906 case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
907 case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
910 ## ---------------------------------------------------------------- ##
911 ## Create and set up of the temporary directory used by the test. ##
912 ## Set up of the exit trap for cleanup of said directory. ##
913 ## ---------------------------------------------------------------- ##
915 # This might be used in testcases checking distribution-related features.
916 # Test scripts are free to override this if they need to.
919 # Set up the exit trap.
922 cd "$am_top_builddir"
923 if test $am_using_tap = yes; then
924 if test "$planned_" = later && test $exit_status -eq 0; then
927 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
930 # This is to ensure that a test script does give a SKIP outcome just
931 # because a command in it happens to exit with status 77. This
932 # behaviour, while from time to time useful to developers, is not
933 # meant to be enabled by default, as it could cause spurious failures
934 # in the wild. Thus it will be enabled only when the variable
935 # "am_explicit_skips" is set to a "true" value.
936 case $am_explicit_skips in
938 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
939 echo "$me: implicit skip turned into failure"
943 test $exit_status -eq 0 || keep_testdirs=yes
945 am_keeping_testdirs || rm_rf_ $am_test_subdir
947 echo "$me: exit $exit_status"
948 # Spurious escaping to ensure we do not call our "exit" alias.
951 trap "fatal_ 'caught signal SIGHUP'" 1
952 trap "fatal_ 'caught signal SIGINT'" 2
953 trap "fatal_ 'caught signal SIGTERM'" 15
954 # Various shells seems to just ignore SIGQUIT under some circumstances,
955 # even if the signal is not blocked; however, if the signal it trapped,
956 # the trap gets correctly executed. So we also trap SIGQUIT.
957 # Here is a list of some shells that have been verified to exhibit the
958 # problematic behavior with SIGQUIT:
959 # - zsh 4.3.12 on Debian GNU/Linux
960 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
961 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
962 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
963 # OTOH, at least these shells that do *not* exhibit that behaviour:
964 # - modern version of the Almquist Shell (at least 0.5.5.1), on
965 # both Solaris and GNU/Linux
966 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
967 trap "fatal_ 'caught signal SIGQUIT'" 3
968 # Ignore further SIGPIPE in the trap code. This is required to avoid
969 # a very weird issue with some shells, at least when the execution of
970 # the automake testsuite is driven by the 'prove' utility: if prove
971 # (or the make process that has spawned it) gets interrupted with
972 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
973 # sometimes finally dumping core, other times hanging indefinitely.
974 # See also Test::Harness bug [rt.cpan.org #70855], archived at
975 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
976 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
978 # Create and populate the temporary directory, if and as required.
979 if test x"$am_create_testdir" = x"no"; then
982 # The subdirectory where the current test script will run and write its
983 # temporary/data files. This will be created shortly, and will be removed
984 # by the cleanup trap below if the test passes. If the test doesn't pass,
985 # this directory will be kept, to facilitate debugging.
986 am_test_subdir=${argv0#$am_rel_srcdir/}
987 case $am_test_subdir in
988 */*) am_test_subdir=${am_test_subdir%/*}/$me.dir;;
989 *) am_test_subdir=$me.dir;;
991 test ! -e $am_test_subdir || rm_rf_ $am_test_subdir \
992 || framework_failure_ "removing old test subdirectory"
993 $MKDIR_P $am_test_subdir \
994 || framework_failure_ "creating test subdirectory"
996 || framework_failure_ "cannot chdir into test subdirectory"
997 if test x"$am_create_testdir" != x"empty"; then
998 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
999 "$am_scriptdir"/depcomp . \
1000 || framework_failure_ "fetching common files from $am_scriptdir"
1001 # Build appropriate environment in test directory. E.g., create
1002 # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
1003 # but AC_CONFIG_FILES so that appending still produces a valid
1004 # configure.ac. But then, tests running config.status really need
1005 # to append AC_OUTPUT.
1007 echo "AC_INIT([$me], [1.0])"
1008 if test x"$am_serial_tests" = x"yes"; then
1009 echo "AM_INIT_AUTOMAKE"
1011 echo "AM_INIT_AUTOMAKE([parallel-tests])"
1013 echo "AC_CONFIG_FILES([Makefile])"
1014 } >configure.ac || framework_failure_ "creating configure.ac skeleton"
1019 ## ---------------- ##
1020 ## Ready to go... ##
1021 ## ---------------- ##