First, we specify metadata informations such as the name and version of the package and the email address of the maintainer or the language used (C++)
dnl Initialization AC_COPYRIGHT([Copyright (C) 2007 Pierre-Alexandre Meyer]) AC_INIT([set-difference],[1.0],[bug-set_difference@mouraf.org]) AC_CONFIG_AUX_DIR(build-aux-tools) AC_LANG([C++]) AM_INIT_AUTOMAKE([-Wall -Werror gnu dist-bzip2 1.7]) dnl Sanity checks. AC_CONFIG_SRCDIR([src])
Most of the macros are straightforward to understand.
Notice we have required a recent version of automake (
). With previous versions (e.g.
), one can have problems between macros AM_CONFIG_HEADER and AC_CONFIG_HEADER .
Notice also that we have set the strictness to gnu. This is only a question of the standards the program will respect.
Next step it to specify what is needed to build set_difference : basically a C++ compiler and miscellaneous headers from the STL:
dnl Checks for programs. AS_MESSAGE(Checking required programs...) AC_PROG_CXX dnl Checks for the right headers. AS_MESSAGE(Checking for C++ header files...) AC_LANG_ASSERT(C++) AC_CHECK_HEADER([iostream],[], [AC_MSG_FAILURE([The standard <iostream> header file could not be found.])]) AC_CHECK_HEADER([cstdlib],[], [AC_MSG_FAILURE([The standard <cstdlib> header file could not be found.])]) AC_CHECK_HEADER([vector],[], [AC_MSG_FAILURE([The standard <vector> header file could not be found.])]) AC_CHECK_HEADER([algorithm],[], [AC_MSG_FAILURE([The standard <algorithm> header file could not be found.])]) AC_CHECK_HEADER([string.h],[], [AC_MSG_FAILURE([The standard <string.h> header file could not be found.])])
Finally, we provide optional unit tests to ensure the program is working. They may be compiled or not:
dnl Conditional builds AC_ARG_ENABLE(tests,[ --enable-unit-tests compile unit tests.])