]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
tools: automake: do not error on missing conditional 24362/head
authorMichael Pratt <mcpratt@pm.me>
Wed, 22 Jul 2026 10:23:58 +0000 (06:23 -0400)
committerRobert Marko <robimarko@gmail.com>
Thu, 30 Jul 2026 17:34:40 +0000 (19:34 +0200)
Now that cond.m4 is not being overwritten and is actively used,
make it less aggressive on encountering an undefined conditional
not set by a macro which is itself conditionally called,
where the condition is set to intentionally not trigger the macro.

This prevents the need to further patch a configure.ac file
to edit the improper usage of or remove a disabled macro
which triggers the error "conditional ___ is not defined..."
in the cases where autoreconf is still necessary for another reason,
or, if this is the only build issue,
autoreconf can now be used to avoid this.

Instead of erroring, align the behavior of AM_CONDITIONAL
closer to the gnulib variant gl_CONDITIONAL
which ignores and disables the conditional in this case.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/24362
Signed-off-by: Robert Marko <robimarko@gmail.com>
tools/automake/patches/010-m4-cond-no-error.patch [new file with mode: 0644]

diff --git a/tools/automake/patches/010-m4-cond-no-error.patch b/tools/automake/patches/010-m4-cond-no-error.patch
new file mode 100644 (file)
index 0000000..7876911
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/m4/cond.m4
++++ b/m4/cond.m4
+@@ -27,6 +27,8 @@ else
+ fi
+ AC_CONFIG_COMMANDS_PRE(
+ [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+-  AC_MSG_ERROR([[conditional "$1" was never defined.
++  [$1]_TRUE='#'
++  [$1]_FALSE='#'
++  AC_MSG_WARN([[conditional "$1" was never defined.
+ Usually this means the macro was only invoked conditionally.]])
+ fi])])