Next: , Previous: , Up: aclocal Invocation   [Contents][Index]

8.7.2 Macro Search Path

By default, aclocal searches for .m4 files in the following directories, in this order:

acdir

This directory is intended for third party .m4 files, and is configured when automake itself is built. This is @datadir@/aclocal/, which typically expands to ${prefix}/share/aclocal/. To find the compiled-in value of acdir, use the --print-ac-dir option (see aclocal Options).

acdir-APIVERSION

This is where the .m4 macros distributed with Automake itself are stored. APIVERSION depends on the Automake release used; for example, for Automake 1.11.x, APIVERSION = 1.11.

As an example, suppose that automake-1.11.2 was configured with --prefix=/usr/local. Then, the search path would be:

  1. /usr/local/share/aclocal/
  2. /usr/local/share/aclocal-1.11.2/

The paths for the acdir and acdir-APIVERSION directories can be changed respectively through aclocal options --system-acdir and --automake-acdir (see aclocal Options). Note however that these options are only intended for use by the internal Automake test suite, or for debugging under highly unusual situations; they are not ordinarily needed by end-users.

As explained in (see aclocal Options), there are several options that can be used to change or extend this search path.

Modifying the Macro Search Path: ‘-I dir

Any extra directories specified using -I options (see aclocal Options) are prepended to this search list. Thus, ‘aclocal -I /foo -I /bar’ results in the following search path:

  1. /foo
  2. /bar
  3. acdir
  4. acdir-APIVERSION

Modifying the Macro Search Path: dirlist

There is a third mechanism for customizing the search path. If a dirlist file exists in acdir, then that file is assumed to contain a list of directory patterns, one per line. aclocal expands these patterns to directory names, and adds them to the search list after all other directories. dirlist entries may use shell wildcards such as ‘*’, ‘?’, or [...].

For example, suppose acdir/dirlist contains the following:

/test1
/test2
/test3*

and that aclocal was called with the ‘-I /foo -I /bar’ options. Then, the search path would be

  1. /foo
  2. /bar
  3. acdir
  4. /test1
  5. /test2
  6. acdir-APIVERSION

and all directories with path names starting with /test3.

If the --system-acdir=dir option is used, then aclocal will search for the dirlist file in dir; but remember the warnings above against the use of --system-acdir.

dirlist is useful in the following situation: suppose that automake version 1.11.2 is installed with ‘--prefix=/usr’ by the system vendor. Thus, the default search directories are

  1. /usr/share/aclocal/
  2. /usr/share/aclocal-1.11/

However, suppose further that many packages have been manually installed on the system, with ${prefix}=/usr/local, as is typical. In that case, many of these “extra” .m4 files are in /usr/local/share/aclocal. A way to force /usr/bin/aclocal to find these “extra” .m4 files is to export ACLOCAL_PATH to ‘/usr/local/share/aclocal’. This is a little inconvenient, since it requires either explicit user cooperation, or editing of the system global shell initialization file. With dirlist, one may create a file /usr/share/aclocal/dirlist containing only the single line

/usr/local/share/aclocal

Now, the “default” search path on the affected system is

  1. /usr/share/aclocal/
  2. /usr/local/share/aclocal/
  3. /usr/share/aclocal-1.11/

without the need of any explicit ACLOCAL_PATH setting.

Similarly, dirlist can be handy if you have installed a local copy of Automake in your account and want aclocal to look for macros installed at other places on the system.

Modifying the Macro Search Path: ACLOCAL_PATH

The fourth and last mechanism to customize the macro search path is also the simplest. Any directory included in the colon-separated environment variable ACLOCAL_PATH is added to the search path and takes precedence over system directories (including those found via dirlist), with the exception of the versioned directory acdir-APIVERSION (see Macro Search Path). However, directories passed via -I will take precedence over directories in ACLOCAL_PATH.

Also note that, if the --install option is used, any .m4 file containing a required macro that is found in a directory listed in ACLOCAL_PATH will be installed locally. In this case, serial numbers in .m4 are honored too, see Serials.

Conversely to dirlist, ACLOCAL_PATH is useful if you are using a global copy of Automake and want aclocal to look for macros somewhere under your home directory.

Next: , Previous: , Up: aclocal Invocation   [Contents][Index]