summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-06-04 15:06:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-06-04 15:06:46 -0700
commit2dc820fa7cbe09e944d7a9b407ecfa555237bfde (patch)
tree1a2ff2652fe0f3c38aebfa6d58ee7ef289e035fe /configure
parent848e5565a06fc206f159f6544fb8fba376381c30 (diff)
downloadtxr-2dc820fa7cbe09e944d7a9b407ecfa555237bfde.tar.gz
txr-2dc820fa7cbe09e944d7a9b407ecfa555237bfde.tar.bz2
txr-2dc820fa7cbe09e944d7a9b407ecfa555237bfde.zip
* 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.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure21
1 files changed, 21 insertions, 0 deletions
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