From: Nick Bowler Date: Wed, 6 Dec 2023 01:46:26 +0000 (-0500) Subject: DX_AUTOMAKE_COMPAT: Fix install-sh with newer Automake. X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/commitdiff_plain/b740b9bb37b4a5374772ff5049a46e10be7e020f DX_AUTOMAKE_COMPAT: Fix install-sh with newer Automake. Current versions of Automake's install-sh depends on substitutions like ${var:-foo}, which are not supported by ULTRIX 4.5 /bin/sh. Now, ksh does support these and configure does find and use this shell on ULTRIX, but install-sh starts with #!/bin/sh so when it is executed directly, it is run with /bin/sh instead of the shell we want. We can work around the problem by patching up the MKDIR_P and INSTALL assignments at configure time to include the known-good shell, which seems to work well. --- diff --git a/m4/am-compat.m4 b/m4/am-compat.m4 index ec14819..f8592ab 100644 --- a/m4/am-compat.m4 +++ b/m4/am-compat.m4 @@ -1,4 +1,4 @@ -dnl Copyright © 2012, 2021 Nick Bowler +dnl Copyright © 2012, 2021, 2023 Nick Bowler dnl dnl Definitions to help maintain compatibility with multiple Automake versions. dnl @@ -11,6 +11,12 @@ dnl dnl Provides definitions to help maintain compatibility with older versions of dnl Automake. Currently, this means: dnl +dnl - Automake 1.15 includes an install-sh that depends on a "better" shell +dnl environment. However, even if such a shell is available and found by +dnl configure, the script includes #!/bin/sh so it won't work if /bin/sh +dnl is deficient. This problem is worked around by patching MKDIR_P +dnl and INSTALL to include $SHELL. +dnl dnl - AM_V and AM_DEFAULT_V (new in Automake 1.12) are defined and AC_SUBSTed dnl if Automake did not already, in a manner compatible with silent-rules dnl support from previous versions. @@ -33,27 +39,30 @@ dnl properly if your string can actually be aligned in all versions of dnl Automake being targeted (this means you are limited to 6 characters dnl in Automake 1.11). -AC_DEFUN_ONCE([DX_AUTOMAKE_COMPAT], [dnl -AC_REQUIRE([DX_INIT]) +AC_DEFUN_ONCE([DX_AUTOMAKE_COMPAT], +[AC_REQUIRE([DX_INIT])dnl +AC_CONFIG_COMMANDS_PRE([# Patch install-sh references to include $SHELL +AS_CASE([$MKDIR_P], ["$ac_install_sh"*], [MKDIR_P="$SHELL $MKDIR_P"]) +AS_CASE([$INSTALL], ["$ac_install_sh"*], [INSTALL="$SHELL $INSTALL"]) -AC_CONFIG_COMMANDS_PRE([dnl - AS_VAR_SET_IF([AM_V], [], [AC_SUBST([AM_V], ['$(V)'])]) - AS_VAR_SET_IF([AM_DEFAULT_V], [], - [AC_SUBST([AM_DEFAULT_V], ['$(AM_DEFAULT_VERBOSITY)'])])]) +# Substitute AM_V/AM_DEFAULT_V for compatibility with conftest.sed <<'EOF' /^am__v_GEN_0 *=/{ - s/@<:@^"@:>@*" \(GEN *\).*/\1/ - s/ /x/g - p + s/@<:@^"@:>@*" \(GEN *\).*/\1/ + s/ /x/g + p } EOF if sed -nf conftest.sed "$srcdir/Makefile.in" >conftest.out 2>/dev/null; then - read dx_genline