Subject: Re: bug#74387: Cannot use Make conditionals

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 24 Nov 2024 22:40:52 +0900

Hi Zack,

"Zack Weinberg" <[email-masked]> writes:

> Automake conditionals were originally created because make
> conditionals aren't portable. In principle, if you are willing to
> require GNU make (or any other specific Make that has conditionals)
> you shouldn't *need* Automake conditionals.
>
> Of course, things may not be that simple anymore. Can you please give some examples of the things you are trying to do, that seem to require use of both kinds of conditionals?

I was trying to come up with an environment variable to control whether
expensive tests of the test suite should be run or not,
e.g. depending on WITH_SLOW_TESTS=1 or WITH_SLOW_TESTS=0.

I didn't want to use an Autoclave conditional, as these are baked in the
build system following 'configure', i.e., not dynamic enough (I want the
ability to switch this on or off anytime I run the tests -- not just at
configure time).

This is where I thought of employing Make's native conditionals, which
would have enabled checking the value of the WITH_SLOW_TESTS environment
variable every time Make is run.

In the end, I've worked around the issue by moving the skip check/logic
in each test that I wanted to skip.  That's a bit ugly as when running
the test individually you need to remember to set WITH_SLOW_TESTS=1 to
really have it run, but it's the best I've found thus far.

For the full context of what I was working on, see the patches submit
for consideration to GNU Guix [0].

[0]  https://issues.guix.gnu.org/74394

I guess this can be closed, though I'd still be interested if there are
better ways to accomplish skipping some tests than what I've ended up
using, as that seems like some shortcoming that build system tinkerers
having gotten used to the likes of Meson, where you can script pretty
much anything, would not easily accept.

-- 
Thanks,
Maxim