[rebase PATCH] Introduce --with-posix-shell configure flag.

Michael Haubenwallner michael.haubenwallner@ssi-schaefer.com
Tue Apr 9 09:23:00 GMT 2019


Some distros prefer a POSIX shell other than /bin/ash and /bin/dash.
---
 Makefile.in   |  4 ++--
 configure.ac  | 22 +++++++++++++++++-----
 peflagsall.in |  2 +-
 rebaseall.in  |  2 +-
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e984070..34c4684 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,7 +53,7 @@ LN_S = @LN_S@
 SED = @SED@
 EGREP = @EGREP@
 FGREP = @FGREP@
-ASH = @ASH@
+POSIXSHELL = @POSIXSHELL@
 
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(srcdir)/imagehelper
 DEFS = @DEFS@ -DVERSION='"$(PACKAGE_VERSION)"' -DLIB_VERSION='"$(LIB_VERSION)"' -DSYSCONFDIR='"$(sysconfdir)"'
@@ -128,7 +128,7 @@ edit = sed \
 	-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
 	-e 's|@prefix[@]|$(prefix)|g' \
 	-e 's|@exec_prefix[@]|$(exec_prefix)|g' \
-	-e 's|@ASH[@]|$(ASH)|g' \
+	-e 's|@POSIXSHELL[@]|$(POSIXSHELL)|g' \
 	-e 's|@DEFAULT_OFFSET_VALUE[@]|$(DEFAULT_OFFSET_VALUE)|g'
 
 rebaseall peflagsall: Makefile
diff --git a/configure.ac b/configure.ac
index 1dc9bf4..2b42e47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,11 +8,23 @@ AC_CONFIG_SRCDIR([peflags.c])
 AC_PREFIX_DEFAULT([/usr])
 AC_CANONICAL_HOST
 
-AC_ARG_WITH([dash], AS_HELP_STRING([use dash instead of ash]),
-            [], [with_dash=no])
-ASH=ash
-AS_IF([test "x$with_dash" != xno], [ASH=dash])
-AC_SUBST([ASH])
+AC_MSG_CHECKING([for POSIX shell to use in scripts])
+AC_ARG_WITH([dash],
+			AS_HELP_STRING([--with-dash],
+						   [use /bin/dash instead of /bin/ash (deprecated in favor of --with-posix-shell=/bin/dash)]),
+            [with_posix_shell=/bin/dash])
+AC_ARG_WITH([posix-shell],
+			AS_HELP_STRING([--with-posix-shell=/bin/dash],
+						   [POSIX shell to use for scripts, default=/bin/ash]),
+			[AS_CASE([$with_posix_shell],
+					 [yes|no|''],
+					 [AC_MSG_ERROR([Need shell path for --with-posix-shell, got '$with_posix_shell'.])],
+					 [/*],
+					 [POSIXSHELL=$with_posix_shell],
+					 [AC_MSG_ERROR([Need absolute path for --with-posix-shell, got '$with_posix_shell'.])])],
+			[POSIXSHELL=/bin/ash])
+AC_SUBST([POSIXSHELL])
+AC_MSG_RESULT([$POSIXSHELL])
 
 AC_PROG_INSTALL
 AC_PROG_MKDIR_P
diff --git a/peflagsall.in b/peflagsall.in
index d838201..6839db4 100644
--- a/peflagsall.in
+++ b/peflagsall.in
@@ -1,4 +1,4 @@
-#!/bin/@ASH@
+#!@POSIXSHELL@
 
 #
 # Copyright (c) 2009,2011 Charles Wilson
diff --git a/rebaseall.in b/rebaseall.in
index 076cc32..af4fe3f 100644
--- a/rebaseall.in
+++ b/rebaseall.in
@@ -1,4 +1,4 @@
-#!/bin/@ASH@
+#!@POSIXSHELL@
 
 #
 # Copyright (c) 2003, 2005, 2006, 2008, 2011, 2012 Jason Tishler
-- 
2.19.2



More information about the Cygwin-patches mailing list