I’ve been thinking about this for a while, and now I thought it was the time to implement it and make it public: I’d like to write some complete and. Editorial Reviews. About the Author. Diego Elio Pettenò – also known by his Flameeyes handle Autotools Mythbuster by [Pettenò, Diego Elio]. Autotools Mythbuster (). submitted 1 of printf() for systems that do not ship with printf() * This variable is helpfully set by autotools.

Author: Kajikora Bajar
Country: Swaziland
Language: English (Spanish)
Genre: Automotive
Published (Last): 24 March 2015
Pages: 48
PDF File Size: 6.70 Mb
ePub File Size: 16.57 Mb
ISBN: 845-3-98604-320-8
Downloads: 33925
Price: Free* [*Free Regsitration Required]
Uploader: Vukazahn

Autotools Mythbuster is a no-nonsense guide to Autotools, written with the idea of providing a full, integrated view of the tools in the GNU build chain: Instead of providing a full detailing of the workings of the components, which most consumers are not interested on, this guide focuses on building useful, solid and distribution-friendly packages, that developers can submit to distributions without having to jump through hoops to get them accepted.

Autotools Mythbuster is available as an eBook for those who want to read or reference it online. Profits from its sales are used to pay for hosting and domain name registration. You can find the book on all major Amazon websites, as well as Kobo and their franchises. I’ve been writing notes, quick and dirty tutorials and commentaries about autotools usage and their practices.

The intent is to facilitate solving common problems found during Gentoo Linux development. While these entries were always as accurate as I could make them; they had some obvious limits imposed by the form of blog they were written in.

Indeed, like most blogs; these entries were often opinionated and scattered over a long period of time. They were often interspersed with entries that have nothing to do with autotools or with development at all.

Trying to get the blog entries into a series of articles would probably have been just as difficult: I’ve thus decided to try to find a way to organise my notes and facilitate collaboration. This document is going to be extended, updated, corrected and indexed so that the content is easily browsable and usable by everyone who is looking for information about autotools.

I honestly hope that this guide can be useful to others just as it has been useful for me to learn the subject. I am hopeful that this will improve the overall quality of build systems based on autotools, this way reducing the headaches that developers like me have to sustain to package new software.

Why another guide about autotools? I originally intended working myself on a complete book, but I couldn’t find a publisher accepting it — partly because of my critical failure in being a native English speaker.

Autotools Mythbuster: so why do we have three projects?

For a while I wanted to just drop it, but then the time I spend on fixing build systems for packages I maintain piled up enough that I decided spending time on the guide would probably be better employed. The idea behind my guide was to present an integrated guide that shows the best practices, rather than showing all the possibilities, including those that distributions would have a hard time dealing with.

This reason is why the document is spotty at best: Over time, I have been working on filling the gaps, which should make for a more complete documentation project. How does this work? I’m writing this guide as a free and open book, released under CreativeCommons Attribution-ShareAlike-NonCommercial license the whole content can be licensed under commercial licenses upon request. The availability of this book in source form is meant to allow rebuilding it in any format you see fit for reproduction and for submitting corrections and improvements.

My original idea was to work on this in my spare but paid time, accepting donations to extend the content. Unfortunately, this idea encountered no responses; which meant that the content was only extended in my spare time.


Since I now cannot receive substantial monetary donations; extension will no longer be tied to that.

Unfortunately, the time I feel I can spend on this guide was also reduced drastically, and likely I will just extend it as needed to explain a particular problem, instead of writing a blog entry. How to contribute to the guide. If you are able to improve this guide grammatically or contextually, you’re welcome to submit your changes. You can either send me the patches via email, or request a merge from the Gitorious interface. Please note that if you wish to submit patches, you should follow the same style as the rest of the book.

You’re going to be credited among authors and editors after your second patch or if your contribution is substantial. Configuring the build consists of running a series of tests to identify the build environment and the presence of the required tools and libraries.

It is a crucial step in allowing portability between different operating systems to detect this build environment system. The reason the M4sh language is often confused with simple sh syntax is because it actually is based on that, augmented with the autoconf proper macros and a few more macros that replace part of the sh syntax.

The major change between the standard sh syntax and M4sh is found in two macros: The two macros, as it’s easy to guess, replace two constructs from sh: This in turn helps resolving issues with macros and conditionality.

Autotools Mythbuster | Hacker News

The basic M4sh macros have a syntax that is directly translatable to sh syntax. It is thus easier to just see how the macros translate: As you can see, the parameters to the macro aren’t in a fixed number: The parameters are positional: Finally, almost identical to the previous macro, the last parameter is the code executed when nothing else matched up.

These three definitions are: The system that is going to run the software once it is built, which is the main actor. Once the software has been built, it will execute on this particular system. The system where the build process is being executed. For most uses this would be the same as the host system, but in case of cross-compilation the two obviously differ. The system against which the software being built will run on. This is the case for compilers, debuggers, profilers and analyzers and other tools in general.

Some other tools, such aslibtool, will require discovery of canonical systems by themselves. It is actually quite easy to decide whether canonical system definitions are needed or not. We just have to look for the use of the related actor variable. Don’t fear calling them in more than one place. Especially for software that processes the output of the script to identify some information about the package being built. These are designed to provide, in a format easy to parse with “glob masks”; the major details that describe a computer system.

It is meant to actually be the vendor of the hardware system, rather than the vendor of the software, although presently it is mostly used by distributions to brand their toolchain iredhat-linux-gnu or their special systems igentoo-freebsd7.

Most operating systems don’t split their definitions further in kernel and userland because they only work as an “ensemble”: FreeBSD, Open Solaris, Darwin, … There are, though, a few operating systems that have a split between kernel and userland, being managed by different projects or even being replaceable independently.

For a few operating systems, this value might differ from the one that is used as the “product version” used in public. Unfortunately, because of the importance of this feature, it’s also one the most commonly misused. They usually add or remove dependencies only if they are needed for that particular feature being enabled or disabled. These might add or remove features from the project.

The first two kinds of parameters differ just for the displayed name and from the macro used, but are in effect handled mostly in the same way. While there is no technical difference between the two, it’s helpful for both users and distribution to follow the indications given above about the use of the two parameters’ kind.


This allows to identify exactly what the parameters are used for. Because they work in the same way, the following explanation will only talk about the former, but the same applies for the latter. Name of the argument, this will be used for both the actual argument option and for the variable to store the result in.

It’s useful to keep to a subset of characters here, since it’ll be translated to a string compatible with sh variable names. This is the string used to describe the parameter when running.

Often it’s passed raw directly to the macro, but that will likely make the text not align or fill properly in the help text. This is the M4sh code executed when no parameter of any kind for the given option name has been given at. This is not the case! The second parameter for the two macros above is the description string as output by. This macro takes care of properly aligning the text, breaking the lines where needed. For instance take the following fragment: It’s not really important for what concerns the functionality of the script, but it’s useful to keep for consistency.

Sometimes, the external dependencies of a project can be a hassle, especially if they enable optional features that not every operating system supports or that some users don’t really care about.

For this reason, they are often made optional, non-mandatory. When the option is non-mandatory, but it’s desirable if certain software is present in the system, it’s usual to make the dependency automatic.

Automatic dependencies are enabled only if the needed libraries are found, and “soft-fail” in disabling the features if they are not.

Autotools Mythbuster: so why do we have three projects? – Flameeyes’s Weblog

For distributions like Gentoo Linux that build on users’ systems, this situation is actually problematic and has to be resolved to properly package the software [ GentooAutomagic ]. Most of those are ignored. Those that are not should be declared through this macro. What is important is that the variable is cached. This in turn produces two effects: This macro is used to check for the presence of a known usually, third-party library but it does not work that well when you have a list of alternatives to check.

The name of the symbol to look for in the libraries. A whitespace-separated list of libraries, in library-name format, that have to be searched for the function listed before. As usual, the macro supports expanding code for success and failure. Technically, on some if not most operating systems, it is possible for libraries to have undefined symbols that require other libraries to be linked in to satisfy. This is the case for most static libraries, but it can also happen for some shared libraries.

To make it possible to search in the libraries, the macro provides this parameter. There is an implicit value for the parameter: To use a library you need its public headers, so to make sure a library is available, you have to ensure that its headers are available.

It’s not unlikely that we have to look for one out of a series of possible replacement headers in our software. That’s the case when we’ve got to support libraries that might be installed at top level, in subdirectories, or when older non-standard headers are replaced with new equivalent ones.

In this situation, the order used above is also a priority order; since the first is the preferred header and the third is the least favourite one.