Next: , Up: Other Autoconf macros   [Contents][Index]

15.1 Macros supplied with Automake

AM_INIT_AUTOMAKE([OPTIONS])

Runs many macros required for proper operation of the generated Makefiles.

AM_INIT_AUTOMAKE is called with a single argument: a space-separated list of Automake options that should be applied to every Makefile.am in the tree. The effect is as if each option were listed in AUTOMAKE_OPTIONS (see Automake options).

By default this macro AC_DEFINE’s PACKAGE and VERSION. This can be avoided by passing the no-define option (see List of Automake options):

AM_INIT_AUTOMAKE([no-define ...])

AM_INIT_AUTOMAKE can also be called in another, deprecated form: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]). In this form, there are two required arguments: the package and the version number. This usage is mostly obsolete because the package and version can be obtained from Autoconf’s AC_INIT macro. However, differently from what happens for AC_INIT invocations, this AM_INIT_AUTOMAKE invocation supports shell variables’ expansions in the PACKAGE and VERSION arguments (which otherwise defaults, respectively, to the PACKAGE_TARNAME and PACKAGE_VERSION defined via the AC_INIT invocation; see AC_INIT); and this can be still be useful in some selected situations. Our hope is that future Autoconf versions will improve their support for package versions defined dynamically at configure runtime; when (and if) this happens, support for the two-args AM_INIT_AUTOMAKE invocation will likely be removed from Automake.

If your configure.ac has:

AC_INIT([src/foo.c])
AM_INIT_AUTOMAKE([mumble], [1.5])

you should modernize it as follows:

AC_INIT([mumble], [1.5])
AC_CONFIG_SRCDIR([src/foo.c])
AM_INIT_AUTOMAKE

Note that if you’re upgrading your configure.ac from an earlier version of Automake, it is not always correct to simply move the package and version arguments from AM_INIT_AUTOMAKE directly to AC_INIT, as in the example above. The first argument to AC_INIT should be the name of your package (e.g., ‘GNU Automake’), not the tarball name (e.g., ‘automake’) that you used to pass to AM_INIT_AUTOMAKE. Autoconf tries to derive a tarball name from the package name, which should work for most but not all package names. (If it doesn’t work for yours, you can use the four-argument form of AC_INIT to provide the tarball name explicitly).

AM_PATH_LISPDIR

Searches for the program emacs, and, if found, sets the output variable lispdir to the full path to Emacs’ site-lisp directory.

Note that this test assumes the emacs found to be a version that supports Emacs Lisp (such as GNU Emacs or XEmacs). Other emacsen can cause this test to hang (some, like old versions of MicroEmacs, start up in interactive mode, requiring C-x C-c to exit, which is hardly obvious for a non-emacs user). In most cases, however, you should be able to use C-c to kill the test. In order to avoid problems, you can set EMACS to “no” in the environment, or use the --with-lispdir option to configure to explicitly set the correct path (if you’re sure you have an emacs that supports Emacs Lisp).

AM_PROG_AR([act-if-fail])

You must use this macro when you use the archiver in your project, if you want support for unusual archivers such as Microsoft lib. The content of the optional argument is executed if the archiver interface is not recognized; the default action is to abort configure with an error message.

AM_PROG_AS

Use this macro when you have assembly code in your project. This will choose the assembler for you (by default the C compiler) and set CCAS, and will also set CCASFLAGS if required.

AM_PROG_CC_C_O

This is an obsolescent macro that checks that the C compiler supports the -c and -o options together. Note that, since Automake 1.14, the AC_PROG_CC is rewritten to implement such checks itself, and thus the explicit use of AM_PROG_CC_C_O should no longer be required.

AM_PROG_LEX

Like AC_PROG_LEX (see Particular Programs), but uses the missing script on systems that do not have lex. HP-UX 10 is one such system.

AM_PROG_GCJ

This macro finds the gcj program or causes an error. It sets GCJ and GCJFLAGS. gcj is the Java front-end to the GNU Compiler Collection.

AM_PROG_UPC([compiler-search-list])

Find a compiler for Unified Parallel C and define the UPC variable. The default compiler-search-list is ‘upcc upc’. This macro will abort configure if no Unified Parallel C compiler is found.

AM_MISSING_PROG(name, program)

Find a maintainer tool program and define the name environment variable with its location. If program is not detected, then name will instead invoke the missing script, in order to give useful advice to the user about the missing maintainer tool. See maintainer-mode for more information on when the missing script is appropriate.

AM_SILENT_RULES

Control the machinery for less verbose build output (see Automake Silent Rules).

AM_WITH_DMALLOC

Add support for the Dmalloc package. If the user runs configure with --with-dmalloc, then define WITH_DMALLOC and add -ldmalloc to LIBS.

You should not use the next macro in new code, as it will be removed in some future Automake version, so you should consider updating your configure.ac to avoid problems in the future.

AM_PROG_MKDIR_P

From Automake 1.8 to 1.9.6 this macro used to define the output variable mkdir_p to one of mkdir -p, install-sh -d, or mkinstalldirs.

Nowadays Autoconf provides a similar functionality with AC_PROG_MKDIR_P (see Particular Programs), however this defines the output variable MKDIR_P instead. In case you are still using the AM_PROG_MKDIR_P macro in your configure.ac, or its provided variable $(mkdir_p) in your Makefile.am, you are advised to switch ASAP to the more modern Autoconf-provided interface instead; both the macro and the variable might be removed in a future major Automake release.

Next: , Up: Other Autoconf macros   [Contents][Index]