Presentation is loading. Please wait.

Presentation is loading. Please wait.

Wed Mar 15 2006Michael Imamura / The GNU Autotools Your very own./configure.

Similar presentations


Presentation on theme: "Wed Mar 15 2006Michael Imamura / The GNU Autotools Your very own./configure."— Presentation transcript:

1 Wed Mar 15 2006Michael Imamura / LUG@GT The GNU Autotools Your very own./configure

2 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT The Autotools are Hard! No, they’re not! Well, maybe a little… Okay, here’s why you should learn them anyway. –User configurability –Standards are everybody’s friend! –Portability – your code isn’t as portable as you think!

4 Wed Mar 15 2006Michael Imamura / LUG@GT Getting Started From scratch: A blank Autotools project –http://lugatgt.org/articles/autotools/autoblank.tar.gzhttp://lugatgt.org/articles/autotools/autoblank.tar.gz –Use an IDE (like Anjuta) Retrofit an existing project

5 Wed Mar 15 2006Michael Imamura / LUG@GT The Initial Process Create a few initial stub sources (if you don’t already have any) Create Makefile.am files –http://lugatgt.org/articles/autotools/amwiz/http://lugatgt.org/articles/autotools/amwiz/ Run autoscan and create configure.ac –Autoconf Macro Archive http://autoconf-archive.cryp.to/ http://autoconf-archive.cryp.to/ Run autoreconf --install Run./configure!

6 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT 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! –It’s up to YOU to decide how to react

12 Wed Mar 15 2006Michael Imamura / LUG@GT 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 Wed Mar 15 2006Michael Imamura / LUG@GT There’s much more to say… But this presentation is too small to contain it. http://lugatgt.org/articles/autotools/ Autoconf Macro Archive: http://autoconf-archive.cryp.to/ http://autoconf-archive.cryp.to/ “GNU Autoconf, Automake, and Libtool” by Gary Vaughan, et al. http://sourceware.org/autobook/ (free download!) http://sourceware.org/autobook/


Download ppt "Wed Mar 15 2006Michael Imamura / The GNU Autotools Your very own./configure."

Similar presentations


Ads by Google