143 points by brooke2k 15 hours ago | 116 comments
iforgotpassword 7 hours ago
IshKebab 5 hours ago
A fairer criticism would be that they have no sense to use a more sane build system. CMake is a mess but even that is faaaaar saner than autotools, and probably more popular at this point.
xiaoyu2006 2 hours ago
This is peak engineering.
krior 1 hour ago
knorker 16 minutes ago
I'd like to think of myself as reasonable, so I'll just say that reasonable people may disagree with your assertion that cmake is in any way at all better than autotools.
rollcat 4 hours ago
Simple projects: just use plain C. This is dwm, the window manager that spawned a thousand forks. No ./configure in sight: <https://git.suckless.org/dwm/files.html>
If you run into platform-specific stuff, just write a ./configure in simple and plain shell: <https://git.suckless.org/utmp/file/configure.html>. Even if you keep adding more stuff, it shouldn't take more than 100ms.
If you're doing something really complex (like say, writing a compiler), take the approach from Plan 9 / Go. Make a conditionally included header file that takes care of platform differences for you. Check the $GOARCH/u.h files here:
<https://go.googlesource.com/go/+/refs/heads/release-branch.g...>
(There are also some simple OS-specific checks: <https://go.googlesource.com/go/+/refs/heads/release-branch.g...>)
This is the reference Go compiler; it can target any platform, from any host (modulo CGO); later versions are also self-hosting and reproducible.
epcoa 5 hours ago
Meh, I used to keep printed copies of autotools manuals. I sympathize with all of these people and acknowledge they are likely the sane ones.
rbanffy 6 hours ago
codys 10 hours ago
Instead of splitting the "configure" and "make" steps though, I chose to instead fold much of the "configure" step into the "make".
To clarify, this article describes a system where `./configure` runs a bunch of compilations in parallel, then `make` does stuff depending on those compilations.
If one is willing to restrict what the configure can detect/do to writing to header files (rather than affecting variables examined/used in a Makefile), then instead one can have `./configure` generate a `Makefile` (or in my case, a ninja file), and then have the "run the compiler to see what defines to set" and "run compiler to build the executable" can be run in a single `make` or `ninja` invocation.
The simple way here results in _almost_ the same behavior: all the "configure"-like stuff running and then all the "build" stuff running. But if one is a bit more careful/clever and doesn't depend on the entire "config.h" for every "<real source>.c" compilation, then one can start to interleave the work perceived as "configuration" with that seen as "build". (I did not get that fancy)
tavianator 9 hours ago
Just from a quick peek at that repo, nowadays you can write
#if __has_attribute(cold)
and avoid the configure test entirely. Probably wasn't a thing 10 years ago though :)
o11c 9 hours ago
aaronmdjones 3 hours ago
#if __has_attribute(cold)
You should use double underscores on attribute names to avoid conflicts with macros (user-defined macros beginning with double underscores are forbidden, as identifiers beginning with double underscores are reserved). #if __has_attribute(__cold__)
# warning "This works too"
#endif
static void __attribute__((__cold__))
foo(void)
{
// This works too
}
codys 9 hours ago
Covers a very large part of what is needed, making fewer and fewer things need to end up in configure scripts. I think most of what's left is checking for items (types, functions) existence and their shape, as you were doing :). I can dream about getting a nice special operator to check for fields/functions, would let us remove even more from configure time, but I suspect we won't because that requires type resolution and none of the existing special operators do that.
mikepurvis 9 hours ago
throwaway81523 9 hours ago
fmajid 3 hours ago
creatonez 12 hours ago
This is how it was done: https://github.com/tavianator/tavianator.com/blob/cf0e4ef26d...
o11c 12 hours ago
tavianator 10 hours ago
epistasis 13 hours ago
It's likely that C will continue to be used by everyone for decades to come, but I know that I'll personally never start a new project in C again.
I'm still glad that there's some sort of push to make autotools suck less for legacy projects.
eqvinox 4 hours ago
autoconf is in no way, shape or form an "official" build system associated with C. It is a GNU creation and certainly popular, but not to a "monopoly" degree, and it's share is declining. (plain make & meson & cmake being popular alternatives)
monkeyelite 12 hours ago
Creating a make file is about 10 lines and is the lowest friction for me to get programming of any environment. Familiarity is part of that.
viraptor 12 hours ago
But if you don't plan to distribute things widely (or have no deps).. Whatever, just do what works for you.
edoceo 12 hours ago
monkeyelite 12 hours ago
Autotools is going to check every config from the past 50 years.
charcircuit 4 hours ago
No? Most operating systems don't have a separate packager. They have the developer package the application.
monkeyelite 3 hours ago
tidwall 13 hours ago
psyclobe 11 hours ago
JCWasmx86 9 hours ago
torarnv 6 hours ago
OskarS 4 hours ago
aldanor 11 hours ago
yjftsjthsd-h 11 hours ago
kouteiheika 9 hours ago
It can build a Rust program (build.rs) which builds things that aren't Rust, but that's an entirely different use case (building non-Rust library to use inside of Rust programs).
crabbone 2 hours ago
touisteur 1 hour ago
malkia 10 hours ago
ahartmetz 7 hours ago