Haoyu Tan’s code library. Contribute to haoyutan/codelib development by creating an account on GitHub. Autotools: a practitioner’s guide to Autoconf, Automake and Libtool. by John Calcote – Chapter 1: A brief introduction to the GNU Autotools. by John . There are few people who would deny that Autoconf, Automake and Libtool have revolutionized the free software world. While there are many thousands of.
|Published (Last):||2 October 2017|
|PDF File Size:||18.42 Mb|
|ePub File Size:||19.66 Mb|
|Price:||Free* [*Free Regsitration Required]|
There are few people who would deny that Autoconf, Automake and Libtool have revolutionized the free software world. While there are many thousands of Autotools advocates, some developers absolutely hate the Autotools, with a passion. Let me try to explain with an analogy. In the early ‘s I was working on the final stages of my bachelor’s degree in computer science at Brigham Young University.
How wrong I was. Oh, yes–you can write object-oriented software in C. But you are required to manage all of the details yourself. The advantages should be clear. But this high-level functionality comes at a price–you have to learn to understand what the compiler is doing for you, so you can write your code in a way that complements it. And therein lies the problem. The most basic single-line Makefile. This book is written for the open source software package maintainer.
I’m purposely not using the terms “free software” or “proprietary software that’s free”. The use of the term “open source” is critical in this context. You see, open source defines a type of software distribution channel. One in which the primary method of obtaining software functionality is downloading a source archive, unpacking, building and installing the built products on your system.
Free software may be published in binary form. Proprietary software may be given away. But open source software implies source-level distribution.
Source-level distribution relegates a particular portion of the responsibility of software development to the end-user that has traditionally been assumed by the software developer. But end-users are not developers, so most of them won’t know how to properly build your package.
What to do, what pracgitioner do The most widely adopted approach from the earliest days of the open source movement was to make the package build process as simple as possible for the end user, such that she could perform a few well-known steps and have your package cleanly installed on her system.
Most packages are built using makefiles, and the make utility peactitioner as pervasive a tool as anything else that’s available. It’s very easy to type make –but that’s not the problem. The problem crops up when the package practitooner build successfully, because of some unanticipated difference between the user’s system and the developer’s system. Thus was born the ubiquitous configure script–initially a simple shell script that configured the end-user’s environment so that the make utility could successfully build a source package on the end-user’s system.
Hand-coded configure scripts helped, but they weren’t the final answer. They fixed about 65 percent of the problems resulting from system configuration differences–and they were a pain in the neck to write properly.
Dozens of changes were made incrementally over a period of years, until the script would work properly on most systems anyone cared about. But the entire process was clearly in need of an upgrade. Do you have any idea of the number of build-breaking differences there are between existing systems today? Neither do I, but there is a handful of developers in the world who know a large percentage of these differences.
Between them and the free software community, the Autotools were born. The Autotools were designed to create configure scripts and makefiles that work correctly and provide significant chunks of valuable end-user functionality under most circumstances, and on most systems–even systems not initially considered or even known about by the package maintainer. So, returning to that passionate hate felt by some developers toward the Autotools: If you get your head screwed on straight about the primary purpose of the Autotools, then hate quickly turns into respect–and even appreciation.
Often the root of such hate is a simple misunderstanding of the rationale behind the Autotools. The purpose of the Autotools is not to make life simpler for the package maintainer although it really does in the long run. The purpose of the Autotools is to make life simpler for the end-user. To drive my point home, I’ll wager that you’ll never see a Linux distribution packager spouting hateful sentiment on the Autotools mailing lists.
These people are in a class of engineers by themselves. They’re generally quiet on mailing lists–asking an occasional well-considered question when they really need to–but lurking and learning, for the most part. Packagers grasp the advantages of the Autotools immediately.
They don’t write many Autoconf input scripts, but they do patch a lot of them. How do you become such an expert?
I recommend you start with this book. I’ve organized it in the best way I know how to help you get your head around the functionality provided by the Autotools. But don’t stop there. Pick up the manuals. They’re free, and links are provided in the References section of this book, but they’re easy to find with a simple internet query. I’ve left a Ajtotools of details out of this book, because my purpose is to quickly get you up to speed on understanding and using the Autotools.
The Autotools manuals are well-written and concise, but more importantly, they’re complete. After reading this book, they should be a cake walk.
Then study open source and free software packages that use the Autotools. See what other experts have done. Learning by example is an excellent way to begin to retain the information you’ve read.
Autotools: a practitioner’s guide to Autoconf, Automake and Libtool
Finally, instrument some of your own projects with the Autotools. Doing is by far the best way to learn. The initial reading will reduce the frustration of this exercise to something bearable.
Above all, remember why you’re doing this–because you want your end-user’s experience with your package to be as delightful as possible.
No open source project was ever successful until it had a well-established user base, and you don’t get there by alienating your users. You do it by creating a user build, installation and operation experience that shines. You’ll still need to handle the operation experience, of course, but Autotools can provide a great multi-platform build and installation experience–with far less effort on your part.
I’ve been in this industry for 25 years, and I’ve worked with free software for quite some time now.
I’ve learned a lot about free software maintenance and development–most of it, unfortunately, by trial and error. Had there been other books on the topic, I would have snatched them all up immediately, rather than spend hours–even days autotoils to get the Autotools to do something I could have done in a makefile in a few minutes.
I’ve been told by publishers that there is simply no market for such a book. In fact, one editor told me that he himself had tried unsuccessfully to entice authors to write this book a few years ago. His authors wouldn’t finish the project, and the publisher’s market analysis indicated that there was very little interest in the book. Let’s analyze this picture: There are nearlyfree software projects on sourceforge.
If only 10 percent of those are still active, that’s autltools 20, live projects. If 80 percent of those are Linux or Unix based packages, that’s 16, free software packages that might use the Autotools. And that’s only sourceforge. Each of those packages has at least one maintainer–often two or three. Each of those maintainers probably uses or has tried to use the Autotools.
Autotools: a practitioner’s guide to Autoconf, Automake and Libtool
Many of them have a fairly solid understanding of the Autotools by now, but at what expense in time and effort did they gain autootools understanding? Publishers believe that free software developers tend to disdain written documentation–perhaps they’re right. Interestingly, books on Perl sell like Perl’s going out of style–which is actually somewhat true these days–and yet people are still buying enough Perl books to keep their publishers happy.
All of this explains why there are ten books on the shelf with animal pictures on the cover for perl, but literally autotoo,s for free software developers.
But, as fast as free software moves these days, a book published in might as well have been published in Nevertheless, because of the need for any book on this subject, the Goat Book is still autotoolz sold new in bookstores. In fairness to the authors, they have maintained an online version through February of I’m talking about the shear volume of information that is assumed to be understood by the reader. The Goat Book is written in a very non-linear fashion, so it’s difficult to learn anything from it.
It’s a great reference, but a terrible tutorial. Perhaps the authors were targeting an audience that had already graduated to more advanced topics. In either case, the Goat Book, peactitioner being very complete from a content perspective, is definitely not a great learning resource for the beginner.
And yet a large percentage of their readership today are young people just starting out with Unix and Linux, and most of their issues center around Unix utilities not generally associated with the Autotools.
Take sedfor example: What a dream of a tool to work with–I love it! More to the point however, a solid understanding of the basic functionality of sedm4shell script and other utilities is critical to understanding the proper use of the Autotools.
The Goat Book practitiondr cover the m4 macro processor in great detail, but it’s not clear to the uninitiated that one might do well to start with Chapter Understanding how something works autotolls the covers is often a good way to master a topic, but a general introduction at an appropriate point in higher-level discussions can make all the difference fuide a beginner. Existing GNU documentation is more often reference material than solution-oriented instruction.
What we need is a cookbook-style approach, covering real problems found in real projects. As each recipe is mastered, the reader makes small intuitive leaps–I call them minor epiphanies. Put enough of these under your belt and overall mastery of the Autotools is ultimately inevitable.