The GNU Autotools make it easy for developers to create software that is portable across many Unix-like operating systems. Although the Autotools are used by thousands of open source software packages, they have a notoriously steep learning curve. And good luck to the beginner who wants to find anything beyond a basic reference work online.
Autotools Autotools is the first book to offer programmers a tutorial-based guide to the GNU build system. Author John Calcote begins with an overview of high-level concepts and a quick hands-on tour of the philosophy and design of the Autotools. He then tackles more advanced details, like using the M4 macro processor with Autoconf, extending the framework provided by Automake, and building Java and C# sources. He concludes the book with detailed solutions to the most frequent problems encountered by first-time Autotools users.
You'll learn how to:
Master the Autotools build system to maximize your software's portability
Generate Autoconf configuration scripts to simplify the compilation process
Produce portable makefiles with Automake
Build cross-platform software libraries with Libtool
Write your own Autoconf macros
Autotools focuses on two projects: Jupiter, a simple "Hello, world!" program, and FLAIM, an existing, complex open source effort containing four separate but interdependent subprojects. Follow along as the author takes Jupiter's build system from a basic makefile to a full-fledged Autotools project, and then as he converts the FLAIM projects from complex hand-coded makefiles to the powerful and flexible GNU build system.
Chapter 1 A BRIEF INTRODUCTION TO THE GNU AUTOTOOLS
Who Should Use the Autotools?
When Should You Not Use the Autotools?
Apple Platforms and Mac OS X
The Choice of Language
Generating Your Package Build System
Autoconf
Automake
Libtool
Building Your Package
Installing the Most Up-to-Date Autotools
Summary
Chapter 2 UNDERSTANDING THE GNU CODING STANDARDS
Creating a New Project Directory Structure
Project Structure
Makefile Basics
Creating a Source Distribution Archive
Automatically Testing a Distribution
Unit Testing, Anyone?
Installing Products
The Filesystem Hierarchy Standard
Supporting Standard Targets and Variables
Getting Your Project into a Linux Distro
Build vs. Installation Prefix Overrides
User Variables
Configuring Your Package
Summary
Chapter 3 CONFIGURING YOUR PROJECT WITH AUTOCONF
Autoconf Configuration Scripts
The Shortest configure.ac File
Comparing M4 to the C Preprocessor
The Nature of M4 Macros
Executing autoconf
Executing configure
Executing config.status
Adding Some Real Functionality
Generating Files from Templates
Adding VPATH Build Functionality
Let's Take a Breather
An Even Quicker Start with autoscan
Initialization and Package Information
The Instantiating Macros
Back to Remote Builds for a Moment
Summary
Chapter 4 MORE FUN WITH AUTOCONF: CONFIGURING USER OPTIONS
Substitutions and Definitions
Checking for Compilers
Checking for Other Programs
A Common Problem with Autoconf
Checks for Libraries and Header Files
Supporting Optional Features and Packages
Checks for Type and Structure Definitions
The AC_OUTPUT Macro
Summary
Chapter 5 AUTOMATIC MAKEFILES WITH AUTOMAKE
Getting Down to Business
What's in a Makefile.am File?
Analyzing Our New Build System
Unit Tests: Supporting make check
Reducing Complexity with Convenience Libraries
Building the New Library
What Goes into a Distribution?
Maintainer Mode
Cutting Through the Noise
Summary
Chapter 6 BUILDING LIBRARIES WITH LIBTOOL
The Benefits of Shared Libraries
How Shared Libraries Work
Using Libtool
Installing Libtool
Adding Shared Libraries to Jupiter
Summary
Chapter 7 LIBRARY INTERFACE VERSIONING AND RUNTIME DYNAMIC LINKING
System-Specific Versioning
The Libtool Library Versioning Scheme
Using libltdl
Summary
Chapter 8 FLAIM: AN AUTOTOOLS EXAMPLE
What Is FLAIM?
Why FLAIM?
An Initial Look
Getting Started
The FLAIM Subprojects
Designing the XFLAIM Build System
Summary
Chapter 9 FLAIM PART II: PUSHING THE ENVELOPE
Building Java Sources Using the Autotools
Building the C# Sources
Configuring Compiler Options
Hooking Doxygen into the Build Process
Adding Nonstandard Targets
Summary
Chapter 10 USING THE M4 MACRO PROCESSOR WITH AUTOCONF
M4 Text Processing
The Recursive Nature of M4
Autoconf and M4
Writing Autoconf Macros
Diagnosing Problems
Summary
Chapter 11 A CATALOG OF TIPS AND REUSABLE SOLUTIONS FOR CREATING GREAT PROJECTS
Item 1: Keeping Private Details out of Public Interfaces
Item 2: Implementing Recursive Extension Targets
Item 3: Using a Repository Revision Number in a Package Version
Item 4: Ensuring Your Distribution Packages Are Clean
Item 5: Hacking Autoconf Macros
Item 6: Cross-Compiling
Item 7: Emulating Autoconf Text Replacement Techniques
Item 8: Using the ac-archive Project
Item 9: Using pkg-config with Autotools
Item 10: Using Incremental Installation Techniques
Item 11: Using Generated Source Code
Item 12: Disabling Undesirable Targets
Item 13: Watch Those Tab Characters!
Item 14: Packaging Choices
Wrapping Up
Updates
Title:
Autotools
By:
John Calcote
Publisher:
No Starch Press
Formats:
Print
Ebook
Safari Books Online
Print:
July 2010
Ebook:
September 2010
Pages:
360
Print ISBN:
978-1-59327-206-7
| ISBN 10:
1-59327-206-5
Ebook ISBN:
978-1-59327-331-6
| ISBN 10:
1-59327-331-2
John Calcote
John Calcote is a Senior Software Engineer and Architect at Novell, Inc. He's been writing and developing portable networking and system-level software for nearly 20 years and is active in developing, debugging, and analyzing diverse open source software packages. He is currently a project administrator of the OpenSLP, OpenXDAS, and DNX projects (open source software available at http://www.sourceforge.net), as well as the Novell-sponsored FLAIM database project (open source software available at http://developer.novell.com).