On 18/11/2025 22:19, Collin Funk wrote:
Pádraig Brady <[email protected]> writes:

* Makefile.am: Use ln rather than $(LN_S) for hardlinks.
* configure.ac: Accept --enable-single-binary=hardlinks.
* man/local.mk: In hardlink mode, explicitly add the
hardlink creation rule to mandeps.  Given the automake
generated dependency chain, this ensures that the hardlinks
are created _after_ the multicall binary, with `make all`
or `make check` etc.
* src/local.mk: Define the new src/coreutils_hardlinks rule,
and only depend on src/coreutils_{symlinks,shebangs} if
in those modes, so that hardlinks are created _after_
the multicall binary, and other link types before.
* NEWS: Mention the new feature.
Addresses https://github.com/coreutils/coreutils/issues/129
---
  Makefile.am  |  3 +++
  NEWS         |  5 +++++
  configure.ac | 14 ++++++++------
  man/local.mk |  4 ++++
  src/local.mk | 16 ++++++++++++++--
  5 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 71f093683..83d8b3c11 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -193,6 +193,9 @@ install-exec-hook:
              $(bindir)/$$ctrans$(EXEEXT) $$p                           \
              >$(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;    \
            chmod a+x,a-w $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;\
+         elif test "x$(single_binary_install_type)" = xhardlinks; then \
+           ln $(DESTDIR)$(bindir)/$$ctrans$(EXEEXT)                    \
+             $(DESTDIR)$(bindir)/$$ptrans$(EXEEXT) || exit $$?;        \
          else                                                          \

Isn't this way of comparing, e.g.

    if "x$var" = x; then
      :
    fi

to support ancient shells? I think we assume a reasonable shell for
./configure.

Yes, if you `grep ^SHELL Makefile` on a modern system you get /bin/sh
but doing the same on Solaris 10 for example shows that SHELL
is explicitly set to /bin/bash.

The patch is fine regardless, just something tiny I noticed.

Looking at the Solaris 10 shell:

  $ /bin/sh
  $ v='('
  $ test "$v" = "$v"
  test: argument expected

Note this is discussed at:
https://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtins.html

So the prepending with x trick is needed for that edge case at least.

But we don't need that because we know the possible values of the variable,
and we know we have a good shell.
So I've removed the "x" hack from this script.

cheers,
Padraig

Reply via email to