user1592932
user1592932

Reputation: 35

autotools or cmake for compiling C

Does autotools comes out of box for all the major unix systems? I am looking for something that can compile the code without installing any additional software and platform independent(UNIX flavors and Architecture).

Upvotes: 1

Views: 561

Answers (3)

SquareRootOfTwentyThree
SquareRootOfTwentyThree

Reputation: 7776

Autotools needs to be installed only on the developer's system, and not on the builder's system. Their output is an independent sh script that will create the desired Makefile. In some cases though (e.g. "automagic" dependencies), also the builder may need autotools, and it's not uncommon a specific version is required.

autotools is basically a giant collection of scripted obscure kludges, driven by directive files to be written in an even more obscure macro language - m4. If you see any remote chance your project will be cross-compiled, then steer away from autotools and its siblings (read libtool).

cmake is a much better alternative, but there are even better and leaner programs like scons.

Still, I have to admit that most Unix systems today are mostly ANSI C and POSIX compliant as opposed to 10+ years ago, that is, the time autotools was conceived. I hardly see the need of anything but the classic make to be able to compile your project in a portable way.

Upvotes: -2

Adrian Cornish
Adrian Cornish

Reputation: 23868

I have used both recently and overall I prefer cmake over autotools. I found cmake a little simpler with less scripting needed. Most linux distros will include a package for both although cmake make have to be installed as an option.

Autotools are ok for simple projects but in my experience they required lots and lots of extra scripting when checking libraries etc - cmake on the other hand made it simple to detect dependencies. Also a plus you may not care about - but it make compiling your code on windows platforms easier as well

Upvotes: 0

Dirk is no longer here
Dirk is no longer here

Reputation: 368241

If you use autotools correctly, the end result is a script configure so that

 configure
 make
 make install

works -- and yes, the very point of autotools is that this should work just about everywhere.

Upvotes: 3

Related Questions