build: Prefer /bin/bash if available. Thanks, Vagrant!
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 9 Nov 2019 09:59:01 +0000 (10:59 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 9 Nov 2019 09:59:01 +0000 (10:59 +0100)
Ensure the configure script uses /bin/bash, otherwise on systems with
/bin -> /usr/bin it results in /bin/bash being embedded in various
scripts.

Inspired by

    https://salsa.debian.org/debian/mes/blob/debian/master/debian/patches/force-use-of-bin-bash

* configure: Prefer /bin/bash, /bin/sh if available.  Helps
reproducibility on Debian.

configure

index e0950c1bbc07430ce76c96fc206cc4f472243da4..d12170c0b5906f37e51dcc7bfe3bef2a93eaa4c8 100755 (executable)
--- a/configure
+++ b/configure
@@ -509,7 +509,15 @@ Some influential environment variables:
                              ((equal? '( "gnu") kernel-list) "gnu")
                              (else "unknown")))
            (compiler (if gcc? "gcc" "mescc"))
-           (mes-system (string-join (list mes-cpu mes-kernel "mes") "-")))
+           (mes-system (string-join (list mes-cpu mes-kernel "mes") "-"))
+           (bash (or (and (file-exists? "/bin/bash") "/bin/bash")
+                     (file-name "bash" deps)
+                     ""))
+           (shell (or (and (file-exists? "/bin/bash") "/bin/bash")
+                      (file-name "bash" deps)
+                      (and (file-exists? "/bin/sh") "/bin/sh")
+                      (file-name "sh" deps)
+                      "sh")))
 
       (define* (substitute file-name pairs
                            #:key (target (if (string-suffix? ".in" file-name)
@@ -586,7 +594,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
                      ("@V@" . ,(if disable-silent-rules? "1" "0"))
 
                      ("@AR@" . ,(or (file-name "ar" deps) ""))
-                     ("@BASH@" . ,(or (file-name "bash" deps) ""))
+                     ("@BASH@" . ,bash)
                      ("@CC@" . ,(or (file-name "cc" deps) ""))
                      ("@DIFF@" . ,(or (file-name "diff" deps) (string-append abs-top-builddir "/pre-inst-env diff.scm")))
                      ("@DOT@" . ,(or (file-name "dot" deps) ""))
@@ -601,9 +609,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
                      ("@PERL@" . ,(or (file-name "perl" deps) ""))
                      ("#SCHEME=\"@SCHEME@\"" . ,(if with-cheating? (string-append "\nSCHEME=\"" guile "\"") ""))
                      ("@SCHEME@" . ,(if with-cheating? guile ""))
-                     ("@SHELL@" . ,(or (file-name "bash" deps)
-                                       (file-name "sh" deps)
-                                       "sh"))
+                     ("@SHELL@" . ,shell)
 
                      ("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
                      ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))