Cover image for Autotools

Book description

The GNU Autotools (the GNU Build System) is a group of utilities designed to make it easy for developers to create software that is portable across many Unix-like operating systems. Autotools: A Practical Guide is the first book to offer programmers a tutorial-based guide to the Autotools.

Table of Contents

  1. AUTOTOOLS
    1. FOREWORD
    2. PREFACE
      1. Why Use the Autotools?
      2. Acknowledgments
      3. I Wish You the Very Best
    3. 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
    4. 1. 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. Autoconf
        1. autoconf
        2. autoreconf
        3. autoheader
        4. autoscan
        5. autoupdate
        6. ifnames
        7. autom4te
        8. Working Together
      7. Automake
        1. automake
        2. aclocal
      8. Libtool
        1. libtool
        2. libtoolize
        3. ltdl, the Libtool C API
      9. Building Your Package
        1. Running configure
          1. Building Outside the Source Directory
        2. Running make
      10. Installing the Most Up-to-Date Autotools
      11. Summary
    5. 2. UNDERSTANDING THE GNU CODING STANDARDS
      1. Creating a New Project Directory Structure
      2. Project Structure
      3. Makefile Basics
        1. Commands and Rules
        2. Variables
        3. A Separate Shell for Each Command
        4. Variable Binding
        5. Rules in Detail
          1. Automatic Variables
          2. Dependency Rules
          3. Implicit Rules
          4. Phony Targets
          5. Multiple Targets
        6. Resources for Makefile Authors
      4. Creating a Source Distribution Archive
        1. Forcing a Rule to Run
        2. Leading Control Characters
      5. Automatically Testing a Distribution
      6. Unit Testing, Anyone?
      7. Installing Products
        1. Installation Choices
        2. Uninstalling a Package
        3. Testing Install and Uninstall
      8. The Filesystem Hierarchy Standard
      9. Supporting Standard Targets and Variables
        1. Standard Targets
        2. Standard Variables
        3. Adding Location Variables to Jupiter
      10. Getting Your Project into a Linux Distro
      11. Build vs. Installation Prefix Overrides
      12. User Variables
      13. Configuring Your Package
      14. Summary
    6. 3. 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
        1. The Proverbial autogen.sh Script
        2. Updating Makefile.in
      13. Initialization and Package Information
        1. AC_PREREQ
        2. AC_INIT
        3. AC_CONFIG_SRCDIR
      14. The Instantiating Macros
        1. AC_CONFIG_HEADERS
        2. Using autoheader to Generate an Include File Template
      15. Back to Remote Builds for a Moment
      16. Summary
    7. 4. MORE FUN WITH AUTOCONF: CONFIGURING USER OPTIONS
      1. Substitutions and Definitions
        1. AC_SUBST
        2. AC_DEFINE
      2. Checking for Compilers
      3. Checking for Other Programs
      4. A Common Problem with Autoconf
      5. Checks for Libraries and Header Files
        1. Is It Right or Just Good Enough?
        2. Printing Messages
      6. Supporting Optional Features and Packages
        1. Coding Up the Feature Option
        2. Formatting Help Strings
      7. Checks for Type and Structure Definitions
      8. The AC_OUTPUT Macro
      9. Summary
    8. 5. AUTOMATIC MAKEFILES WITH AUTOMAKE
      1. Getting Down to Business
        1. Enabling Automake in configure.ac
        2. A Hidden Benefit: Automatic Dependency Tracking
      2. What's in a Makefile.am File?
      3. Analyzing Our New Build System
        1. Product List Variables
          1. Installation Location Prefixes
          2. Prefixes Not Associated with Installation
          3. Primaries
        2. Product Source Variables
        3. PLV and PSV Modifiers
      4. Unit Tests: Supporting make check
      5. Reducing Complexity with Convenience Libraries
        1. Product Option Variables
        2. Per-Makefile Option Variables
      6. Building the New Library
      7. What Goes into a Distribution?
      8. Maintainer Mode
      9. Cutting Through the Noise
      10. Summary
    9. 6. BUILDING LIBRARIES WITH LIBTOOL
      1. The Benefits of Shared Libraries
      2. How Shared Libraries Work
        1. Dynamic Linking at Load Time
        2. Automatic Dynamic Linking at Runtime
        3. Manual Dynamic Linking at Runtime
      3. Using Libtool
        1. Abstracting the Build Process
        2. Abstraction at Runtime
      4. Installing Libtool
      5. Adding Shared Libraries to Jupiter
        1. Using the LTLIBRARIES Primary
        2. Public Include Directories
        3. Customizing Libtool with LT_INIT Options
        4. Reconfigure and Build
        5. So What Is PIC, Anyway?
        6. Fixing the Jupiter PIC Problem
      6. Summary
    10. 7. LIBRARY INTERFACE VERSIONING AND RUNTIME DYNAMIC LINKING
      1. System-Specific Versioning
        1. Linux and Solaris Library Versioning
        2. IBM AIX Library Versioning
        3. HP-UX/AT&T SVR4 Library Versioning
      2. The Libtool Library Versioning Scheme
        1. Library Versioning Is Interface Versioning
        2. When Library Versioning Just Isn't Enough
      3. Using libltdl
        1. Necessary Infrastructure
        2. Adding a Plug-In Interface
        3. Doing It the Old-Fashioned Way
        4. Converting to Libtool's ltdl Library
        5. Preloading Multiple Modules
        6. Checking It All Out
      4. Summary
    11. 8. FLAIM: AN AUTOTOOLS EXAMPLE
      1. What Is FLAIM?
      2. Why FLAIM?
      3. An Initial Look
      4. Getting Started
        1. Adding the configure.ac Files
          1. Automake in the Umbrella Project
          2. Why Add the Libtool Macros?
          3. Adding a Macro Subdirectory
        2. The Top-Level Makefile.am File
      5. The FLAIM Subprojects
        1. The FLAIM Toolkit configure.ac File
          1. Automake Configuration Features
          2. Doing Threads the Right Way
          3. Getting Just the Right Libraries
          4. Maintainer-Defined Command-Line Options
        2. The FLAIM Toolkit Makefile.am File
          1. Automake -hook and -local Rules
        3. Designing the ftk/src/Makefile.am File
        4. Moving On to the ftk/util Directory
      6. Designing the XFLAIM Build System
        1. The XFLAIM configure.ac File
        2. Creating the xflaim/src/Makefile.am File
        3. Turning to the xflaim/util Directory
          1. Stamp Targets
          2. Cleaning Your Room
      7. Summary
    12. 9. FLAIM PART II: PUSHING THE ENVELOPE
      1. Building Java Sources Using the Autotools
        1. Autotools Java Support
        2. Using ac-archive Macros
        3. Canonical System Information
        4. The xflaim/java Directory Structure
        5. The xflaim/src/Makefile.am File
        6. Building the JNI C++ Sources
        7. The Java Wrapper Classes and JNI Headers
        8. A Caveat About Using the JAVA Primary
      2. Building the C# Sources
        1. Manual Installation
        2. Cleaning Up Again
      3. Configuring Compiler Options
      4. Hooking Doxygen into the Build Process
      5. Adding Nonstandard Targets
      6. Summary
    13. 10. USING THE M4 MACRO PROCESSOR WITH AUTOCONF
      1. M4 Text Processing
        1. Defining Macros
        2. Macros with Arguments
          1. Whitespace Around Arguments
      2. The Recursive Nature of M4
        1. Quoting Rules
      3. Autoconf and M4
        1. The Autoconf M4 Environment
      4. Writing Autoconf Macros
        1. Simple Text Replacement
        2. Documenting Your Macros
        3. M4 Conditionals
          1. Adding Precision
      5. Diagnosing Problems
      6. Summary
    14. 11. A CATALOG OF TIPS AND REUSABLE SOLUTIONS FOR CREATING GREAT PROJECTS
      1. Item 1: Keeping Private Details out of Public Interfaces
        1. Solutions in C
        2. Solutions in C++
          1. The PIMPL Pattern
          2. C++ Virtual 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
        1. Providing Library-Specific Autoconf Macros
      6. Item 6: Cross-Compiling
      7. Item 7: Emulating Autoconf Text Replacement Techniques
      8. Item 8: Using the ac-archive Project
      9. Item 9: Using pkg-config with Autotools
        1. Providing pkg-config Files for Your Library Projects
        2. Using pkg-config Files in configure.ac
      10. Item 10: Using Incremental Installation Techniques
      11. Item 11: Using Generated Source Code
        1. Using the BUILT_SOURCES Variable
        2. Dependency Management
          1. A Two-Pass System
          2. Doing It in One Pass
        3. Built Sources Done Right
      12. Item 12: Disabling Undesirable Targets
      13. Item 13: Watch Those Tab Characters!
      14. Item 14: Packaging Choices
      15. Wrapping Up
    15. Index
    16. About the Author
    17. Updates