edit SideBar

Main / Configure

GNU Autotools are a giant layer of extra stuff designed to help eliminate a huge host of portability problems for software packages, and really adds a huge host of headaches of its own. It falls into the classic trap of trying to design a solution that is "everything to everyone".

To disable libcurl, use --disable-libcurl. To disable libudev, use --disable-udev.

The configure script creates a file named config.status, which actually configures, instantiates, the template files. It also records the configuration options that were specified when the package was last configured in case reconfiguring is needed.

Automake and Autoconf: the bastard brothers

Automake allows you to specify your build needs in a file with a vastly simpler and more powerful syntax than that of a plain makefile, and then generates a portable for use with Autoconf.

The resulting (~400 lines) automatically supports all the standard targets, the substitutions provided by Autoconf, automatic dependency tracking, VPATH building, and so on. make builds the program, and make install installs it in /usr/local/bin (or whatever prefix was given to configure, if not /usr/local).

Autoconf produces the configure script, which script in turn outputs the following:
--one or more Makefile files, usually one in each subdirectory of the package;
--optionally, a C header file, the name of which is configurable, containing #define directives;
--a shell script called config.status that, when run, recreates the files listed above;
--an optional shell script normally called config.cache (created when using ‘configure --config-cache’) that saves the results of running many of the tests;
--a file called config.log containing any messages produced by compilers, to help debugging if configure makes a mistake.

An Autoconf input file is called (or The C header file generated by Autoconf is, and this is used by configure.

What is autoreconf?

It does a re-configure and also takes as input to create and configure script.

Does Autotools create include directives?

Autoconf does not automatically produce #include directives. You need to do that on your own.

Do I need the --target flag?

Generally, no. Use --host instead. The definitions of target and host are stupidly misleading. The destination of the code is actually the host.

What is confdefs.h?

Good question. The only reference I see to it is in the output file config.log, which lists some #defines with this title. I suspect it's a temporary file created by configure to contain the definitions as specd in the or other configure definition files, however that flow works. You can see that the configure script echoes and cats a bunch of #defines to confdefs.h. It is actually printed at the bottom of config.log as well.

What is config.h?

This is the header file generated by configure as an alternative to passing a bunch of defines to the compiler. It should be included at the top of the package .c file.

What is this .m4 stuff?

Some kind of macro system. A .m4 file is a giant text file with all manner of seemingly useless package check scripts in it.

Autotools vs CMake

Page last modified on September 28, 2023, at 02:14 PM