From 2dc820fa7cbe09e944d7a9b407ecfa555237bfde Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 4 Jun 2014 15:06:46 -0700 Subject: * configure: Defend against legacy, non-POSIX /bin/sh implementations. We boostrap using #!/bin/sh, but try to detect a better shell and re-execute the script with that shell. Furthermore, we now set up the SHELL variable in config.make, so that make uses that shell for executing build recipes. --- ChangeLog | 8 ++++++++ configure | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7f475e77..f977e3bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-06-04 Kaz Kylheku + + * configure: Defend against legacy, non-POSIX /bin/sh implementations. + We boostrap using #!/bin/sh, but try to detect a better shell + and re-execute the script with that shell. Furthermore, we now + set up the SHELL variable in config.make, so that make uses that + shell for executing build recipes. + 2014-06-03 Kaz Kylheku * eval.c (eval_lisp1): Function removed. diff --git a/configure b/configure index 09581b9d..c1b80c34 100755 --- a/configure +++ b/configure @@ -31,6 +31,20 @@ # in the arguments, oops. # +if test x$txr_shell = x ; then + for shell in /usr/xpg4/bin/sh /bin/bash /usr/bin/bash ; do + if test -e $shell ; then + txr_shell=$shell + fi + done + if test x$txr_shell = x ; then + echo "No known POSIX shell found: falling back on /bin/sh, which may not work" + txr_shell=/bin/sh + fi + export txr_shell + exec $txr_shell $0 ${@+"$@"} +fi + set -u cmdline= @@ -410,6 +424,8 @@ printf "+%s+\n|%s|\n+%s+\n" $banner_box "$banner_text" $banner_box set -e +printf "We are using this shell: %s\n" $txr_shell + # # Check for GNU make # @@ -539,6 +555,11 @@ gen_config_make() # Changes to this file are lost when the above is re-run. # +# Shell used by make for running recipes; this +# is the as the shell we chose for the configure script, +# derived from the txr_shell variable. +SHELL := $txr_shell + # absolute path to source code directory top_srcdir := $top_srcdir -- cgit v1.2.3