GNU autotools and building an app Vibha Yadav
Outline <ul><li>Why?
GNU Autotools
Autogen.sh
aclocal
autoconf
automake
GNU Build Process
Autogen.sh
Configure.ac
Makefile.am
Make targets
LibTool
References </li></ul>
Why? <ul><li>Platform Issue
Makes the process easier </li><ul><li>Configure, make, make install </li></ul></ul>
Upcoming SlideShare
Loading in...5
×

Autotools

398

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
398
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
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 <ul><li>Why?
  3. 3. GNU Autotools
  4. 4. Autogen.sh
  5. 5. aclocal
  6. 6. autoconf
  7. 7. automake
  8. 8. GNU Build Process
  9. 9. Autogen.sh
  10. 10. Configure.ac
  11. 11. Makefile.am
  12. 12. Make targets
  13. 13. LibTool
  14. 14. References </li></ul>
  15. 15. Why? <ul><li>Platform Issue
  16. 16. Makes the process easier </li><ul><li>Configure, make, make install </li></ul></ul>
  17. 17. GNU Autotools <ul><li>Autogen.sh
  18. 18. Aclocal
  19. 19. Autoconf
  20. 20. Automake
  21. 21. Libtool </li></ul>
  22. 22. Autogen.sh <ul><li>(a.k.a. buildconf)
  23. 23. provides automatic build system preparation
  24. 24. POSIX shell script
  25. 25. preparing a build system for compilation
  26. 26. verifying versions,
  27. 27. ensuring necessary functionality
  28. 28. common build preparation issues. </li></ul>
  29. 29. aclocal <ul><li>combining stock installed macros + user defined macros + `acinclude.m4' -> aclocal.m4
  30. 30. to define all of the macros required by `configure.in' in a single file </li></ul>
  31. 31. autoconf <ul><li>expands the m4 macros in `configure.in', perhaps using macro definitions from `aclocal.m4' -> generate the configure script. </li></ul>
  32. 32. automake <ul><li>tool for automatically generating `Makefile.in' files compliant with the GNU Coding Standards </li></ul>
  33. 33. GNU Build Process
  34. 34. Autogen.sh srcdir=`dirname $0` test -z &quot;$srcdir&quot; && srcdir=. PKG_NAME=<Package_Name> REQUIRED_AUTOCONF_VERSION=2.58 REQUIRED_AUTOMAKE_VERSION=1.10 REQUIRED_LIBTOOL_VERSION=2.2 REQUIRED_INTLTOOL_VERSION=0.35.5 (test -f $srcdir/configure.ac && test -f $srcdir/ChangeLog && test -d $srcdir/<filename>) || { echo -n &quot;**Error**: Directory &quot;`$srcdir'&quot; does not look like the&quot; echo &quot; top-level $PKG_NAME directory&quot; exit 1 } which gnome-autogen.sh || { echo &quot;You need to install gnome-common from the GNOME CVS&quot; exit 1 } USE_GNOME2_MACROS=1 . gnome-autogen.sh
  35. 35. Configure.ac <ul><li>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
  36. 36. AC_INIT(package, version, bug-report-address) </li><ul><ul><li>specifies the name and version of the software package </li></ul></ul><li>AC_SUBST exports variable into generated files
  37. 37. PKG_CHECK_MODULES(prefix, list-of-modules, action-if-found, action-if-not-found) checks for programs
  38. 38. AC_CHECK_LIB checks for libraries
  39. 39. AC_CHECK_HEADERS checks for header files
  40. 40. AC_PROG_CC checks for compiler characteristics
  41. 41. AC_CHECK_FUNCS checks for library functions
  42. 42. AC_CONFIG_FILES([file...])
  43. 43. AC_OUTPUT
  44. 44. dnl Comment … … </li></ul>
  45. 45. Makefile.am <ul><li>bin_PROGRAMS = foo </li></ul><ul><li>foo_SOURCES=foo.c foo.h </li></ul><ul><li>foo_CPPFLAGS = lib_CFLAGS
  46. 46. foo_LIBADD = lib_LIBS
  47. 47. noinst_PROGRAMS=test
  48. 48. EXTRA_DIST=disclaimer.txt </li></ul>
  49. 49. Make targets <ul><li>dist Builds a tarball (.tar.gz) for distribution
  50. 50. distcheck Builds a tarball, then tries to compile it
  51. 51. clean Deletes the results of compilation (object files and executables), but may not delete some generated files that come with the distribution.
  52. 52. install Creates installation directories if needed, and copies the software into them.
  53. 53. uninstall Reverses the install (deletes installed files).
  54. 54. distclean Reverse the effects of the configure script and the all target; that is, revert a tarball to its pristine state.
  55. 55. mostlyclean Nearly the same as clean, but leaves some object files that most likely don't need to be rebuilt.
  56. 56. maintainer-clean More thorough than clean; may delete some files that require special tools to rebuild, such as machine-generated source code.
  57. 57. check Runs a test suite if you have one </li></ul>
  58. 58. LibTool <ul><li>used for creating portable compiled libraries
  59. 59. GNU Libtool simplifies the developer's 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.
  60. 60. GNU Libtool's 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 package's configure script (or equivalent), and Libtool should take care of the details. </li></ul>
  61. 61. References <ul><li>http://developer.gnome.org/doc/GGAD/z70.html
  62. 62. http://sourceware.org/autobook/autobook/autobook_75.html
  63. 63. http://en.wikipedia.org/wiki/GNU_build_system </li></ul>
  64. 64. Questions ???
  1. A particular slide catching your eye?

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

×