tlbuild: Adding a new generic library module

 
 6.6.2 Adding a new generic library module
 -----------------------------------------
 
 A generic library module in a subdirectory 'libs/LIB' must not depend on
 TeX-specific libraries, by definition.  It is included by adding its
 name 'LIB' to the M4 macro 'kpse_libs_pkgs' in 'm4/kpse-pkgs.m4'--before
 any other libraries from the TeX Live tree on which it depends.
 
    As with program modules, the subdirectory 'libs/LIB' must contain the
 sources and build system for the library (and any installable support
 programs) and a fragment 'ac/withenable.ac' that contains the M4 macro
 'KPSE_WITH_LIB' defined in 'm4/kpse-setup.m4' with 'LIB' as the
 mandatory first argument and two optional arguments: a list of required
 libraries from the TL tree, and a list of options: for libraries,
 currently there is only one--specify 'tree' if this library cannot be
 replaced by a system version.
 
    If a system version can be used, a second fragment 'ac/LIB.ac' is
 needed, containing the M4 macro 'KPSE_TRY_LIB' (or 'KPSE_TRY_LIBXX')
 with 'LIB' as the mandatory first argument and two additional arguments
 for the Autoconf macro 'AC_LANG_PROGRAM' used to compile and link a
 small C (or C++) program as sanity check for using the system library.
 
    In addition a file 'm4/kpse-LIB-flags' (at the top level) must define
 the M4 macro 'KPSE_LIB_FLAGS' (all uppercase) setting up the 'make'
 variables 'LIB_INCLUDES', 'LIB_LIBS', 'LIB_DEPEND', and 'LIB_RULE' with
 the values required for 'CPPFLAGS', 'LDADD', dependencies, and a
 (multi-line) 'make' rule to rebuild the library when necessary.  All of
 that is needed for the library from the TL tree and, if supported, for a
 system version.
 
    If a system library is allowed, 'KPSE_LIB_FLAGS' also provides the
 configure option '--with-system-LIB' and uses the additional M4 macro
 'KPSE_LIB_SYSTEM_FLAGS' to generate the 'make' variables for a system
 library.  In addition, the definition of the M4 macro
 'KPSE_ALL_SYSTEM_FLAGS' in 'm4/kpse-pkgs.m4' must be extended by the
 line:
    'AC_REQUIRE([KPSE_LIB_SYSTEM_FLAGS])'