0%

Book Description

The GNU Autotools make it easy for developers to create software that is portable across many Unix-like operating systems, and even Windows. Although the Autotools are used by thousands of open source software packages, they have a notoriously steep learning curve.

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 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 with solutions to frequent problems encountered by Autotools users.

This thoroughly revised second edition has been updated to cover the latest versions of the Autotools. It includes five new chapters on topics like pkg-config, unit and integration testing with Autotest, internationalizing with GNU tools, the portability of gnulib, and using the Autotools with Windows. As with the first edition, you'll focus on two projects: Jupiter, a simple “Hello, world!” program, and FLAIM, an existing, complex open source effort containing four separate but interdependent projects. 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.

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

This detailed introduction to the GNU Autotools is indispensable for developers and programmers looking to gain a deeper understanding of this complex suite of tools. Stop fighting against the system and make sense of it all with the second edition of Autotools!

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. About the Author
  6. About the Technical Reviewer
  7. BRIEF CONTENTS
  8. CONTENTS IN DETAIL
  9. FOREWORD FOR THE FIRST EDITION by Ralf Wildenhues
  10. FOREWORD FOR THE SECOND EDITION by Eric Blake
  11. PREFACE
    1. Why Use the Autotools?
    2. Acknowledgments for the First Edition
    3. Acknowledgments for the Second Edition
    4. I Wish You the Very Best
  12. INTRODUCTION
    1. Who Should Read This Book
    2. How This Book Is Organized
    3. Conventions Used in This Book
    4. Autotools Versions Used in This Book
  13. 1 AN END USER’S PERSPECTIVE ON THE GNU AUTOTOOLS
    1. Software Source Archives
    2. Unpacking a Source Archive
    3. Building the Software
    4. Testing the Build
    5. Installing the Built Software
    6. Summary
  14. 2 A BRIEF INTRODUCTION TO THE GNU AUTOTOOLS
    1. Who Should Use the Autotools?
    2. When Should You Not Use the Autotools?
    3. Apple Platforms and Mac OS X
    4. The Choice of Language
    5. Generating Your Package Build System
    6. Configuration
    7. Autoconf
    8. Automake
    9. Libtool
    10. Building Your Package
    11. Installing the Most Up-to-Date Autotools
    12. Summary
  15. 3 UNDERSTANDING THE GNU CODING STANDARDS
    1. Creating a New Project Directory Structure
    2. Project Structure
    3. Makefile Basics
    4. Creating a Source Distribution Archive
    5. Automatically Testing a Distribution
    6. Unit Testing, Anyone?
    7. Installing Products
    8. The Filesystem Hierarchy Standard
    9. Supporting Standard Targets and Variables
    10. Getting Your Project into a Linux Distro
    11. Build vs. Installation Prefix Overrides
    12. User Variables
    13. Nonrecursive Build Systems
    14. Configuring Your Package
    15. Summary
  16. 4 CONFIGURING YOUR PROJECT WITH AUTOCONF
    1. Autoconf Configuration Scripts
    2. The Shortest configure.ac File
    3. Comparing M4 to the C Preprocessor
    4. The Nature of M4 Macros
    5. Executing autoconf
    6. Executing configure
    7. Executing config.status
    8. Adding Some Real Functionality
    9. Generating Files from Templates
    10. Adding VPATH Build Functionality
    11. Let’s Take a Breather
    12. An Even Quicker Start with autoscan
    13. Initialization and Package Information
    14. The Instantiating Macros
    15. Back to Remote Builds for a Moment
    16. Summary
  17. 5 MORE FUN WITH AUTOCONF: CONFIGURING USER OPTIONS
    1. Substitutions and Definitions
    2. Checking for Compilers
    3. Checking for Other Programs
    4. A Common Problem with Autoconf
    5. Checks for Libraries and Header Files
    6. Supporting Optional Features and Packages
    7. Checks for Type and Structure Definitions
    8. The AC_OUTPUT Macro
    9. Summary
  18. 6 AUTOMATIC MAKEFILES WITH AUTOMAKE
    1. Getting Down to Business
    2. What’s Actually in a Makefile.am File?
    3. Analyzing Our New Build System
    4. Unit Tests: Supporting make check
    5. Reducing Complexity with Convenience Libraries
    6. Building the New Library
    7. What Goes into a Distribution?
    8. Maintainer Mode
    9. Cutting Through the Noise
    10. Nonrecursive Automake
    11. Summary
  19. 7 BUILDING LIBRARIES WITH LIBTOOL
    1. The Benefits of Shared Libraries
    2. How Shared Libraries Work
    3. Using Libtool
    4. Installing Libtool
    5. Adding Shared Libraries to Jupiter
    6. Summary
  20. 8 LIBRARY INTERFACE VERSIONING AND RUNTIME DYNAMIC LINKING
    1. System-Specific Versioning
    2. The Libtool Library Versioning Scheme
    3. Using libltdl
    4. Converting to Libtool’s ltdl Library
    5. Summary
  21. 9 UNIT AND INTEGRATION TESTING WITH AUTOTEST
    1. Autotest Overview
    2. Wiring Up Autotest
    3. Adding a Test
    4. Unit Testing vs. Integration Testing
    5. Administrative Details
    6. Niceties
    7. A Minimal Approach
    8. Summary
  22. 10 FINDING BUILD DEPENDENCIES WITH PKG-CONFIG
    1. A pkg-config Overview
    2. Diving In
    3. Writing pkg-config Metadata Files
    4. Generating .pc Files with Autoconf
    5. Uninstalled .pc Files
    6. Using pkg-config in configure.ac
    7. pkg-config Autoconf Macros
    8. Summary
  23. 11 INTERNATIONALIZATION
    1. Obligatory Disclaimer
    2. Internationalization (I18n)
    3. Summary
  24. 12 LOCALIZATION
    1. Getting Started
    2. Integrating gettext with the Autotools
    3. Summary
  25. 13 MAXIMUM PORTABILITY WITH GNULIB
    1. License Caveat
    2. Getting Started
    3. Adding Gnulib Modules to a Project
    4. Summary
  26. 14 FLAIM: AN AUTOTOOLS EXAMPLE
    1. What Is FLAIM?
    2. Why FLAIM?
    3. Logistics
    4. An Initial Look
    5. Getting Started
    6. The FLAIM Subprojects
    7. Designing the XFLAIM Build System
    8. Summary
  27. 15 FLAIM PART II: PUSHING THE ENVELOPE
    1. Building Java Sources Using the Autotools
    2. Building the C# Sources
    3. Configuring Compiler Options
    4. Hooking Doxygen into the Build Process
    5. Adding Nonstandard Targets
    6. Summary
  28. 16 USING THE M4 MACRO PROCESSOR WITH AUTOCONF
    1. M4 Text Processing
    2. The Recursive Nature of M4
    3. Autoconf and M4
    4. Writing Autoconf Macros
    5. Diagnosing Problems
    6. Summary
  29. 17 USING THE AUTOTOOLS WITH WINDOWS
    1. Environment Options
    2. Tool Chain Options
    3. Getting Started
    4. Cross-Compiling for Windows on Linux
    5. Windows Subsystem for Linux
    6. Cygwin
    7. MinGW: Minimalist GNU for Windows
    8. Msys2
    9. Summary
  30. 18 A CATALOG OF TIPS AND REUSABLE SOLUTIONS FOR CREATING GREAT PROJECTS
    1. Item 1: Keeping Private Details out of Public Interfaces
    2. Item 2: Implementing Recursive Extension Targets
    3. Item 3: Using a Repository Revision Number in a Package Version
    4. Item 4: Ensuring Your Distribution Packages Are Clean
    5. Item 5: Hacking Autoconf Macros
    6. Item 6: Cross-Compiling
    7. Item 7: Emulating Autoconf Text Replacement Techniques
    8. Item 8: Using the Autoconf Archive Project
    9. Item 9: Using Incremental Installation Techniques
    10. Item 10: Using Generated Source Code
    11. Item 11: Disabling Undesirable Targets
    12. Item 12: Watch Those Tab Characters!
    13. Item 13: Packaging Choices
    14. Wrapping Up
  31. INDEX
34.204.3.195