Search:

PmWiki

pmwiki.org

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 Makefile.am file with a vastly simpler and more powerful syntax than that of a plain makefile, and then generates a portable Makefile.in for use with Autoconf.

The resulting Makefile.in (~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 configure.ac (or configure.in). The C header file generated by Autoconf is config.h.in, and this is used by configure.

What is autoreconf?

It does a re-configure and also takes configure.ac as input to create config.h.in and configure script.

Does Autotools create include directives?

Autoconf does not automatically produce #include directives. You need to do that on your own.
https://stackoverflow.com/questions/47107222/autoconf-configure-results-in-c-std-lib-header-related-compile-errors

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 config.h.in 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.

https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Making-configure-Scripts.html#Making-configure-Scripts
https://www.lrde.epita.fr/~adl/dl/autotools.pdf

Autotools vs CMake

http://www.cs.cmu.edu/afs/club.cc.cmu.edu/usr/cmccabe/blog-notes/autotools_considered_harmful2.html


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