]> git.draconx.ca Git - dxcommon.git/commitdiff
DX_AUTOMAKE_COMPAT: Fix compile with newer Automake.
authorNick Bowler <nbowler@draconx.ca>
Thu, 7 Dec 2023 01:56:24 +0000 (20:56 -0500)
committerNick Bowler <nbowler@draconx.ca>
Thu, 7 Dec 2023 01:56:24 +0000 (20:56 -0500)
Current versions of Automake's compile script depend on shell functions
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 compile starts with #!/bin/sh so when it is executed
directly, it is run with /bin/sh instead of the shell we want.

This is a bit tricky to work around since Automake updates $CC (if
needed) to refer to the compile script, which is used throughout
the configure run.  So we can't just patch it up whenever, it has
to be done early on.  AC_BEFORE can be used to at least warn if the
patches are ineffective.

configure.ac
m4/am-compat.m4
m4/base.m4
m4/gl-patches.m4

index cf152d889e9029147c6604c3a850dd13463e2cfd..efac42f1defaa0d06ba7c922ec0bbb68ad0eb8b8 100644 (file)
@@ -8,6 +8,12 @@ AC_PREREQ([2.68])
 AC_INIT([dxcommon], [0], [nbowler@draconx.ca])
 AC_CONFIG_SRCDIR([m4/base.m4])
 
+DX_INIT([.])
+
+AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects])
+AM_SILENT_RULES([yes])
+DX_AUTOMAKE_COMPAT
+
 # To ensure automake --add-missing copies config.guess/config.sub
 AC_CANONICAL_HOST
 
@@ -15,11 +21,6 @@ AC_PROG_CC
 AC_PROG_RANLIB
 AC_PROG_AWK
 
-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects])
-AM_SILENT_RULES([yes])
-
-DX_INIT([.])
-
 AC_USE_SYSTEM_EXTENSIONS
 AC_C_INLINE
 
index f8592ab74b5db82a22be26e6f3b7b4d9a60f0092..852fe87562189b9fdb835d81b2c8728a5748d8f3 100644 (file)
@@ -41,6 +41,7 @@ dnl    in Automake 1.11).
 
 AC_DEFUN_ONCE([DX_AUTOMAKE_COMPAT],
 [AC_REQUIRE([DX_INIT])dnl
+AC_REQUIRE([_DX_AUTOMAKE_COMPAT_PATCH_CC])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"])
@@ -82,6 +83,10 @@ AS_CASE([$dx_cv_am_depfiles],
 AC_SUBST([dx_depfiles_target], [am--depfiles])
 AC_SUBST([dx_include_marker])
 AM_SUBST_NOTMAKE([dx_depfiles_target])
-AM_SUBST_NOTMAKE([dx_include_marker])
+AM_SUBST_NOTMAKE([dx_include_marker])])
 
-])
+AC_DEFUN_ONCE([_DX_AUTOMAKE_COMPAT_PATCH_CC],
+[AC_BEFORE([$0], [_AM_PROG_CC_C_O])dnl
+DX_PATCH_MACRO([_AM_PROG_CC_C_O],
+  ["[$]am_aux_dir/compile],
+  ["$SHELL $am_aux_dir/compile])])
index fd9b8115533cce431510abd3d27d23122edb29b9..c14ba68d21fcdf15ffb74e930ee8e0d51680e087 100644 (file)
@@ -1,6 +1,6 @@
-dnl Copyright © 2012, 2014, 2021 Nick Bowler
+dnl Copyright © 2012, 2014, 2021, 2023 Nick Bowler
 dnl
-dnl Base directory handling for dxcommon.
+dnl Basic macros for dxcommon.
 dnl
 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
 dnl This is free software: you are free to do what the fuck you want to.
@@ -76,3 +76,10 @@ dnl complex shell command suitable for use in shell conditionals.
 AC_DEFUN([DX_RUN_LOG], [{ (set -x; $1;) >&AS_MESSAGE_LOG_FD 2>&1
   dx_status=$?; AS_ECHO(["\$? = $dx_status"]) >&AS_MESSAGE_LOG_FD 2>&1
   test $dx_status = 0; }])
+
+# DX_PATCH_MACRO([macro-name], [regexp], [replacement])
+#
+# Patches the definition of macro-name by replacing substrings that match
+# the given regexp (a la m4_bpatsubst).
+AC_DEFUN([DX_PATCH_MACRO], [m4_ifdef([$1],
+  [m4_define([$1], m4_bpatsubst(m4_dquote(m4_defn([$1])), [$2], [$3]))])])
index 887db7a18f7ebf87fc62a5aa8bc6890bee79d230..f16dd1b27e0afb9d97057a39a1e4ab95401cf29c 100644 (file)
@@ -6,13 +6,6 @@
 # This is free software: you are free to do what the fuck you want to.
 # There is NO WARRANTY, to the extent permitted by law.
 
-# DX_PATCH_MACRO([macro-name], [regexp], [replacement])
-#
-# Patches the definition of macro-name by replacing substrings that match
-# the given regexp (a la m4_bpatsubst).
-AC_DEFUN([DX_PATCH_MACRO], [m4_ifdef([$1],
-  [m4_define([$1], m4_bpatsubst(m4_dquote(m4_defn([$1])), [$2], [$3]))])])
-
 # DX_PATCH_GNULIB
 #
 # Apply all the patches described below.  Should be expanded before AC_INIT.