Next: , Previous: Autoconf Background, Up: Autoconf Support


12.2 Autoconf Macros

The macro names all begin with "GUILE_".

12.2.1 Program Detection

— Autoconf Macro: GUILE_PROGS

Look for programs guile, guile-config and guile-tools, and set variables GUILE, GUILE_CONFIG and GUILE_TOOLS, to their paths, respectively. If either of the first two is not found, signal error.

Mark the variables for substitution, as by AC_SUBST.

12.2.2 Compilation Flags Reporting

— Autoconf Macro: GUILE_FLAGS

Run the guile-config script, installed with Guile, to find out where Guile's header files and libraries are installed. Set 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.

Mark the variables for substitution, as by AC_SUBST.

12.2.3 Installation Directories

— Autoconf Macro: GUILE_SITE_DIR

Look for Guile's "site" directory, usually something like PREFIX/share/guile/site, and set var GUILE_SITE to the path. Note that PREFIX is that of Guile, which may or may not coincide with the one specified by configure --prefix. Note also that the var name is different from the macro name.

Mark the variable for substitution, as by AC_SUBST.

— Autoconf Macro: GUILE_LIBSITE_DIR

Look for Guile's "library site" directory, usually something like PREFIX/lib/guile/site, and set var GUILE_LIBSITE to the path. Note that PREFIX is that of Guile, which may or may not coincide with the one specified by configure --prefix. Note also that the var name is different from the macro name.

Mark the variable for substitution, as by AC_SUBST.

12.2.4 General Feature Checks

— Autoconf Macro: GUILE_CHECK var check

Set var to the numeric return value of evaluating check. var is a shell variable name to be set to the return value.

check is one or more Guile Scheme expression, evaluated with "$GUILE -c", the last of which should return either 0 or non-#f to indicate the check passed. Non-0 number or #f indicates failure. This is conventionally achieved by wrapping the last expression in exit. For example, (foo) (bar) (exit (baz)).

Avoid using the character "#" since that confuses autoconf.

— Autoconf Macro: GUILE_PROVIDEDP var feature

Set var based on whether or not feature is provided?. var is a shell variable name to be set to "yes" or "no". feature is a symbol, like: posix.

12.2.5 Scheme Module Checks

— Autoconf Macro: GUILE_MODULE_CHECK var module featuretest description

Set var based on whether or not module supports featuretest. 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).

— Autoconf Macro: GUILE_MODULE_AVAILABLE var module

Set var based on whether or not module can be found. var is a shell variable name to be set to "yes" or "no". module is a list of symbols, like: (ice-9 common-list).

— Autoconf Macro: GUILE_MODULE_REQUIRED symlist

Check that the module named by symlist is available. If not, fail. symlist is a list of symbols, WITHOUT surrounding parens, like: ice-9 common-list.

— Autoconf Macro: GUILE_MODULE_EXPORTS var module modvar

Set var based on whether or not module exports modvar. var is a shell variable to be set to "yes" or "no". module is a list of symbols, like: (ice-9 common-list). modvar is the Guile Scheme variable to check.

— Autoconf Macro: GUILE_MODULE_REQUIRED_EXPORT module modvar

Check if module exports modvar. If not, fail. module is a list of symbols, like: (ice-9 common-list). modvar is the Guile Scheme variable to check.

12.2.6 Miscellaneous

— Autoconf Macro: GUILE_CHECK_ICE9_OPTARGS var

Check if module (ice-9 optargs-kw) is available. If so, set shell var var to "no" (see why below). Otherwise, check if module (ice-9 optargs) acts like (ice-9 optargs-kw). If so, set var to "yes", otherwise set it to "no".

Mark the variable for substitution, as by AC_SUBST.

Some versions of Guile provide a module (ice-9 optargs) that acts like (ice-9 optargs-kw) (and subsequently omit the latter, instead of providing both). Code that uses (ice-9 optargs-kw) solely can be textually kludged to load (ice-9 optargs) in these situations if var has value "yes". Here is a Makefile.am fragment that demonstrates the technique:

          install-data-hook:
                  if test "$(need_optargs_kludge)" = yes ; then \
                     sed s/optargs-kw/optargs/ foo.scm > TMP ; \
                     mv TMP foo.scm ; \
                  fi

In this example, var is need_optargs_kludge. If it turns out (ice-9 optargs-kw) is available, need_optargs_kludge would have value "no", and the kludge would neither be required nor applied.

— Autoconf Macro: GUILE_MODULE_CATALOG_PREP [fragname]

Define two AC_CONFIG_COMMAND commands to manage the local module catalog.

module-catalog-prep
This command runs towards the tail end of a configure invocation. It does these actions:
  • Create a dependencies subdirectory named by the shell var DEPDIR, or ".deps" if not that var is not defined. This step is skipped if the directory already exists.
  • Create a dummy makefile fragment file in the dependencies directory named .Pmodule-catalog. This step is skipped if the file already exists. Optional arg FRAGNAME specifies another filename for the makefile fragment.
  • Append an include directive to ./Makefile. This step is skipped if the directive has already been appended.

module-catalog-clean-local
This command is intended to be run as an action in the Makefile.am target clean-local. It re-initializes the dependencies file (ie, FRAGNAME or .Pmodule-catalog in the deps dir). You still need to add the module catalog's name to the Makefile.am var CLEANFILES. For example:
               # fragment of top-level Makefile.am
               CLEANFILES = .module-catalog
               clean-local:
                       ./config.status module-catalog-clean-local

— Autoconf Macro: GUILE_TOOLS_PROG var program [notfound]

Set shell variable var to be the absolute filename of the guile-tools program if it exists, or to ":" otherwise. Optional third arg notfound is the value to use instead of ":".

Mark the variable for substitution, as by AC_SUBST.

— Autoconf Macro: GUILE_C2X_METHOD var

Set shell variable var to be either the absolute filename of the "guile-tools c2x" program, or "guile-snarf", preferring the former if it is available.

Mark the variable for substitution, as by AC_SUBST.

— Autoconf Macro: GUILE_MODSUP_H

Check for header <guile/modsup.h> using AC_CHECK_HEADERS. If found, define the cpp symbol HAVE_GUILE_MODSUP_H in config.h.