[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison-1.29c 'configure' problems on Solaris 8.
From: |
Paul Eggert |
Subject: |
Re: bison-1.29c 'configure' problems on Solaris 8. |
Date: |
Wed, 3 Oct 2001 16:37:18 -0700 (PDT) |
> From: Akim Demaille <address@hidden>
> Date: 03 Oct 2001 10:41:49 +0200
>
> Here is my proposal:
I still see many problems with that. E.g., it doesn't propagate the
exit status, it doesn't handle multiple instances of LINENO on the
same line, it mishandles $LINENOUGH (:-), etc.
We might get something like that to work, but how about using a modern
shell instead, if available? Nowadays, almost everybody has a modern
shell somewhere -- the problem is that it's not called "/bin/sh". So
we can arrange for configure to reexecute itself with a
POSIX-compliant shell if it discovers that "/bin/sh" does not conform
to POSIX. This would help in several areas, not just $LINENO.
The only LINENO-related downside I see for this is that people that
have only ancient shells will see line number 0 in their output. This
is unfortunate, but it's not a fatal objection, as the line numbers
are not necessary for correct operation. And we can encourage those
folks to port bash at their earliest convenience.
So I propose something like the following patch instead. Sorry, I
can't easily test it, as the current autoconf CVS is broken on Solaris
for other reasons (as I described earlier).
2001-10-03 Paul Eggert <address@hidden>
* doc/autoconf.texi (Particular Programs): Add AC_PROG_SHELL.
(Limitations of Builtins): LINENO is 0 on older shells.
* lib/autoconf/programs.m4 (AC_PROG_SHELL): New macro.
* lib/m4sugar/m4sh.m4 (AC_SHELL_SANITIZE): Remove the attempt
to implement LINENO on older shells that lack it.
Instead, use AC_PROG_SHELL and invoke a POSIX-compliant shell
if available.
diff -pru autoconf-fix0/doc/autoconf.texi autoconf-fix1/doc/autoconf.texi
--- autoconf-fix0/doc/autoconf.texi Tue Oct 2 16:21:27 2001
+++ autoconf-fix1/doc/autoconf.texi Wed Oct 3 15:35:00 2001
@@ -3154,6 +3154,14 @@ Set output variable @code{RANLIB} to @sa
is found, and otherwise to @samp{:} (do nothing).
@end defmac
address@hidden AC_PROG_SHELL
address@hidden PROG_SHELL
address@hidden SHELL
+Set output variable @code{SHELL} to the name of a @sc{posix}-compliant
+shell, or to @samp{/bin/sh} (issuing a warning) if no such shell could
+be found.
address@hidden defmac
+
@defmac AC_PROG_YACC
@acindex PROG_YACC
@ovindex YACC
@@ -8196,7 +8204,10 @@ builtin @command{unset}, for more detail
@evindex LINENO
Most modern shells provide the current line number in @code{LINENO}.
Its value is the line number of the beginning of the current command
-(see below the output of the here document). The behavior wrt
+(see below the output of the here document).
+Autoconf attempts to execute @command{configure} with a modern shell,
+but if all else fails it arranges for @code{LINENO} to be @samp{0}.
+The behavior with
@command{eval} differs according to the shell, but, amusingly, not in
the case of sub shells:
diff -pru autoconf-fix0/lib/autoconf/programs.m4
autoconf-fix1/lib/autoconf/programs.m4
--- autoconf-fix0/lib/autoconf/programs.m4 Wed Sep 26 14:50:10 2001
+++ autoconf-fix1/lib/autoconf/programs.m4 Wed Oct 3 16:33:49 2001
@@ -459,6 +459,64 @@ AU_DEFUN([AC_RSH],
Remove this warning when you adjust the code.])])
+# AC_PROG_SHELL
+# -------------
+# Check for a working (i.e. POSIX-compatible) shell.
+# Written by Paul Eggert <address@hidden>,
+# from an idea suggested by Albert Chin-A-Young <address@hidden>.
+AC_DEFUN([AC_PROG_SHELL],
+ [AC_MSG_CHECKING([for a POSIX-compliant shell])
+ AC_CACHE_VAL(ac_cv_path_shell,
+ [ac_command='
+ # Test the noclobber option, using the portable POSIX.2 syntax.
+ set -C
+ rm -f conftest.c
+ >conftest.c || exit
+ >|conftest.c || exit
+ !>conftest.c || exit
+ '
+ ac_cv_path_shell=no
+
+ case $SHELL in
+ /*)
+ rm -f conftest.c
+ if ("$SHELL" -c "$ac_command") 2>/dev/null; then
+ ac_cv_path_shell=$SHELL
+ fi;;
+ esac
+
+ case $ac_cv_path_shell in
+ no)
+ ac_dummy=/bin:/usr/bin:/usr/bin/posix:/usr/xpg4/bin:$PATH
+ ac_save_IFS=$IFS; IFS=:
+ for ac_dir in $ac_dummy; do
+ for ac_base in sh bash ksh sh5; do
+ case $ac_dir in
+ /*)
+ rm -f conftest.c
+ if ("$ac_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
+ ac_cv_path_shell="$ac_dir/$ac_base"
+ break
+ fi;;
+ esac
+ done
+ case $ac_cv_path_shell in
+ no) ;;
+ *) break;;
+ esac
+ done
+ rm -f conftest.c
+ IFS=$ac_save_IFS;;
+ esac])
+ AC_MSG_RESULT($ac_cv_path_shell)
+ SHELL=$ac_cv_path_shell
+ if test "$SHELL" = no; then
+ SHELL=/bin/sh
+ AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])
+ fi
+ AC_SUBST(SHELL)])
+
+
# AC_PROG_YACC
# ------------
AC_DEFUN([AC_PROG_YACC],
diff -pru autoconf-fix0/lib/m4sugar/m4sh.m4 autoconf-fix1/lib/m4sugar/m4sh.m4
--- autoconf-fix0/lib/m4sugar/m4sh.m4 Tue Oct 2 16:10:43 2001
+++ autoconf-fix1/lib/m4sugar/m4sh.m4 Wed Oct 3 15:52:05 2001
@@ -101,7 +101,16 @@ m4_defun([AS_SHELL_SANITIZE],
## M4sh Initialization. ##
## --------------------- ##
-# Be Bourne compatible
+# Be POSIX compatible
+AC_PROG_SHELL
+case $SHELL in
+/bin/sh) ;;
+/*)
+ if test -r "$[0]"; then
+ AC_MSG_WARN([using $SHELL to execute $[0], as /bin/sh does not conform to
POSIX])
+ exec "$SHELL" "$[0]" ${1+"$@"}
+ fi;;
+esac
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
@@ -112,52 +121,10 @@ fi
# Name of the executable.
as_me=`AS_BASENAME($[0])`
-# If LINENO is not supported by the shell, produce a version of this
-# script where LINENO is hard coded. Rewrite if not up to date only.
-# Comparing LINENO against _oline_ is not a good solution, since in
-# the case of embedded executables (such as config.status within
-# configure) you'd compare LINENO wrt config.status vs. _oline_ vs
-# configure. Hence a useless rewrite (not to mention the risk of
-# ``infinite'' rewrites. Merely check that LINENO is incremented
-# between two lines, which is a property guaranteed for _oline_, hence
-# it protects us from repetitive rewrites. Be sure to have a test
-# that does detect non LINENO support...
+# If LINENO is not supported by the shell, set it to 0.
as_lineno_1=$LINENO
as_lineno_2=$LINENO
-as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-if test "x$as_lineno_1" = "x$as_lineno_2" ||
- test "x$as_lineno_3" != "x$as_lineno_2";
- then
- # Find who we are.
- case $[0] in
- *[[\\/]]* | ?:[[\\/]]* ) as_myself=$[0] ;;
- *) _AS_PATH_WALK([],
- [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
- ;;
- esac
- if test ! -f $as_myself; then
- AS_ERROR([cannot find myself; rerun with an absolute path])
- fi
- if test ! -f $as_me.lineno ||
- test x`ls -1dt $as_me.lineno $as_myself 2>/dev/null | sed 1q` \
- != x$as_me.lineno; then
- # Be sure to write the pattern so that it doesn't replace itself:
- # it must not match itself.
- awk '{
- if ($[0] ~ /[[$]]LINENO/)
- while (sub (/[[$]]LINENO/, NR))
- continue
- print
- }' <$as_myself >$as_me.lineno
- chmod +x $as_me.lineno
- fi
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- exit 0
-fi
+test "x$as_lineno_1" = "x$as_lineno_2" && LINENO=0
_AS_CR_PREPARE
_AS_ECHO_N_PREPARE
- Re: bison-1.29c 'configure' problems on Solaris 8.,
Paul Eggert <=
- Re: bison-1.29c 'configure' problems on Solaris 8., Russ Allbery, 2001/10/03
- Re: bison-1.29c 'configure' problems on Solaris 8., Paul Eggert, 2001/10/03
- Re: bison-1.29c 'configure' problems on Solaris 8., Russ Allbery, 2001/10/03
- Re: bison-1.29c 'configure' problems on Solaris 8., Paul Eggert, 2001/10/04
- Re: bison-1.29c 'configure' problems on Solaris 8., Akim Demaille, 2001/10/04
- Re: bison-1.29c 'configure' problems on Solaris 8., Akim Demaille, 2001/10/04
- Re: bison-1.29c 'configure' problems on Solaris 8., Paul Eggert, 2001/10/04
- Re: Libtool and echo (Was: bison-1.29c 'configure' problems on Solaris 8), Akim Demaille, 2001/10/05
- Re: Libtool and echo (Was: bison-1.29c 'configure' problems on Solaris 8), Gary V. Vaughan, 2001/10/05
- Re: Libtool and echo (Was: bison-1.29c 'configure' problems on Solaris 8), Paul Eggert, 2001/10/05