+dnl GUILE_FLAGS --- set flags for compiling and linking with Guile
+dnl
+dnl This macro runs the `guile-config' script, installed with Guile,
+dnl to find out where Guile's header files and libraries are
+dnl installed. It sets two variables, marked for substitution, as
+dnl by AC_SUBST.
+dnl
+dnl GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
+dnl code that uses Guile header files. This is almost
+dnl always just a -I flag.
+dnl
+dnl GUILE_LDFLAGS --- flags to pass to the linker to link a
+dnl program against Guile. This includes `-lguile' for
+dnl the Guile library itself, any libraries that Guile
+dnl itself requires (like -lqthreads), and so on. It may
+dnl also include a -L flag to tell the compiler where to
+dnl find the libraries.
+
+AC_DEFUN([GUILE_FLAGS],[
+## The GUILE_FLAGS macro.
+ AC_MSG_CHECKING(for Guile)
+ if ! $guile_config link > /dev/null ; then
+ AC_MSG_RESULT("cannot execute $guile_config")
+ AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
+ exit 1
+ fi
+ GUILE_CFLAGS="`$guile_config compile`"
+ GUILE_LDFLAGS="`$guile_config link`"
+ AC_SUBST(GUILE_CFLAGS)
+ AC_SUBST(GUILE_LDFLAGS)
+ AC_MSG_RESULT(yes)
+])
+