tlbuild: Macros for library and header flags
6.3.5 Macros for library and header flags
-----------------------------------------
Each library module 'libs/LIB' or 'texk/LIB' is supplemented by a macro
'KPSE_LIB_FLAGS' (all uppercase) that provides make variables for that
library. E.g., for 'libs/libpng':
-- Macro: KPSE_LIBPNG_FLAGS
Provide the configure option '--with-system-libpng'. Set and
'AC_SUBST' 'make' variables for modules using this library (either
an installed version or from the TeX Live tree):
'LIBPNG_INCLUDES' for use in 'CPPFLAGS',
'LIBPNG_LIBS' for use in 'LDADD',
'LIBPNG_DEPEND' for use as a Makefile dependency,
'LIBPNG_RULE' for the 'make' rules to rebuild the library.
-- Macro: KPSE_ADD_FLAGS (NAME)
Temporarily extend 'CPPFLAGS' and 'LIBS' with the values required
for the library module 'NAME'.
-- Macro: KPSE_RESTORE_FLAGS
Restore 'CPPFLAGS' and 'LIBS' to their original values.
As an example, the 'configure.ac' file for a hypothetical program
'utils/foo' using 'libpng', and hence 'zlib', would contain
KPSE_ZLIB_FLAGS
KPSE_LIBPNG_FLAGS
and its 'Makefile.am' would be along these lines:
bin_PROGRAMS = foo
AM_CPPFLAGS = ${LIBPNG_INCLUDES} ${ZLIB_INCLUDES}
foo_LDADD = ${LIBPNG_LIBS} ${ZLIB_LIBS}
foo_DEPENDENCIES = ${ZLIB_DEPEND} ${LIBPNG_DEPEND}
## Rebuild libz
@ZLIB_RULE@
## Rebuild libpng
@LIBPNG_RULE@
If it were necessary to examine whether certain 'zlib' or 'libpng'
features were available, 'configure.ac' should be continued this way:
KPSE_ADD_FLAGS([zlib])
... # tests for 'zlib' features, if any
KPSE_ADD_FLAGS([libpng])
... # tests for 'libpng' features
KPSE_RESTORE_FLAGS # restore 'CPPFLAGS' and 'LIBS'