Autoconf and m4
Autoconf and m4
Posted Apr 30, 2024 19:40 UTC (Tue) by epa (subscriber, #39769)Parent article: Security patterns and anti-patterns in embedded development
There are forces pulling in two opposing directions. On the one hand you want to build from pristine sources, straight out of git, and not from the traditional release tarball. That argues for doing the full autoconf setup each time, rather than relying on a configure script that the maintainer has generated. On the other hand, you want the build to have as few steps as possible and to be understandable in its entirety without having to know m4 and all that.
Just possibly the answer could be to take a step further away from the original sources. Nowadays there is less variety among Unix-like systems, or at least those that 99% of developers care about. Your contributors are not using a mixture of Irix, AIX and old SunOS versions. People using those obscure systems might still run the configure script, but for everyone else why not ship a pre-generated makefile that assumes sensible defaults for a GNU/Linux system? Simple customizations like install root could be set via environment variables. Then Linux distributions could pull the sources, delete the autoconf/ subdirectory just to make sure it’s not used, and build the rest in a predictable way.
Is that at all feasible? Or is it like Microsoft Office, where we agree that only 10% of Autoconf’s functionality is needed, but nobody can agree which 10%?
Posted Apr 30, 2024 20:20 UTC (Tue)
by Paf (subscriber, #91811)
[Link]
Shell-independent shell scripting, babe-y. It's a thing of beauty. Or at least ... a thing.
Posted Apr 30, 2024 20:23 UTC (Tue)
by Paf (subscriber, #91811)
[Link] (3 responses)
The problem - or so it seems to me - is that configure is the main way builds find and report missing dependencies. So I'm building X and the build requires totally-reasonable-but-not-universal library Y (or god forbid it requires obscure library Z). Those dependencies are generally expressed via the configure script. Seems like a non-starter.
Posted Apr 30, 2024 20:50 UTC (Tue)
by epa (subscriber, #39769)
[Link] (2 responses)
There will be exceptions, but generally I think you could define a default build that requires most of the dependencies without having to sniff whether they are available. If that’s not flexible enough for everyone, some will stay using the configure script.
Posted May 1, 2024 7:16 UTC (Wed)
by epa (subscriber, #39769)
[Link] (1 responses)
This configure script was invoked with --strict. The optional dependency 'libfoo' has not been specified.
Then build systems for Linux distributions would tend to use the --strict flag and nail down exactly what dependencies they want, leaving nothing to autodetection. That would have stopped the xz attack where the configure script stopped including the Landlock dependency and nobody noticed.
Posted May 3, 2024 1:22 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Posted May 1, 2024 15:35 UTC (Wed)
by mb (subscriber, #50428)
[Link] (2 responses)
Today there is pretty much *no* good reason for 95% of the autotools mess.
Almost all project don't care, if the build system works on obscure operating systems of the past. Yet, most code and checks in autotools are there because of some obsolete and obscure operating system that it used to support (or claims to still support). Your app won't work on these operating systems *anyway*, if you have never actually tested that.
Seriously, if you are still using autotools, you need to migrate away from that mess.
Having autotools in a project is a anti quality indicator.
Posted May 1, 2024 16:07 UTC (Wed)
by paulj (subscriber, #341)
[Link] (1 responses)
- If a project's build system is not generally a series of declarative statements; with no more than a modicum of small, confined and clear, ad-hoc logic (for whatever transforms or tests needed) then that is an anti-pattern.
Is quite possible to have a small, clean, fast, declarative build system in auto*, and it's possible to make mess in pretty much any build system tool. The anti-pattern is the mess. The anti-pattern is the willingness of the people who made the build system to engage in dirty hacks, rather than read the documentation of the tool and do it properly (whether, using the features of the tool properly; or extending it cleanly).
Basically: You can evaluate a project simply on the amount of ad-hoc logic they've stuffed into their build system, and the actual build system doesn't really matter that much to this.
Posted May 6, 2024 10:26 UTC (Mon)
by LtWorf (subscriber, #124958)
[Link]
Autoconf and m4
Autoconf and m4
Autoconf and m4
Autoconf and m4
You must pass either --with-libfoo or --without-libfoo.
Autodetection found that libfoo is present on this system.
Autoconf and m4
Autoconf and m4
>test, and Makefile generation is indeed obscure to all but the most advanced wizards.
>There are good reasons for that—it has a messy job to do.
Some projects have started to migrate away from it like 20 years ago.
Autoconf and m4
Autoconf and m4