Autoconf, Automake, and Libtool Tom Tromey. Copyright ● Copyright 2006 Tom Tromey ● Parts Copyright 2006 Alexandre Duret-Lutz ●

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

C++ Development on Linux Agenda Introduction Editors Debuggers GUI IDEs Make Automake Exploring further.
Das GNU Build System Autotools Roman Leshchinsky David Schulz, Shaoke Wu.
Compiling. Your C, C++ or Fortran program won’t work unless you compile it The compiler will build your program as an executable file (typically in the.
Using GNU Autoconf to Configure Erlang Programs Romain Lenglet Chiba Shigeru Group Tokyo Institute of Technology EUC 2006, Stockholm
Binding python to other languages (Fortran and C).
Practical software engineering: Revision control & make Spring 2010, Recitation #2.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
Systems Dev. Tutorial II: Make, utilities, & scripting Recitation Wednesday, Sept 13 th, 2006.
13-Jul-15Advanced Programming Spring 2002 autoconf Jonathan Lennox Department of Computer Science Columbia University.
Lecture 8  make. Overview: Development process  Creation of source files (.c,.h,.cpp)  Compilation (e.g. *.c  *.o) and linking  Running and testing.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
SDD/DFS R. Palsa VLT 2 nd Generation Instrumentation Pipelines, 19 Apr Ralf Palsa CVS, GNU Build Tools & Coding Standards.
CCA Port, Component & Application Build Skeleton Templates “A new script toolkit for generating CCA build skeletons” Torsten Wilde and James Kohl Oak Ridge.
Hall C Software Development From the perspective of a user.
Slide 1/8Jack IDE Tutorial, Index This program is part of the software suite that accompanies the book The Elements of Computing.
Software Engineering in Robotics Packaging and Deployment of Systems Henrik I. Christensen –
Programming Tools gcc make utility Open Source code Static and Shared Libraries gdb Memory debugging tools.
Makefiles CISC/QCSE 810. BeamApp and Tests in C++ 5 source code files After any modification, changed source needs to be recompiled all object files need.
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.cpp.
리눅스 : Lecture 5 UNIX 유틸리티 : text editor, compilation (make), …
Old Chapter 10: Programming Tools A Developer’s Candy Store.
Programming With C.
Scons Writing Solid Code Overview What is scons? scons Basics Other cools scons stuff Resources.
Chapter Ten g++ and make1 System Programming Software Development: g++ and make.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear.
M4 Macro-processing Language Geoffrey Sewell. What will be shown? What’s a macro processor? History of M4 Uses Autotools Syntax Hopefully, you all learn.
22-24 Feb 05 Workshop DKRZ / M&D Stephanie Legutke Introduction to the Standard Compile Environment (SCE) of the Integrated Model & Data Infrastructure.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
Linux development Lection What we gonna do today Root privileges Software packages Managing software packages Build procedures Build components.
Software structure and distribution How to share your code with the rest of the world Why it has to be… AA: Kurtis AB: YongChul
Milan, 15 June 2001WP1 Meeting - F. Donno1 GRID Packaging and Code Management for WP1 F. Donno INFN - Pisa.
Multiple File Compilation and linking By Bhumik Sapara.
INTRODUCTION TO AUTOCONF AND AUTOMAKE. GNU BUILD SYSTEM 1)GNU AUTOCONF 2)GNU AUTOMAKE 3)GNU LIBTOOL 4)GNU GETTEXT.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
How to configure, build and install Trilinos November 2, :30-9:30 a.m. Jim Willenbring.
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 13 A & B Programming Languages and the.
Makefile Script file to automate program compilation and linking (making) 1. Write the "makefile" 2. Write your programs 3. Run "make" or "make -f makefile"
UNIX Development: g++ and make CS 2204 Class meeting 8 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Build Systems Margolin Alex 2/4/09 Includes part of ”Using GNU Autotools” by Alexandre Duret-Lutz.
Wed Mar Michael Imamura / The GNU Autotools Your very own./configure.
CLHEP Infrastructure Improvements CHEP 2004 Lynn Garren, FNAL and Andreas Pfeiffer, CERN.
Building programs LinuxChix-KE. What happens in your CPU? ● It executes a small set of instructions called "machine code" ● Each instruction is just a.
Fixing autotools-related build issues
Software development tools
Linux Development Tools Presented by: Lisha Sterling Creating programs in Linux for Linux and the rest of the world...
Developing Portable Applications ● Introduction GNU autotools – GNU toolchain ● Goals - cross-platform ● Supported platforms (POSIX compliant) ● GNU autotools.
MaSH – Miniature Shell ● Brief introduction to shell. – What is a shell? ● A program that reads inputs from the keyboard and executes the commands. ● Basic.
A gentle introduction to Autotools The good, the bad and the ugly Kees-Jan Dijkzeul October 28 th, 2010.
CST 1101 Problem Solving Using Computers
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Software Package development and management
PERL.
NetCDF 3.6: What’s New Russ Rew
Editor, Compiler, Linker, Debugger, Makefiles
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
The GNU Autotools: autoconf, automake, (libtool)
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Do you know this browser?...
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Makefiles and Notes on Programming Assignment PA2
Overview Unit testing Building Version control.
Build Tools Software Engineering SS 2007
Appendix F C Programming Environment on UNIX Systems
Preparation for Assignment 2
SPL – PS1 Introduction to C++.
Introduction to Computer Science
Presentation transcript:

Autoconf, Automake, and Libtool Tom Tromey

Copyright ● Copyright 2006 Tom Tromey ● Parts Copyright 2006 Alexandre Duret-Lutz ●

Overview ● 3 tools working together ● Address portability, configuration needs ● Support GNU Coding Standards ● Provide consistent user experience ● Very popular – RHL 7: 50% autoconf, 25% automake

The Bad Old Days ● 1990 ● Edit Makefile ● Edit source ● Build ● No “make install”

Autoconf ● Preprocessor based on m4 ● Turns configure.ac into configure ● World's most insane shell scripts – But portable ones!

Handy Quote It it easier to write a portable shell than to write a portable shell script. -- Larry Wall

Autoconf 2 ● Some philosophy – Feature tests, not platform tests – The programmer makes the code portable – The programmer decides what matters

Autoconf 3 ● Test what is on the actual machine ● Write conclusions into text files – Makefile, config.h, etc ● Uniform command line options – Standard directories like bindir, includedir ● Large, extensible library of tests

Autoconf Example AC_INIT([amhello], [1.0], AM_INIT_AUTOMAKE([-Wall -Werror]) AC_PROG_CC AC_CHECK_LIB(z, deflate) AC_CHECK_HEADERS([unistd.h bstring.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT

Boilerplate AC_INIT([amhello], [1.0], AM_INIT_AUTOMAKE([-Wall -Werror]) AC_PROG_CC AC_CHECK_LIB(z, deflate) AC_CHECK_HEADERS([unistd.h bstring.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT

Program Checks AC_INIT([amhello], [1.0], AM_INIT_AUTOMAKE([-Wall -Werror]) AC_PROG_CC AC_CHECK_LIB(z, deflate) AC_CHECK_HEADERS([unistd.h bstring.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT

Library Checks AC_INIT([amhello], [1.0], AM_INIT_AUTOMAKE([-Wall -Werror]) AC_PROG_CC AC_CHECK_LIB(z, deflate) Adds -lz to LIBS; defines HAVE_LIBZ AC_CHECK_HEADERS([unistd.h bstring.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT

Header Checks AC_INIT([amhello], [1.0], AM_INIT_AUTOMAKE([-Wall -Werror]) AC_PROG_CC AC_CHECK_LIB(z, deflate) AC_CHECK_HEADERS([unistd.h bstring.h]) defines HAVE_UNISTD_H, HAVE_BSTRING_H AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT

Automake ● Support GNU Coding Standards ● Make common things simple ● Automate some difficult things ● Turns Makefile.am into Makefile.in ● Unrecognized input passed through

Automake Features ● Low-cost, precise automatic dependency tracking ● Non-srcdir builds ● dist/distcheck ● Various clean targets ● install/uninstall ● Parallel builds

Automake Features 2 ● DESTDIR ● Hooks ● Platform integration

Automake Example bin_PROGRAMS = hello hello_SOURCES = hello.c

Install Directory bin_PROGRAMS = hello hello_SOURCES = hello.c

Install Directory 2 ● You can make your own directories – mylibdir = $(libdir)/whatever – mylib_PROGRAMS = echo

Primary bin_PROGRAMS = hello hello_SOURCES = hello.c

Primary 2 ● There are many primaries – PROGRAMS, LIBRARIES, LTLIBRARIES, LISP, PYTHON, JAVA, SCRIPTS, DATA, HEADERS, MANS, TEXINFOS ● You won't use most of them ● Other prefixes control semantics: nobase, nodist – nobase_nodist_include_HEADERS = foo/foo.h

Object Naming bin_PROGRAMS = hello hello_SOURCES = hello.c

Object Naming 2 ● Names are made “make-friendly” by automake – Weird characters are turned to “_”

Object Suffix bin_PROGRAMS = hello hello_SOURCES = hello.c

Object Suffix 2 ● Object suffixes depend on the type of object ● Typical ones: SOURCES, CFLAGS, LDFLAGS ● SOURCES handles many languages – C, C++, Yacc, Lex, assembly, Fortran, Java (with gcj) – Also header files

Libtool ● Portable creation of shared libraries ● Integration with autoconf and automake ● Side features – libltdl – Convenience libraries

Libtool Example 1 ● configure.ac: – AC_PROG_LIBTOOL ● That's it!

Libtool Example 2 lib_LTLIBRARIES = libexample.la libexample_LA_SOURCES = src/example1.c x2.c

URLs ● Google Alexandre Duret-Lutz ● ● ● ●