1 / 11

An overview of the GNU autotools

An overview of the GNU autotools. Some practical advice about GNU autotools April 14, 2003 – Stanford Linear Accelerator Center Fabrizio Coccetti. The Issue. Warren did not only have PIPE Dreams at CHEP03 … He also has Auto-configuration Dreams.

Download Presentation

An overview of the GNU autotools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An overview of the GNU autotools Some practical advice about GNU autotools April 14, 2003 – Stanford Linear Accelerator Center Fabrizio Coccetti Fabrizio Coccetti - Stanford Linear Accelerator Center

  2. The Issue • Warren did not only have PIPE Dreams at CHEP03 … • He also has Auto-configuration Dreams Something that works out of the box,you just say ‘install’ and it works. Fabrizio Coccetti - Stanford Linear Accelerator Center

  3. The real Problem • How do we handle platform specific issues? • Providing a different Makefile for each architecture • Using Autoconf, Automake and Libtool • The installer needs only • Bourne shell • C compilers • Make program Fabrizio Coccetti - Stanford Linear Accelerator Center

  4. Some advantages when using GNU autotools • The installation of a program is straightforward: ./configure; make; make install • This procedure checks for system parameters, libraries, location of programs, availability of functions and writes a Makefile • ./configure supports many options to overwrite defaults settings Fabrizio Coccetti - Stanford Linear Accelerator Center

  5. GNU autoconf Source Code configure.ac(configure.in) aclocal autoscan autoconf configure.scan configure Fabrizio Coccetti - Stanford Linear Accelerator Center

  6. GNU automake Makefile.in Makefile.am automake configure Makefile Fabrizio Coccetti - Stanford Linear Accelerator Center

  7. configure.ac • dnl Comment … … • AC_INIT(main.c) • AM_INIT_AUTOMAKE(project_name, 1.2.8) • AM_PROG_LIBTOOL it supports libtool and shared libraries • AC_PROG_CC (or AC_PROG_CXX) it locates the C (C++) compiler • AC_HEADER_STDC it checks for standard headers • AC_CHECK_HEADERS(sys/time.h /header.h) it checks for headers availability • AC_CHECK_LIB(crypto SSLeay_version) it checks for libraries availability • AC_CHECK_FUNCS(ctime) it checks for functions availability • AC_PROG_INSTALL it checks for BSD compatible install utility • AC_OUTPUT([Makefile]) Fabrizio Coccetti - Stanford Linear Accelerator Center

  8. Makefile.am • bin_PROGRAMS = foo /configure --prefix=… (default /usr/local) • foo_PROGRAMS=foo.c foo.h • noist_PROGRAMS=test (make compiles, make install does nothing) • EXTRA_DIST=disclaimer.txt Fabrizio Coccetti - Stanford Linear Accelerator Center

  9. Example • foo.c : #include <stdio.h> main() { printf(“Cum grano salis\n"); } • Makefile.am : bin_PROGRAMS = foo foo_SOURCES = foo.c • configure.ac : AC_INIT(foo.c) AM_INIT_AUTOMAKE(latin_words, 0.9) AC_PROG_CC AC_HEADER_STDC AC_PROG_INSTALL AC_OUTPUT([Makefile]) Fabrizio Coccetti - Stanford Linear Accelerator Center

  10. Summary • Source Code, configure.ac, Makefile.am • autoscan; aclocal; autoconf • Create NEWS README AUTHORS ChangeLog • automake –add-missing • ./configure; make; make dist • Result: project_name-2.10.tar.gz aclocal.m4 autom4te-2.53.cache ChangeLog config.status configure.in COPYING install-sh Makefile.am missing NEWS README AUTHORS autoscan.log config.log configure configure.scan INSTALL Makefile.in mkinstalldirs code.c Fabrizio Coccetti - Stanford Linear Accelerator Center

  11. References • GNU Autoconf, Automake, and Libtool http://sources.redhat.com/autobook/autobook/autobook_toc.html • GNU Autoconf Manualhttp://www.gnu.org/manual/autoconf • GNU Automake Manualhttp://www.gnu.org/manual/automake • GNU Libtool Manualhttp://www.gnu.org/manual/libtool • Learning the GNU development toolshttp://autotoolset.sourceforge.net/tutorial.html • The GNU configure and build systemhttp://www.airs.com/ian/configure/configure_toc.html • GNU macro processor (GNU m4)http://www.gnu.org/manual/m4-1.4/m4.html Fabrizio Coccetti - Stanford Linear Accelerator Center

More Related