introduction to autotools and cvs
play

Introduction to Autotools and Cvs Dirk Vermeir Dept. of Computer - PowerPoint PPT Presentation

Introduction to Autotools and Cvs Dirk Vermeir Dept. of Computer Science Free University of Brussels, VUB Introduction to Autotools and Cvs p.1/77 Introduction Introduction to Autotools and Cvs p.2/77 Why Autotools Make it easier to


  1. Introduction to Autotools and Cvs Dirk Vermeir Dept. of Computer Science Free University of Brussels, VUB Introduction to Autotools and Cvs – p.1/77

  2. Introduction Introduction to Autotools and Cvs – p.2/77

  3. Why Autotools Make it easier to develop OS-indepedent systems by isolating and automating detection (autoconf). Also: provide a shared database of detection tools (autoconf macro’s). Same for compilers and linkers ( libtool). Standardize and simplify Makefiles while providing a rich set of targets (automake). PACKAGE=spmps-0.1 tar zxf ${PACKAGE}.tar.gz && cd ${PACKAGE} && ./configure && make && make check && make install Introduction to Autotools and Cvs – p.3/77

  4. Autotools Architecture acinclude.m4 autoscan ac (configure.scan) aclocal configure.in autoheader Makefile.am am ac aclocal.m4 autoconf config.h.in automake ac am configure Makefile.in Makefile config.h Introduction to Autotools and Cvs – p.4/77

  5. Input The developer must supply: The file configure.in describing tests to be done on the target system to define preprocessor symbols and other installation-dependent variables. A Makefile.am file for each directory containing a high level description of programs, libraries etc. to be produced. Introduction to Autotools and Cvs – p.5/77

  6. End Products The end products in the figure are A configure shell script that, at installation time, probes the target system and produces, from template config.h.in and file Makefile.in files, 1. a proper Makefile, and a 2. a file config.h that contains C or C++ definitions for inclusion in various system-dependent source files. In addition, one can define ones own template files, e.g. header.html.in on which configure will perform variable substitution to obtain header.html. Introduction to Autotools and Cvs – p.6/77

  7. Aclocal Generates the aclocal.m4 macro file for input to autoconf. Collects the definitions of specific autoconf macros needed by automake and/or used in configure.in. Definitions are found in the file acinclude.m4, or in the directory /usr/[ local /] share/aclocal/ Part of the automake package. Introduction to Autotools and Cvs – p.7/77

  8. Autoheader Generates config.h.in from configure.in. Part of the autoconf package. Introduction to Autotools and Cvs – p.8/77

  9. Autoscan Recursively scans the source files in the current and lower directories to identify common portability problems. Generates configure.scan which can be used as a starting point for configure.in. Part of the autoconf package. Introduction to Autotools and Cvs – p.9/77

  10. Autoconf Generates the configure script from configure.in, which mainly consists of a sequence of m4 macro calls. Finds new macro definitions in the file aclocal.m4 (produced by aclocal). Introduction to Autotools and Cvs – p.10/77

  11. Automake Generates Makefile.in which will be transformed by configure into a proper Makefile at installation time. It is driven by a high level description of the various targets and components in several Makefile.am files corresponding to the Makefiles mentioned in the AC_CONFIG_FILES call in configure.in. For each Makefile.am it creates a Makefile.in (in the same directory) on which configure will perform substitutions (on @name@) to make a full-blown Makefile. The generated Makefile handles most dependencies automatically. Introduction to Autotools and Cvs – p.11/77

  12. Configure Generated by autoconf from configure.in. Largely self-contained and portable shell script. Runs the tests specified in configure.in to determine the value of a number of C preprocessor symbols and so-called output variables . Preprocessors symbol definitions go in config.h, e.g. for use by the compilers. Output variables are used to perform substitutions of @variable@ in template files such as Makefile.in. Introduction to Autotools and Cvs – p.12/77

  13. Libtool Using libtool frees the implementor of worrying about the details of the local compiler/linker command line requirements. One set of simple options is automagically translated to the proper target system command. This is especially useful for creating shared libraries. Introduction to Autotools and Cvs – p.13/77

  14. Ifnames Shows preprocessor symbols used in a set of source files. bash-2.05$ ifnames *.[hC] HAVE_ARPA_INET_H inetaddress.C serversocket.C HAVE_FUNC_GETHOSTBYADDR_R_7 inetaddress.C HAVE_FUNC_GETHOSTBYADDR_R_8 inetaddress.C HAVE_FUNC_GETHOSTBYNAME_R_3 inetaddress.C HAVE_FUNC_GETHOSTBYNAME_R_5 inetaddress.C HAVE_FUNC_GETHOSTBYNAME_R_6 inetaddress.C HAVE_NETDB_H inetaddress.C HAVE_SYS_SOCKET_H inetaddress.C HAVE_UNISTD_H inetaddress.C socket.C bash-2.05$ Introduction to Autotools and Cvs – p.14/77

  15. Example configure.in Introduction to Autotools and Cvs – p.15/77

  16. Example configure.in dnl Process this file with autoconf to produce dnl a configure script. dnl ========================================== dnl define @PACKAGE_NAME@, @PACKAGE_VERSION@, dnl @PACKAGE_BUGREPORT@ also as preprocessor dnl symbols AC_INIT(spms, 0.1, dvermeir@vub.ac.be) dnl sanity check: exit if file not present AC_CONFIG_SRCDIR([spms/project.C]) AM_INIT_AUTOMAKE dnl Ensure libtool is shipped with package AM_PROG_LIBTOOL dnl file where preprocessor symbols go AM_CONFIG_HEADER([config.h]) Introduction to Autotools and Cvs – p.16/77

  17. Example configure.in dnl ========================================== dnl Checks for programs. dnl ========================================== AC_PROG_CXX AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB DV_REQUIRE_PROG(mysql,mysql, [/bin /usr/bin /usr/local/bin /usr/local/mysql/bin]) DV_REQUIRE_PROG(perl,perl, [/bin /usr/bin /usr/local/bin ]) Introduction to Autotools and Cvs – p.17/77

  18. Example configure.in dnl ========================================== dnl Checks for libraries. dnl ========================================== DV_REQUIRE_DVMYSQL dnl ========================================== dnl Checks for header files. dnl ========================================== AC_CHECK_HEADERS(unistd.h) AC_HEADER_TIME AC_CHECK_FUNCS([gettimeofday]) dnl ========================================== dnl Checks for typedefs, structures, and compiler dnl ========================================== AC_C_CONST AC_TYPE_SIZE_T Introduction to Autotools and Cvs – p.18/77

  19. Example configure.in dnl ========================================== dnl Checks for library functions. dnl ========================================== DV_REQUIRE_CFUNC(pthread_mutex_init,pthread) dnl ========================================== dnl Make @DATE@ available in .in files in doc dnl ========================================== DATE=‘date +"%e %B, %Y"‘ dnl AC_SUBST ensures definition of @DATE@ AC_SUBST(DATE) Introduction to Autotools and Cvs – p.19/77

  20. Example configure.in dnl ========================================== dnl URL pointing to top directory for package dnl documentation, for use by dnl $(pkgdatadir)/package/html/installdox dnl ========================================== AC_ARG_WITH(doxyroot, [ --with-doxyroot=url url for dv docs], doxyurl=$withval, doxyurl="http://tinf2.vub.ac.be/dv/") AC_SUBST(doxyurl) Introduction to Autotools and Cvs – p.20/77

  21. Example configure.in dnl ========================================== dnl substitute @name@ in all the files dnl below (each file.in must exist) dnl ========================================== AC_CONFIG_FILES([ Makefile spms/Makefile spms/createdb.sh spms/header.html spms/doxygen.conf spms/help.html doc/Makefile m4/Makefile m4/spms.m4 ]) AC_OUTPUT Introduction to Autotools and Cvs – p.21/77

  22. Ouput of Autoscan # Process this file with autoconf # to produce a configure script. AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CXX AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB Introduction to Autotools and Cvs – p.22/77

  23. Output of Autoscan # Checks for libraries. # Checks for header files. AC_CHECK_HEADERS([limits.h]) # Checks for typedefs, structures, # and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T # Checks for library functions. AC_CHECK_FUNCS([select]) # AC_CONFIG_FILES([doc/Makefile Makefile spms/Makefile m4/Makefile]) AC_OUTPUT Introduction to Autotools and Cvs – p.23/77

  24. Example File: header.html.in <html> <head> <title>@PACKAGE_NAME@-@PACKAGE_VERSION@</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <style type=text/css> a:link { text-decoration:none } a:active { text-decoration:none } a:visited { text-decoration:none } </style> </head> <body bgcolor="#ffffff"> Introduction to Autotools and Cvs – p.24/77

  25. Autoconf Introduction to Autotools and Cvs – p.25/77

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend