Next: , Up: Integrating libtool


5.1 Autoconf macros exported by libtool

Libtool uses a number of macros to interrogate the host system when it is being built, and you can use some of them yourself too. Although there are a great many other macros in the libtool installed m4 files, these do not form part of the published interface, and are subject to change between releases.

Macros in the ‘LT_CMD_’ namespace check for various shell commands:

— Macro: LT_CMD_MAX_LEN

Finds the longest command line that can be safely passed to ‘$SHELL’ without being truncated, and store in the shell variable ‘$max_cmd_len’. It is only an approximate value, but command lines of this length or shorter are guaranteed not to be truncated.

Macros in the ‘LT_FUNC_’ namespace check characteristics of library functions:

— Macro: LT_FUNC_DLSYM_USCORE

AC_DEFINE’ the preprocessor symbol ‘DLSYM_USCORE’ if we have to add an underscore to symbol-names passed in to ‘dlsym’.

Macros in the ‘LT_LIB_’ namespace check characteristics of system libraries:

— Macro: LT_LIB_M

Set ‘LIBM’ to the math library or libraries required on this machine, if any.

— Macro: LT_LIB_DLLOAD

This is the macro used by ‘libltdl’ to determine which dlloaders to use on this machine, if any. Several shell variables are set (and ‘AC_SUBST’ed) depending on the dlload interfaces are available on this machine. ‘LT_DLLOADERS’ contains a list of libtool libraries that can be used, and if necessary also sets ‘LIBADD_DLOPEN’ if additional system libraries are required by the ‘dlopen’ loader, and ‘LIBADD_SHL_LOAD’ if additional system libraries are required by the ‘shl_load’ loader, respectively. Finally some symbols are set in config.h depending on the loaders that are found to work: ‘HAVE_LIBDL’, ‘HAVE_SHL_LOAD’, ‘HAVE_DYLD’, ‘HAVE_DLD’.

Macros in the ‘LT_PATH_’ namespace search the system for the full path to particular system commands:

— Macro: LT_PATH_LD

Add a --with-gnu-ld option to configure. Try to find the path to the linker used by ‘$CC’, and whether it is the GNU linker. The result is stored in the shell variable ‘$LD’, which is AC_SUBSTed.

— Macro: LT_PATH_NM

Try to find a BSD-compatible nm or a MS-compatible dumpbin command on this machine. The result is stored in the shell variable ‘$NM’, which is AC_SUBSTed.

Macros in the ‘LT_SYS_’ namespace probe for system characteristics:

— Macro: LT_SYS_DLOPEN_SELF

Tests whether a program can dlopen itself, and then also whether the same program can still dlopen itself when statically linked. Results are stored in the shell variables ‘$enable_dlopen_self’ and ‘enable_dlopen_self_static’ respectively.

— Macro: LT_SYS_DLOPEN_DEPLIBS

Define the preprocessor symbol ‘LTDL_DLOPEN_DEPLIBS’ if the OS needs help to load dependent libraries for ‘dlopen’ (or equivalent).

— Macro: LT_SYS_DLSEARCH_PATH

Define the preprocessor symbol ‘LT_DLSEARCH_PATH’ to the system default library search path.

— Macro: LT_SYS_MODULE_EXT

Define the preprocessor symbol ‘LT_MODULE_EXT’ to the extension used for runtime loadable modules. If you use libltdl to open modules, then you can simply use the libtool library extension, .la.

— Macro: LT_SYS_MODULE_PATH

Define the preprocessor symbol ‘LT_MODULE_PATH_VAR’ to the name of the shell environment variable that determines the run-time module search path.

— Macro: LT_SYS_SYMBOL_USCORE

Set the shell variable ‘sys_symbol_underscore’ to ‘no’ unless the compiler prefixes global symbols with an underscore.