Update: I converted this post in a new GnomeGoal, see here
Update 2: Added some more tips
Autotools is the most common system to build programs in GTK+/GNOME projects.
Remove deprecated macros for our configure.ac file and use the new syntax will do our build system more legible and portable
The Autotools comes with a program to make the work for us, simply run
autoupdate
in you source tree and you have a new updated configure.ac. (Checks the result for possibles errors)
Some more tips:
- Respect the standard configure.ac layout
- Try to avoid the use of AM_MAINTAINER_MODE. AM_MAINTAINER_MODE (called like that) disables dependency-checking for autotools-generated stuff. AM_MAINTAINER_MODE([enabled]) retains the default behavior, but lets users pass a configure option to disable the dependency checking. So, if you really need this macro, use AM_MAINTAINER_MODE([enabled]). See the automake manual for a extended explanation
- Use all the parameters of AC_INIT() (for the fifth parameter you need autoconf >= 2.64):
AC_INIT([Glom],[1.13.2],[http://bugzilla.gnome.org/enter_bug.cgi?product=Glom],[glom],[http://www.glom.org/])
- Use updated versions of the programs (all of these versions (and newer) are present in Debian stable):
- automake >= 1.11.1 (AM_INIT_AUTOMAKE([1.11.1])) (or 1.10.3, Automake < 1.10.3 and 1.11 are known to be suffering from critical security issues)
- autoconf >= 2.64 (AC_PREREQ(2.64))
- libtool >= 2.2.6 (LT_PREREQ([2.2.6]))
- intltool >= 0.40.0 (IT_PROG_INTLTOOL([0.40.0]))
- Take a look to all AM_INIT_AUTOMAKE() posible parameters. For example, to use 1.11.1 automake version and generate bzip2 distribution tarballs in addition to the gzip’ed:
AM_INIT_AUTOMAKE([1.11.1 dist-bzip2])
- Use LT_INIT() syntax for libtool (needs libtool >= 2.2.0). More info about LT_INIT(). For example, change this:
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AM_PROG_LIBTOOL
For this:
LT_PREREQ([2.2.6])
LT_INIT([dlopen win32-dll disable-static])
- Don’t use GNOME_COMMON_INIT, as it does not work with autoreconf. Simply add this to your Makefile.am. (You have to define the macros dir in your configure.ac, in this case: AC_CONFIG_MACRO_DIR([m4]))
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
- Use gnome-common macros for compile warnings macros instead custom ones. Also use GNOME_MAINTAINER_MODE_DEFINES to get warnings when using deprecated symbols:
GNOME_COMPILE_WARNINGS([maximum])
GNOME_CXX_WARNINGS([yes])
GNOME_MAINTAINER_MODE_DEFINES
Other tips
Feel free to suggest more tips in the comments!
Some documentation: