]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* configure.ac (ac_cv_sh_n_works): Don't try to test for it, since
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 19 Apr 2006 04:13:48 +0000 (04:13 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 19 Apr 2006 04:13:48 +0000 (04:13 +0000)
some shells (e.g., Solaris 8 /bin/sh) implement it verrrry slowly.
Instead, just list the shells that we know work.
* tests/local.at (AT_CHECK_SHELL_SYNTAX): Remove 2nd arg.  All uses
changed.  Be more cautious about the _cv_ variable.
* tests/tools.at (Syntax of the shell scripts): Check the
_cv_ variable once, at first, to avoid an internal autoconf error
when sh -n does not work.

ChangeLog
configure.ac
tests/local.at
tests/tools.at

index 9fc16862f9462b9c9ebe1735fa33391b2f349f38..bedbf1caa747d9e7de59c3ab74aaa307988da56f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.ac (ac_cv_sh_n_works): Don't try to test for it, since
+       some shells (e.g., Solaris 8 /bin/sh) implement it verrrry slowly.
+       Instead, just list the shells that we know work.
+       * tests/local.at (AT_CHECK_SHELL_SYNTAX): Remove 2nd arg.  All uses
+       changed.  Be more cautious about the _cv_ variable.
+       * tests/tools.at (Syntax of the shell scripts): Check the
+       _cv_ variable once, at first, to avoid an internal autoconf error
+       when sh -n does not work.
+
 2006-04-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * lib/Autom4te/FileUtils.pm: Sync from Automake.
index 3fc324c02e11a262306f5d33ca65a57746da11df..9a48225f4c8d49634278c765c7e8cfeb8376b821 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 # Copyright (C) 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
-# 2004 Free Software Foundation, Inc.
+# 2004, 2005, 2006 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -48,30 +48,25 @@ AM_INIT_AUTOMAKE([check-news 1.7.9 dist-bzip2 readme-alpha])
 #   $ time sh -nx endless.sh
 #   ^Csh -nx endless.sh  3,67s user 0,03s system 63% cpu 5,868 total
 #
+# Also, some implementations of /bin/sh (e.g., Solaris 8) are soooo slow
+# that they are unusable on large scripts like our testsuite.
+
 # So before using `/bin/sh -n' to check our scripts, we first check
-# that `/bin/sh -n' is not broken to death.
-
-# A script that never returns.  We don't care that it never returns,
-# broken /bin/sh loop equally with `false', but it makes it easier to
-# test the robustness in a good environment: just remove the `-n'.
-AC_CACHE_CHECK([whether sh -n works], ac_cv_sh_n_works,
-[cat > conftest.sh <<_CONFEOF_
-while :
-do
-  :
-done
-_CONFEOF_
-
-(/bin/sh -n conftest.sh) &
-sleep 2
-if kill $! >/dev/null 2>&1; then
-  # We managed to kill the child, which means that we probably
-  # can't trust `/bin/sh -n', hence the test failed.
-  ac_cv_sh_n_works=no
-else
-  ac_cv_sh_n_works=yes
+# that `/bin/sh -n' is known to not have these problems.
+
+AC_CACHE_CHECK([whether /bin/sh -n is known to work], ac_cv_sh_n_works,
+[if (
+    unset BASH_VERSION ZSH_VERSION
+    /bin/sh -c '
+      test -n "${BASH_VERSION+set}" || # Bash
+      test -n "${KSH_VERSION+set}" || # pdksh
+      test -n "${ZSH_VERSION+set}" || # zsh
+      test -n "${.sh.version}" # ksh93; put this last since its syntax is dodgy
+    '
+  ) 2>/dev/null
+then ac_cv_sh_n_works=yes
+else ac_cv_sh_n_works=no
 fi
-rm conftest.sh
 ])
 AC_SUBST(ac_cv_sh_n_works)
 
index 73c3647cbfe13933c638598ca4f5c503dbff9f81..1f3f4e968a1c2e527d98709ceb1fe274fcc25508 100644 (file)
@@ -45,13 +45,13 @@ AT_CHECK([$at_diff "$1" "$2"])
 ## Testing syntax.  ##
 ## ---------------- ##
 
-# AT_CHECK_SHELL_SYNTAX(PROGRAM, ALT-COMMAND)
-# -------------------------------------------
+# AT_CHECK_SHELL_SYNTAX(PROGRAM)
+# ------------------------------
 # If the shell handles `-n' well, use it to check the syntax of PROGRAM;
-# otherwise, run ALT-COMMAND.
+# otherwise, do nothing.
 m4_define([AT_CHECK_SHELL_SYNTAX],
-[AS_IF([test x"$ac_cv_sh_n_works" != xno],
-  [AT_CHECK([/bin/sh -n $1], 0)], [$2])])
+[AS_IF([test "$ac_cv_sh_n_works" = yes],
+  [AT_CHECK([/bin/sh -n $1])])])
 
 m4_define([AT_CHECK_PERL_SYNTAX],
 [AT_CHECK([autom4te_perllibdir=$abs_top_srcdir/lib $PERL -c $abs_top_builddir/bin/$1],
index 29eb658a4531a299d5c72b281555ffb786786112..8ee71022694d6f871292cfb7449ab1f5884c5d43 100644 (file)
@@ -46,17 +46,19 @@ AT_BANNER([Executables (autoheader, autoupdate...).])
 
 AT_SETUP([Syntax of the shell scripts])
 
+AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
+
 # Specify the absolute name of the tool, as some shells don't honor PATH when
 # running `sh PROG'.
 
-AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf], exit 77)
-AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf], exit 77)
-AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf])
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf])
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite])
 
 # These are not built, they are in the src tree.
-AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/install-sh], exit 77)
-AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/mkinstalldirs], exit 77)
-AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/missing], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/install-sh])
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/mkinstalldirs])
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/missing])
 
 AT_CLEANUP