1From fb8bf1c1b1d0bf8e9bc637c0e67219fab1a9eb03 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 14 Aug 2024 15:24:57 -0700
4Subject: [PATCH] libopts.m4: accept POSIX_SHELL from the environment during
5 the configure step
6
7This lets us set it to the canonical path /bin/bash, even on systems
8where both /bin/bash and /usr/bin/bash are available, and therefore
9which(1) might return /usr/bin/bash (depending on PATH order).
10
11Both copies of libopts.m4 are marked as generated files, but the files
12from which they were generated do not seem to be present in the sharutils
13package. This change is equivalent to part of a 2016 autogen commit
14<https://git.savannah.gnu.org/cgit/autogen.git/commit/?id=db064b9a>.
15
16Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/autogen.git/commit/?id=db064b9a]
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 libopts/m4/libopts.m4 | 1 +
21 m4/libopts.m4         | 1 +
22 2 files changed, 2 insertions(+)
23
24diff --git a/libopts/m4/libopts.m4 b/libopts/m4/libopts.m4
25index 1a896d9..3b88426 100644
26--- a/libopts/m4/libopts.m4
27+++ b/libopts/m4/libopts.m4
28@@ -114,6 +114,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
29   AC_PROG_SED
30   [while :
31   do
32+      test -x "$POSIX_SHELL" && break
33       POSIX_SHELL=`which bash`
34       test -x "$POSIX_SHELL" && break
35       POSIX_SHELL=`which dash`
36diff --git a/m4/libopts.m4 b/m4/libopts.m4
37index c7ba4f3..a1127e1 100644
38--- a/m4/libopts.m4
39+++ b/m4/libopts.m4
40@@ -114,6 +114,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
41   AC_PROG_SED
42   [while :
43   do
44+      test -x "$POSIX_SHELL" && break
45       POSIX_SHELL=`which bash`
46       test -x "$POSIX_SHELL" && break
47       POSIX_SHELL=`which dash`
48