Next: , Previous: Initial import, Up: Invoking gnulib-tool


2.2 Modified imports

You can at any moment decide to use Gnulib differently than the last time.

If you only want to use more Gnulib modules, simply invoke gnulib-tool --import new-modules. gnulib-tool remembers which modules were used last time. The list of modules that you pass after ‘--import’ is added to the previous list of modules.

For most changes, such as added or removed modules, or even different choices of ‘--lib’, ‘--source-base’ or ‘--aux-dir’, there are two ways to perform the change.

The standard way is to modify manually the file gnulib-cache.m4 in the M4 macros directory, then launch ‘gnulib-tool --import’.

The other way is to call gnulib-tool again, with the changed command-line options. Note that this doesn't let you remove modules, because as you just learned, the list of modules is always cumulated. Also this way is often impractical, because you don't remember the way you invoked gnulib-tool last time.

The only change for which this doesn't work is a change of the ‘--m4-base’ directory. Because, when you pass a different value of ‘--m4-base’, gnulib-tool will not find the previous gnulib-cache.m4 file any more... A possible solution is to manually copy the gnulib-cache.m4 into the new M4 macro directory.

In the gnulib-cache.m4, the macros have the following meaning:

gl_MODULES
The argument is a space separated list of the requested modules, not including dependencies.
gl_AVOID
The argument is a space separated list of modules that should not be used, even if they occur as dependencies. Corresponds to the ‘--avoid’ command line argument.
gl_SOURCE_BASE
The argument is the relative file name of the directory containing the gnulib source files (mostly *.c and *.h files). Corresponds to the ‘--source-base’ command line argument.
gl_M4_BASE
The argument is the relative file name of the directory containing the gnulib M4 macros (*.m4 files). Corresponds to the ‘--m4-base’ command line argument.
gl_TESTS_BASE
The argument is the relative file name of the directory containing the gnulib unit test files. Corresponds to the ‘--tests-base’ command line argument.
gl_LIB
The argument is the name of the library to be created. Corresponds to the ‘--lib’ command line argument.
gl_LGPL
The presence of this macro without arguments corresponds to the ‘--lgpl’ command line argument. The presence of this macro with an argument (whose value must be 2 or 3) corresponds to the ‘--lgpl=arg’ command line argument.
gl_LIBTOOL
The presence of this macro corresponds to the ‘--libtool’ command line argument and to the absence of the ‘--no-libtool’ command line argument. It takes no arguments.
gl_MACRO_PREFIX
The argument is the prefix to use for macros in the gnulib-comp.m4 file. Corresponds to the ‘--macro-prefix’ command line argument.