GNU Guile provides a pkg-config description file, installed as
prefix/lib/pkgconfig/guile-1.8.pc, which contains all the
information necessary to compile and link C applications that use Guile.
The pkg-config
program is able to read this file and provide this
information to application programmers; it can be obtained at
http://pkg-config.freedesktop.org/.
The following command lines give respectively the C compilation and link flags needed to build Guile-using programs:
pkg-config guile-1.8 --cflags pkg-config guile-1.8 --libs
To ease use of pkg-config with Autoconf, pkg-config comes with a
convenient Autoconf macro. The following example looks for Guile and
sets the GUILE_CFLAGS
and GUILE_LIBS
variables
accordingly, or prints an error and exits if Guile was not found:
PKG_CHECK_MODULES([GUILE], [guile-1.8])
Guile comes with additional Autoconf macros providing more information,
installed as prefix/share/aclocal/guile.m4. Their names
all begin with GUILE_
.
This macro looks for programs
guile
,guile-config
andguile-tools
, and sets variables GUILE, GUILE_CONFIG and GUILE_TOOLS, to their paths, respectively. If either of the first two is not found, signal error.The variables are marked for substitution, as by
AC_SUBST
.
This macro runs the
guile-config
script, installed with Guile, to find out where Guile's header files and libraries are installed. It sets two variables, GUILE_CFLAGS and GUILE_LDFLAGS.GUILE_CFLAGS: flags to pass to a C or C++ compiler to build code that uses Guile header files. This is almost always just a
-I
flag.GUILE_LDFLAGS: flags to pass to the linker to link a program against Guile. This includes
-lguile
for the Guile library itself, any libraries that Guile itself requires (like -lqthreads), and so on. It may also include a-L
flag to tell the compiler where to find the libraries.The variables are marked for substitution, as by
AC_SUBST
.
This looks for Guile's "site" directory, usually something like PREFIX/share/guile/site, and sets var GUILE_SITE to the path. Note that the var name is different from the macro name.
The variable is marked for substitution, as by
AC_SUBST
.
var is a shell variable name to be set to the return value. check is a Guile Scheme expression, evaluated with "$GUILE -c", and returning either 0 or non-#f to indicate the check passed. Non-0 number or #f indicates failure. Avoid using the character "#" since that confuses autoconf.
var is a shell variable name to be set to "yes" or "no". module is a list of symbols, like: (ice-9 common-list). featuretest is an expression acceptable to GUILE_CHECK, q.v. description is a present-tense verb phrase (passed to AC_MSG_CHECKING).
var is a shell variable name to be set to "yes" or "no". module is a list of symbols, like: (ice-9 common-list).
symlist is a list of symbols, WITHOUT surrounding parens, like: ice-9 common-list.