GNU autotools and building an app              Vibha Yadav
Outline●   Why?●   GNU Autotools●   Autogen.sh●   aclocal●   autoconf●   automake●   GNU Build Process●   Autogen.sh●   Co...
Why?●   Platform Issue●   Makes the process easier       –   Configure, make, make install
GNU Autotools●   Autogen.sh●   Aclocal●   Autoconf●   Automake●   Libtool
Autogen.sh●   (a.k.a. buildconf)●   provides automatic build system    preparation●   POSIX shell script●   preparing a bu...
aclocal●   combining stock installed macros + user defined macros +    `acinclude.m4 → aclocal.m4●   to define all of the ...
autoconf●   expands the m4 macros in `configure.in,    perhaps using macro definitions from    `aclocal.m4 -> generate the...
automake●   tool for automatically generating    `Makefile.in files compliant with the    GNU Coding Standards
GNU Build Process
Autogen.shsrcdir=`dirname $0`test -z "$srcdir" && srcdir=.PKG_NAME=<Package_Name>REQUIRED_AUTOCONF_VERSION=2.58REQUIRED_AU...
Configure.ac●   The AC_PREREQ(version) macro can be used to ensure that a recent enough    version of the autoconf program...
Makefile.am●   bin_PROGRAMS = foo●   foo_SOURCES=foo.c foo.h●   foo_CPPFLAGS = lib_CFLAGS●   foo_LIBADD = lib_LIBS●   noin...
Make targets●   dist        Builds a tarball (.tar.gz) for distribution●   distcheck Builds a tarball, then tries to compi...
LibTool●   used for creating portable compiled libraries●   GNU Libtool simplifies the developers job by encapsulating    ...
References●   http://developer.gnome.org/doc/GGAD/z70.html●   http://sourceware.org/autobook/autobook/autobook_75.html●   ...
Questions ???
Upcoming SlideShare
Loading in...5
×

Autotools

223

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
223
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Autotools

  1. 1. GNU autotools and building an app Vibha Yadav
  2. 2. Outline● Why?● GNU Autotools● Autogen.sh● aclocal● autoconf● automake● GNU Build Process● Autogen.sh● Configure.ac● Makefile.am● Make targets● LibTool● References
  3. 3. Why?● Platform Issue● Makes the process easier – Configure, make, make install
  4. 4. GNU Autotools● Autogen.sh● Aclocal● Autoconf● Automake● Libtool
  5. 5. Autogen.sh● (a.k.a. buildconf)● provides automatic build system preparation● POSIX shell script● preparing a build system for compilation● verifying versions,● ensuring necessary functionality● common build preparation issues.
  6. 6. aclocal● combining stock installed macros + user defined macros + `acinclude.m4 → aclocal.m4● to define all of the macros required by `configure.in in a single file
  7. 7. autoconf● expands the m4 macros in `configure.in, perhaps using macro definitions from `aclocal.m4 -> generate the configure script.
  8. 8. automake● tool for automatically generating `Makefile.in files compliant with the GNU Coding Standards
  9. 9. GNU Build Process
  10. 10. Autogen.shsrcdir=`dirname $0`test -z "$srcdir" && srcdir=.PKG_NAME=<Package_Name>REQUIRED_AUTOCONF_VERSION=2.58REQUIRED_AUTOMAKE_VERSION=1.10REQUIRED_LIBTOOL_VERSION=2.2REQUIRED_INTLTOOL_VERSION=0.35.5(test -f $srcdir/configure.ac && test -f $srcdir/ChangeLog && test -d $srcdir/<filename>) || { echo -n "**Error**: Directory "`$srcdir" does not look like the" echo " top-level $PKG_NAME directory" exit 1}which gnome-autogen.sh || { echo "You need to install gnome-common from the GNOME CVS" exit 1}USE_GNOME2_MACROS=1 . gnome-autogen.sh
  11. 11. Configure.ac● The AC_PREREQ(version) macro can be used to ensure that a recent enough version of the autoconf program is available to process the configure.ac file● AC_INIT(package, version, bug-report-address) ● specifies the name and version of the software package● AC_SUBST exports variable into generated files● PKG_CHECK_MODULES(prefix, list-of-modules, action-if-found, action-if-not- found) checks for programs● AC_CHECK_LIB checks for libraries● AC_CHECK_HEADERS checks for header files● AC_PROG_CC checks for compiler characteristics● AC_CHECK_FUNCS checks for library functions● AC_CONFIG_FILES([file...])● AC_OUTPUT● dnl Comment … …
  12. 12. Makefile.am● bin_PROGRAMS = foo● foo_SOURCES=foo.c foo.h● foo_CPPFLAGS = lib_CFLAGS● foo_LIBADD = lib_LIBS● noinst_PROGRAMS=test● EXTRA_DIST=disclaimer.txt
  13. 13. Make targets● dist Builds a tarball (.tar.gz) for distribution● distcheck Builds a tarball, then tries to compile it● clean Deletes the results of compilation (object files and executables), but may not delete some generated files that come with the distribution.● install Creates installation directories if needed, and copies the software into them.● uninstall Reverses the install (deletes installed files).● distclean Reverse the effects of the configure script and the all target; that is, revert a tarball to its pristine state.● mostlyclean Nearly the same as clean, but leaves some object files that most likely dont need to be rebuilt.● maintainer-clean More thorough than clean; may delete some files that require special tools to rebuild, such as machine-generated source code.● check Runs a test suite if you have one
  14. 14. LibTool● used for creating portable compiled libraries● GNU Libtool simplifies the developers job by encapsulating both the platform-specific dependencies, and the user interface, in a single script. GNU Libtool is designed so that the complete functionality of each host type is available via a generic interface, but nasty quirks are hidden from the programmer.● GNU Libtools interface aims to be consistent. Users are not expected to read low-level documentation in order to have a source package build shared libraries. They should only have to run the packages configure script (or equivalent), and Libtool should take care of the details.
  15. 15. References● http://developer.gnome.org/doc/GGAD/z70.html● http://sourceware.org/autobook/autobook/autobook_75.html● http://en.wikipedia.org/wiki/GNU_build_system●
  16. 16. Questions ???
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×