Next: Makefile rules, Up: Integrating 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:
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:
‘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:
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:
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.
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:
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.
Define the preprocessor symbol ‘LTDL_DLOPEN_DEPLIBS’ if the os needs help to load dependent libraries for ‘dlopen’ (or equivalent).
Define the preprocessor symbol ‘LT_DLSEARCH_PATH’ to the system default library search path.
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’.