tools/automake: hardcode portable location for Perl
authorMichael Pratt <mcpratt@pm.me>
Sun, 11 May 2025 16:23:17 +0000 (12:23 -0400)
committerRobert Marko <robimarko@gmail.com>
Sat, 26 Jul 2025 12:38:07 +0000 (14:38 +0200)
The latest automake version 1.17 includes a restriction against whitespace
for the configure variable $PERL, which is set to "/usr/bin/env perl"
for portability reasons with products like the SDK.

Instead of waiting until the next version of automake is released
for this error to be converted to a warning,
set the shebang of automake and aclocal manually with a patch.

In past git history, these lines have been patched before,
but only to remove the "-w" flag in favor of setting global warnings
in the script itself so that env does not strip the option.

The other purposes of Perl during building can use
the static staging directory path without any limitations.

Also, the configure variable "am_cv_prog_PERL_ithreads"
for the detection of Perl threads support
has been removed since 2013 in favor of dynamic runtime detection.
Remove our manual setting of this variable value as it has no effect.

Ref: 1ef07eee4 ("automake: forcibly disable perl ithreads support")
Ref: 182626687 ("ithreads: use runtime (not configure time) detection of perl threads") # automake.git
Ref: f6c581cc3 ("automake: portability fixes")
Ref: 87f3365d9 ("Revert "tools/automake: bump to 1.17"")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
tools/automake/Makefile
tools/automake/patches/000-relocatable.patch

index 7f129c1d838708ad8303e337bac5571589499e80..b698dd5a712d87b20ad6e1ceb90dea47e0a5e855 100644 (file)
@@ -21,8 +21,7 @@ HOST_CONFIGURE_ARGS += \
        --disable-silent-rules
 
 HOST_CONFIGURE_VARS += \
-       PERL="/usr/bin/env perl" \
-       am_cv_prog_PERL_ithreads=no
+       # temporary patch alternative for PERL="/usr/bin/env perl"
 
 define Host/Configure
        (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR_HOST="" ./bootstrap)
index 0b61eaeb45a85101d76d68b58797e939648516ff..7d62435cb2885342e6e85ce3c131c181c9c8b6b4 100644 (file)
  # We need at least this version for CLONE support.
 --- a/bin/aclocal.in
 +++ b/bin/aclocal.in
+@@ -1,4 +1,4 @@
+-#!@PERL@
++#!/usr/bin/env perl
+ # aclocal - create aclocal.m4 by scanning configure.ac      -*- perl -*-
+ # @configure_input@
+ # Copyright (C) 1996-2021 Free Software Foundation, Inc.
 @@ -23,9 +23,11 @@ use 5.006;
  use strict;
  use warnings FATAL => 'all';
  my $install = 0;
 --- a/bin/automake.in
 +++ b/bin/automake.in
+@@ -1,4 +1,4 @@
+-#!@PERL@
++#!/usr/bin/env perl
+ # automake - create Makefile.in from Makefile.am            -*- perl -*-
+ # @configure_input@
+ # Copyright (C) 1994-2021 Free Software Foundation, Inc.
 @@ -26,9 +26,11 @@ use 5.006;
  use strict;
  use warnings FATAL => 'all';