The GNU Autotools - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

The GNU Autotools

Description:

Okay, here's why you should learn them anyway. User configurability. Standards are everybody's friend! ... http://sourceware.org/autobook/ (free download! ... – PowerPoint PPT presentation

Number of Views:358
Avg rating:3.0/5.0
Slides: 14
Provided by: michael296
Category:

less

Transcript and Presenter's Notes

Title: The GNU Autotools


1
The GNU Autotools
  • Your very own ./configure

2
Say Hello to the Autotools
  • Autoconf, with the power of ./configure!
  • Automake, making makefiles suck less!
  • Libtool, friend to shared and static library
    alike!

3
The Autotools are Hard!
  • No, theyre not!
  • Well, maybe a little
  • Okay, heres why you should learn them anyway.
  • User configurability
  • Standards are everybodys friend!
  • Portability your code isnt as portable as you
    think!

4
Getting Started
  • From scratch A blank Autotools project
  • http//lugatgt.org/articles/autotools/autoblank.ta
    r.gz
  • Use an IDE (like Anjuta)
  • Retrofit an existing project

5
The Initial Process
  • Create a few initial stub sources (if you dont
    already have any)
  • Create Makefile.am files
  • http//lugatgt.org/articles/autotools/amwiz/
  • Run autoscan and create configure.ac
  • Autoconf Macro Archivehttp//autoconf-archive.cry
    p.to/
  • Run autoreconf --install
  • Run ./configure!

6
Automake
  • Makefile.am ? Makefile.in ? Makefile
  • Basically, a Makefile with special variable
    declarations
  • Primaries What is being produced
  • bin_PROGRAMS, lib_LTLIBRARIES, etc.
  • Secondaries How to produce it
  • _CFLAGS, _SOURCES, _LIBADD, etc.

7
Autoconf
  • Run autoscan to produce configure.scan
  • Detects source file types
  • Detects toolchain dependencies
  • Merge configure.scan into configure.ac
  • Add AM_INIT_AUTOMAKE to add Automake support
  • Add AC_PROG_LIBTOOL to add Libtool support

8
Developing, developing, developing
  • Whenever configure.ac or Makefile.am changes,
    re-run autoreconf
  • autoreconf --make is useful here
  • Generated Makefile is often smart enough to do it
    for you
  • Standard make targets generated by Automake
  • User all (default), install, clean
  • Developer dist, check, distcheck

9
Debugging
  • Libtool hides linking issues
  • Automatically relinks on install
  • Oops Libtool gets in the way
  • Your binary may not be a binary!
  • Use libtool gdb instead of gdb

10
Source control What to check in
  • General rule Only check in files that you have
    created
  • Only configure.ac and Makefile.am
  • Set ignores for the generated files
  • Add to note to HACKING about what versions of
    Autoconf, Automake, and Libtool you used

11
What about portability?
  • The other reason to use Autoconf
  • General strategy
  • Study the config.h generated by ./configure
  • For every define
  • Can we work around the issue?
  • Is the tested feature an absolute requirement?
  • Autoconf is not a magic bullet!
  • Its up to YOU to decide how to react

12
Beyond ./configure
  • make check Unit tests with DejaGNU
  • Custom configure.ac tests
  • Tests are written in GNU M4
  • Use AC_ARG_ENABLE to allow the user to customize
    your package with --enable-feature
  • Fine-tuning
  • Different flavors of clean

13
Theres much more to say
  • But this presentation is too small to contain it.
  • http//lugatgt.org/articles/autotools/
  • Autoconf Macro Archivehttp//autoconf-archive.cr
    yp.to/
  • GNU Autoconf, Automake, and Libtool by Gary
    Vaughan, et al.http//sourceware.org/autobook/(f
    ree download!)
Write a Comment
User Comments (0)
About PowerShow.com