4 Invoking libtool

The libtool program has the following synopsis:

libtool [option]... [mode-arg]...

and accepts the following options:

--config

Display libtool configuration variables and exit.

--debug

Dump a trace of shell script execution to standard output. This produces a lot of output, so you may wish to pipe it to less (or more) or redirect to a file.

-n
--dry-run

Don’t create, modify, or delete any files, just show what commands would be executed by libtool.

--features

Display basic configuration options. This provides a way for packages to determine whether shared or static libraries will be built.

--finish

Same as --mode=finish.

-h

Display short help message.

--help

Display a help message and exit. If --mode=mode is specified, then detailed help for mode is displayed.

--help-all

Display help for the general options as well as detailed help for each operation mode, and exit.

--mode=mode

Use mode as the operation mode. When using libtool from the command line, you can give just mode (or a unique abbreviation of it) as the first argument as a shorthand for the full --mode=mode. For example, the following are equivalent:

$ libtool --mode=execute --dry-run gdb prog.exe
$ libtool        execute --dry-run gdb prog.exe
$ libtool        exe     --dry-run gdb prog.exe
$ libtool        e       --dry-run gdb prog.exe

mode must be set to one of the following:

compile

Compile a source file into a libtool object.

execute

Automatically set the library path so that another program can use uninstalled libtool-generated programs or libraries.

link

Create a library or an executable.

install

Install libraries or executables.

finish

Complete the installation of libtool libraries on the system.

uninstall

Delete installed libraries or executables.

clean

Delete uninstalled libraries or executables.

--tag=tag

Use configuration variables from tag tag (see Tags).

--preserve-dup-deps

Do not remove duplicate dependencies in libraries. When building packages with static libraries, the libraries may depend circularly on each other (shared libs can too, but for those it doesn’t matter), so there are situations, where -la -lb -la is required, and the second -la may not be stripped or the link will fail. In cases where these duplications are required, this option will preserve them, only stripping the libraries that libtool knows it can safely.

--no-finish

Do not execute finish_cmds (disabled by default). This option is for specifying that testing of local changes to shared libraries is being performed so that ldconfig will not alter the shared library cache, which is an issue observed on OpenBSD 7.5. This option should be combined with the usage of --mode=install and --mode=finish to have any effect. Prior to utilizing this option, the shared library cache must not contain links to the listed install directory for shared libraries undergoing testing; otherwise, it will have no useful effect. In OpenBSD, the shared library cache can be reordered to prefer directories for testing shared libraries over the directories already listed in the shared library cache with --reorder-cache=shared_lib_dirs.

--reorder-cache=shared_lib_dirs

Reorder the shared library cache by providing the preferred directories (shared_lib_dirs) to link shared libraries from. The previous shared library cache is unconfigured, and the preferred directories are configured with the previous directories appended to the end (if not in the preferred directory list)5. This option is currently only available on OpenBSD where make install has been required before make check for the shared library cache to be updated.

This option is essentially a wrapper for executing ldconfig, and it should be used as an independent option before and after testing changes to shared libraries. Below are some usage examples:

$ libtool --reorder-cache=/tmp/testing
Original: /usr/lib /usr/X11R6/lib /usr/local/lib
Reordered: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
$ libtool --reorder-cache=/usr/lib:/usr/X11R6/lib:/usr/local/lib
Original: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib /tmp/testing
$ libtool --reorder-cache=/tmp/testing
Original: /usr/lib /usr/X11R6/lib /usr/local/lib
Reordered: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
$ rm -rf /tmp/testing
$ libtool --reorder-cache=/usr/lib:/usr/X11R6/lib:/usr/local/lib
Original: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib
$ libtool --reorder-cache=/tmp/testing:/usr/local/lib:/home/user/dir
Original: /usr/lib /usr/X11R6/lib /usr/local/lib
Reordered: /tmp/testing /usr/local/lib /home/user/dir /usr/lib /usr/X11R6/lib
$ libtool --reorder-cache=/usr/lib /usr/X11R6/lib /usr/local/lib
Original: /tmp/testing /usr/local/lib /home/user/dir /usr/lib /usr/X11R6/lib
Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib /tmp/testing /home/user/dir
--quiet
--silent

Do not print out any progress or informational messages.

-v
--verbose

Print out progress and informational messages (enabled by default), as well as additional messages not ordinarily seen by default.

--no-quiet
--no-silent

Print out the progress and informational messages that are seen by default. This option has no effect on whether the additional messages seen in --verbose mode are shown.

--no-verbose

Do not print out any additional informational messages beyond those ordinarily seen by default. This option has no effect on whether the ordinary progress and informational messages enabled by --no-quiet are shown.

Thus, there are now three different message levels (not counting --debug), depending on whether the normal messages and/or the additional verbose messages are displayed. Note that there is no mechanism to display verbose messages, without also displaying normal messages.

default

Normal messages are displayed, verbose messages are not displayed. In addition to being the default mode, it can be forcibly achieved by using both option --no-verbose and either option --no-silent or option --no-quiet.

silent

Neither normal messages nor verbose messages are displayed. This mode can be achieved using either option --silent or option --quiet.

verbose

Both normal messages and verbose messages are displayed. This mode can be achieved using either option -v or option --verbose.

--version

Print libtool version information and exit.

-W
--warnings=CATEGORY

Report the warnings falling in category CATEGORY. The default category is all. To disable warnings, use the category none.

The current libtool implementation is done with a shell script that needs to be invoked by the shell that configure chose for configuring libtool (see config.status Invocation in The Autoconf Manual). This shell is set in the she-bang (‘#!’) line of the libtool script. Using a different shell may cause undefined behavior.

The mode-args are a variable number of arguments, depending on the selected operation mode. In general, each mode-arg is interpreted by programs libtool invokes, rather than libtool itself.


Footnotes

(5)

Additionally, all directories that no longer exist will be removed from the shared library cache.