Thông tin tài liệu
www.nostarch.com
THE FINEST IN GEEK ENTERTAINMENT
™
SHELVE IN:
COMPUTERS/PROGRAMMING
$44.95 ($56.95 CDN)
CREATING
PORTABLE
SOFTWARE JUST
GOT EASIER
CREATING
PORTABLE
SOFTWARE JUST
GOT EASIER
“I LIE FLAT.”
This book uses RepKover—a durable binding that won’t snap shut.
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 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.
ABOUT THE AUTHOR
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, as well as the Novell-sponsored FLAIM
database project.
AUTOTOOLS
AUTOTOOLS
A PRACTITIONER’S GUIDE TO
GNU AUTOCONF, AUTOMAKE, AND LIBTOOL
JOHN CALCOTE
CALCOTE
AUTOTOOLS
AUTOTOOLS
www.it-ebooks.info
www.it-ebooks.info
AUTOTOOLS
Autotools_02.book Page i Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
Autotools_02.book Page ii Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
AUTOTOOLS
A Practitioner’s Guide to
GNU Autoconf, Automake,
and Libtool
by John Calcote
San Francisco
Autotools_02.book Page iii Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
AUTOTOOLS. Copyright © 2010 by John Calcote.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior
written permission of the copyright owner and the publisher.
14 13 12 11 10 1 2 3 4 5 6 7 8 9
ISBN-10: 1-59327-206-5
ISBN-13: 978-1-59327-206-7
Publisher: William Pollock
Production Editor: Ansel Staton
Cover and Interior Design: Octopod Studios
Developmental Editor: William Pollock
Technical Reviewer: Ralf Wildenhues
Copyeditor: Megan Dunchak
Compositor: Susan Glinert Stevens
Proofreader: Linda Seifert
Indexer: Nancy Guenther
For information on book distributors or translations, please contact No Starch Press, Inc. directly:
No Starch Press, Inc.
38 Ringold Street, San Francisco, CA 94103
phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; www.nostarch.com
Library of Congress Cataloging-in-Publication Data
Calcote, John, 1964-
Autotools : a practitioner's guide to GNU Autoconf, Automake, and Libtool / by John Calcote.
p. cm.
ISBN-13: 978-1-59327-206-7 (pbk.)
ISBN-10: 1-59327-206-5 (pbk.)
1. Autotools (Electronic resource) 2. Cross-platform software development. 3. Open source software.
4. UNIX (Computer file) I. Title.
QA76.76.D47C335 2010
005.3 dc22
2009040784
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and
company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark
symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.
The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been
taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any
person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the
information contained in it.
Autotools_02.book Page iv Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
For Michelle
But to see her was to love her;
Love but her, and love forever.
—Robert Burns
Autotools_02.book Page v Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
Autotools_02.book Page vi Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
BRIEF CONTENTS
Foreword by Ralf Wildenhues xv
Preface xvii
Introduction xxi
Chapter 1: A Brief Introduction to the GNU Autotools 1
Chapter 2: Understanding the GNU Coding Standards 19
Chapter 3: Configuring Your Project with Autoconf 57
Chapter 4: More Fun with Autoconf: Configuring User Options 89
Chapter 5: Automatic Makefiles with Automake 119
Chapter 6: Building Libraries with Libtool 145
Chapter 7: Library Interface Versioning and Runtime Dynamic Linking 171
Chapter 8: FLAIM: An Autotools Example 195
Chapter 9: FLAIM Part II: Pushing the Envelope 229
Chapter 10: Using the M4 Macro Processor with Autoconf 251
Chapter 11: A Catalog of Tips and Reusable Solutions for Creating Great Projects 271
Index 313
Autotools_02.book Page vii Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
Autotools_02.book Page viii Tuesday, June 15, 2010 2:38 PM
www.it-ebooks.info
[...]... several years ago and are starting to show their age, contain at least some inaccuracies, or tend to be incomplete for typical beginner’s tasks On the other hand, the GNU manuals for these programs are fairly large and rather technical, and as such, they may present a significant entry barrier to learning your ways around the Autotools John Calcote began this book with an online tutorial that shared at... Contents in D etai l www.it-ebooks.info Autotools_02.book Page xv Tuesday, June 15, 2010 2:38 PM FOREWORD When I was asked to do a technical review on a book about the Autotools, I was rather skeptical Several online tutorials and a few books already introduce readers to the use of GNU Autoconf, Automake, and Libtool However, many of these texts are less than ideal in at least some ways: They were either... source software package maintainer who wants to become an Autotools expert Existing material on the subject is limited to the GNU Autotools manuals and a few Internet-based tutorials For years most real-world questions have been answered on the Autotools mailing lists, but mailing lists are an inefficient form of teaching because the same answers to the same questions are given time and again This book... the GNU Autotools that I’ve been able to discover is GNU AUTOCONF, AUTOMAKE, and LIBTOOL by Gary Vaughan, Ben Elliston, Tom Tromey, and Ian Lance Taylor, affectionately known by the community as The Goat Book (so dubbed for the front cover—an oldfashioned photo of goats doing acrobatic stunts).1 I’ve been told by publishers that there is simply no market for such a book In fact, one editor told me that... Tuesday, June 15, 2010 2:38 PM Chapters 6 and 7 explain basic shared-library concepts and show how to build shared libraries with Libtool a stand-alone abstraction for shared library functionality that can be used with the other Autotools Chapter 6 begins with a shared-library primer and then covers some basic Libtool extensions that allow Libtool to be a drop-in replacement for the more basic library... www.it-ebooks.info Autotools_02.book Page 5 Tuesday, June 15, 2010 2:38 PM Generating Your Package Build System The GNU Autotools framework includes three main packages: Autoconf, Automake, and Libtool The tools in these packages can generate code that depends on utilities and functionality from the gettext, m4, sed, make, and perl packages, among others With respect to the Autotools, it’s important to distinguish... autoreconf The autoreconf utility executes the configuration tools in the autoconf, automake, and libtool packages as required by each project autoreconf minimizes the amount of regeneration required to address changes in timestamps, features, and project state It was written as an attempt to consolidate existing maintainer-written, script-based utilities that ran all the required Autotools in the right... GNU Autoconf, Automake, and Libtool (the Autotools) have revolutionized the open source software world But while there are many thousands of Autotools advocates, there are also many developers who hate the Autotools—with a passion The reason for this dread of the Autotools, I think, is that when you use the Autotools, you have to understand the underlying infrastructure that they manage Otherwise, you’ll... use a JVM in an Autoconf check Additionally, the portable nature of Java and the Java virtual machine specification make it fairly unlikely that you’ll need to perform a Java-based Autoconf check in the first place 5 For example, native Erlang support made it into the Autotools because members of the Erlang community thought it was important enough to add it themselves 4 Chapter 1 www.it-ebooks.info Autotools_02.book... configuration script generates config.h from config.h.in As maintainer, you’ll use autoheader to generate the template file that you will include in your distribution package (We’ll examine autoheader in greater detail in Chapter 3.) autoscan The autoscan program generates a default configure.ac file for a new project; it can also examine an existing Autotools project for flaws and opportunities for enhancement . TO
GNU AUTOCONF, AUTOMAKE, AND LIBTOOL
JOHN CALCOTE
CALCOTE
AUTOTOOLS
AUTOTOOLS
www.it-ebooks.info
www.it-ebooks.info
AUTOTOOLS
Autotools_02.book Page. www.nostarch.com
Library of Congress Cataloging-in-Publication Data
Calcote, John, 1964-
Autotools : a practitioner's guide to GNU Autoconf, Automake, and
Ngày đăng: 20/02/2014, 11:20
Xem thêm: Tài liệu Autotools: A Practioner''''s Guide to GNU Autoconf, Automake, and Libtool pdf, Tài liệu Autotools: A Practioner''''s Guide to GNU Autoconf, Automake, and Libtool pdf, What's in a Makefile.am File?