Alternatives to Autoconf and Autotools? [closed]
Asked Answered
A

9

62

I'm a very frequent user of the GNU Autotools (mostly Autoconf, occasionally Libtool). I'm working on a project where portability is going to be a sticking point.. Yet, the rest of the team is just not comfortable working with m4. I got this in my inbox from not one, but four people:

m4 is NOT lisp, dammit!

Anyway, perhaps someone could recommend something Python or PHP based? I'm working on the C end of a much larger tree; I can be sure either Python or PHP 5 will be present, as they are prerequisites.

Amphitropous answered 1/3, 2009 at 18:52 Comment(3)
Familiarity with m4 is irrelevant. Arguing against autoconf because of m4 is like arguing against C because the compiler uses a lex generated lexer and the developers don't understand lex. When using the autotools, you can completely ignore m4 98% of the time. In the remaining 2%, you can also ignore m4! Usually, if you find yourself having issues related to m4 it is because you are doing something else fundamentally wrong.Hatpin
@WilliamPursell after a couple of years have passed since I asked this, I tend to agree. But the problem remains - It's just too darn easy to go down a fundamentally wrong path using it. And, when you want really granular build control from configure, you ultimately hit M4. Unless I missed something?Amphitropous
@TimPost I had to deal with a similar argument years back. Nobody wanted to learn M4 (or anything if it could be helped). The project became a combination of bash and python scripts, plus a hideous C++ app that was mainly just using C-style macros. Finally, after having the authority to axe it after 6 months of the system becoming arbitrarily complicated (C++ app calling python and shell scripts via system(2)), I swapped out this mess with a 200 line M4 script. I'll never come to accept "we don't want to learn it" as a valid excuse.Speaker
F
39

I have heard good things about CMake which tries to solve the same problems. Here is the wikipedia article

Furey answered 1/3, 2009 at 18:54 Comment(3)
Using it for a long time and no major issues.Verlaverlee
I would suggest the same thing. I made myself this question some time ago, and came to conclusion that CMake is the right answer.Sikko
Thanks, it looks like Cmake will do exactly what I need. These days, if I even WHISPER 'autoconf' villagers with torches and pitchforks show up at my desk :|Amphitropous
P
58

I'm taking the chance of being downvoted but, I must admit, that unfortunately there is no real substitute for autotools. CMake, SCons, bjam are nice but, when it comes to serious work... it is quite clear that autotools are superior, not because CMake can't do the same thing, but because it is just much harder to do so with it.

For example, CMake, the most popular alternative to autotools, has the following drawbacks:

  • No support of gettext. This may be a real problem when you need to manage a lot of translations and translated source code.
  • No support for an uninstall target. It is quite unpleasant to find out that you can't uninstall the program you installed.
  • No automatic build of both shared and static libraries.
  • Documentation is very limited and bad.

And so on.

There are many other points. Unfortunately, there is no real high quality substitute for autotools. On the other hand, if you develop on Windows and for Visual Studio, then you can't use autotools and you need to choose CMake that provides such tools.

Platas answered 13/7, 2009 at 18:56 Comment(5)
All you say true!! If you stuck with Windows/Linux x86/Mac OS X SCons and CMake look more simple then auto tools. But if you come to some unusual platform you get many issues...Allpurpose
People often neglect the very reason that Autotools is written in m4. It is written in m4 so that the configure script can be generated in pure shell so that any UNIX platform can be targetted. CMake on the other hand targets anything that has CMake. Now what is more common? CMake or Bourne Shell? I'd tend to say Bourne Shell. Its also not the writers of Autoconf's fault that Windows neglects to provide a decent shell.Winepress
I consider this the best answer. I'm working with autotools regularly and it is indeed pain at times. But I always get the things done and the standard autotools provide for the resulting configure and Makefile is exceptionally useful. I'm occasionally using cmake and I must admit that it's much harder to use (as in build the source) and there's not enough online resources to get the things I'm doing with autotools quickly.Enharmonic
Even if Bourne Shell is more likely to already be installed, you still have to download something in order to get a project to build (at a minimum, the sources, but most likely several dependencies). Since a large number of projects now require CMake, there's a good chance that CMake is already installed. CMake has it's quirks and downsides, but I don't think "it can't be run directly from a shell" is a good argument against CMake. You still have to download something.Metagenesis
@Allpurpose specifically when you want to gloss over the differences between Windows and unixoid systems in CMake I have found that to be an issue.Smallscale
N
39

I've had good success with SCons. It's built with Python and the build scripts are actually Python scripts themselves, which gives a great deal of expressive power. From the web site:

SCons is an Open Source software construction tool—that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software.

Numbing answered 1/3, 2009 at 18:53 Comment(0)
F
39

I have heard good things about CMake which tries to solve the same problems. Here is the wikipedia article

Furey answered 1/3, 2009 at 18:54 Comment(3)
Using it for a long time and no major issues.Verlaverlee
I would suggest the same thing. I made myself this question some time ago, and came to conclusion that CMake is the right answer.Sikko
Thanks, it looks like Cmake will do exactly what I need. These days, if I even WHISPER 'autoconf' villagers with torches and pitchforks show up at my desk :|Amphitropous
S
19

There are a lot of different alternative Makefile generators and build systems out there:

Also available, but not stringently targeted on C/C++:

  • Premake
  • Ant (for Java)
  • Rake (for Ruby)
  • (Definitely more, I just don't know them all...)

But after listing these all, autotools have the great advantage of not requiring any other dependency for the end-user. A configure script is only generated once by the developer and does not require anything special on the user end, as it is a shell script. The tools listed above have to be installed before anyone can build your source and they even might have dependencies themselves.

Stave answered 2/3, 2009 at 18:22 Comment(4)
A configure script needs a sh compatible shell, which is something special on a windows machine.Quinquepartite
So what is the point if you need additional software anyway on Windows? No difference if you install python or some shell.Stave
THere are a large list with more details in Wikipedia Build Automation ListNoe
@Quinquepartite I don't know what was it like in 2009, but I'd argue that since at least a few years ago, a bourne-compatible shell stopped being "something special on a windows machine" due to the prevalence of GFW/git bash. Where I work, a developer not having something of the sort installed would be surprising to me at least. Make/autotools, on the other hand, would probably entail installing MSYS2 though.Holden
B
16

How about simply using Make and pkg-config?

Here is a Makefile template to get you started.

Less is more people.

Backlash answered 11/10, 2009 at 17:1 Comment(8)
That Makefile template doesn't support automatic dependencies, which is really nice.Winepress
that's what pkg-config is for? hg.suckless.org/surf/file/tip/config.mk#l13Backlash
Not what a I meant. I mean internal dependencies generated from source code between headers, like GCC does. Its not particularly hard to do once you figure out how, but it can be a bit of a pain.Winepress
Like that gcc -MM -MG -MT stuff? github.com/dontcallmedom/widlproc/blob/master/Makefile#L102Backlash
Yep, exactly that. :) Adding that to your makefile template really +1's itWinepress
Well, I don't like all those switches and magic tbh. For a project to suck less you need to carefully deliberate over it by hand. :PBacklash
This looks like quite a simple and elegant approach actually. It minimises dependencies too. In fact, if you're already a shell/bash guru, then you're more or less a makefile guru too. And even if not, it's easy enough to search & hack it seems.Helenhelena
@Backlash Note: That link is dead; here are some working ones: git.suckless.org/surf/file/config.mk.html git.suckless.org/surf/commit/…Holden
L
4

One more auto* replacement - mk-configure. Docs can be found here

Limb answered 27/9, 2011 at 12:27 Comment(0)
V
3

I have had a look at CMake, which looks like a good alternative unless you are cross-compiling. If you are doing native compilation, you should try it

Vitrification answered 1/3, 2009 at 19:17 Comment(0)
D
1

There's a python version of make being created at Mozilla - pymake - which presumably supports cross-platform use.

Dashing answered 1/3, 2009 at 19:33 Comment(2)
All PyMake really does is fix GNU make bugs on Windows that are now fixed in GNU make anyway.Hedgehog
@Hedgehog glad the GNU make team haven't wasted the last six yearsDashing
R
1

For building C/C++ software from ANT or maven you might be interested in terp. It includes a portable C++ compiler task that works with many C++ compilers on many platforms.

Reconstruct answered 13/7, 2009 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.