*** empty log message ***
[bpt/guile.git] / guile-config / guile.m4
CommitLineData
d0001215
TTN
1dnl Autoconf macros for working with Guile.
2dnl
3dnl Copyright (C) 1998,2001 Free Software Foundation, Inc.
4dnl
2b9fe19f
JB
5dnl This program is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 2, or (at your option)
8dnl any later version.
d0001215 9dnl
2b9fe19f
JB
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
d0001215 14dnl
2b9fe19f
JB
15dnl You should have received a copy of the GNU General Public License
16dnl along with this software; see the file COPYING. If not, write to
17dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18dnl Boston, MA 02111-1307 USA
d0001215 19dnl
2b9fe19f
JB
20dnl As a special exception, the Free Software Foundation gives permission
21dnl for additional uses of the text contained in its release of GUILE.
d0001215 22dnl
2b9fe19f
JB
23dnl The exception is that, if you link the GUILE library with other files
24dnl to produce an executable, this does not by itself cause the
25dnl resulting executable to be covered by the GNU General Public License.
26dnl Your use of that executable is in no way restricted on account of
27dnl linking the GUILE library code into it.
d0001215 28dnl
2b9fe19f
JB
29dnl This exception does not however invalidate any other reasons why
30dnl the executable file might be covered by the GNU General Public License.
d0001215 31dnl
2b9fe19f
JB
32dnl This exception applies only to the code released by the
33dnl Free Software Foundation under the name GUILE. If you copy
34dnl code from other Free Software Foundation releases into a copy of
35dnl GUILE, as the General Public License permits, the exception does
36dnl not apply to the code that you add in this way. To avoid misleading
37dnl anyone as to the status of such modified files, you must delete
38dnl this exception notice from them.
d0001215 39dnl
2b9fe19f
JB
40dnl If you write modifications of your own for GUILE, it is your choice
41dnl whether to permit this exception to apply to your modifications.
42dnl If you do not wish that, delete this exception notice.
43
44
d0001215
TTN
45dnl INDEX
46dnl -----
47
48dnl GUILE_FLAGS --- set flags for compiling and linking with Guile
49dnl AC_GUILE_MODULE_CHECK --- check feature of a Guile Scheme module
50dnl AC_GUILE_MODULE_AVAILABLE --- check availability of a Guile Scheme module
51dnl AC_GUILE_MODULE_REQUIRED --- fail if a Guile Scheme module is unavailable
52
53
54dnl Code
55dnl ----
56
2b9fe19f 57dnl GUILE_FLAGS --- set flags for compiling and linking with Guile
d0001215 58dnl
2b9fe19f
JB
59dnl This macro runs the `guile-config' script, installed with Guile,
60dnl to find out where Guile's header files and libraries are
61dnl installed. It sets two variables, marked for substitution, as
62dnl by AC_SUBST.
63dnl
64dnl GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
65dnl code that uses Guile header files. This is almost
66dnl always just a -I flag.
67dnl
68dnl GUILE_LDFLAGS --- flags to pass to the linker to link a
69dnl program against Guile. This includes `-lguile' for
70dnl the Guile library itself, any libraries that Guile
71dnl itself requires (like -lqthreads), and so on. It may
72dnl also include a -L flag to tell the compiler where to
73dnl find the libraries.
74
75AC_DEFUN([GUILE_FLAGS],[
76## The GUILE_FLAGS macro.
77 ## First, let's just see if we can find Guile at all.
78 AC_MSG_CHECKING(for Guile)
79 guile-config link > /dev/null || {
80 echo "configure: cannot find guile-config; is Guile installed?" 1>&2
81 exit 1
82 }
83 GUILE_CFLAGS="`guile-config compile`"
84 GUILE_LDFLAGS="`guile-config link`"
85 AC_SUBST(GUILE_CFLAGS)
86 AC_SUBST(GUILE_LDFLAGS)
87 AC_MSG_RESULT(yes)
88])
d0001215
TTN
89
90
91dnl AC_GUILE_MODULE_CHECK --- check feature of a Guile Scheme module
92dnl
93dnl AC_GUILE_MODULE_CHECK(var,module,featuretest,description)
94dnl $1 is a shell variable name to be set to "yes" or "no"
95dnl $2 is a list of symbols, like: (ice-9 common-list)
96dnl $3 is a thunk, like: (lambda () BODY ...)
97dnl which returns either 0 or #t to indicate the check passed.
98dnl avoid using the character "#" since that confuses autoconf.
99dnl $4 is a noun phrase passed to AC_MSG_CHECKING
100
101AC_DEFUN([AC_GUILE_MODULE_CHECK],
102 [AC_MSG_CHECKING([$2 $4])
103 $1=no
104 echo '(use-modules $2) (exit ($3))' > conftest
105 guile -s conftest > /dev/null 2>&1 && $1=yes
106 rm -f conftest
107 AC_MSG_RESULT($[$1])
108 ])
109
110dnl AC_GUILE_MODULE_AVAILABLE --- check availability of a Guile Scheme module
111dnl
112dnl AC_GUILE_MODULE_AVAILABLE(var,module)
113dnl $1 is a shell variable name to be set to "yes" or "no"
114dnl $2 is a list of symbols, like: (ice-9 common-list)
115
116AC_DEFUN([AC_GUILE_MODULE_AVAILABLE],
117 [AC_GUILE_MODULE_CHECK($1,$2,(lambda () 0),availability)
118 ])
119
120dnl AC_GUILE_MODULE_REQUIRED --- fail if a Guile Scheme module is unavailable
121dnl
122dnl $1 is a list of symbols, WITHOUT the surrounding parens
123
124AC_DEFUN([AC_GUILE_MODULE_REQUIRED],
125 [AC_GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1))
126 if test "$ac_guile_module_required" = "no" ; then
127 AC_MSG_ERROR([required guile module not found: ($1)])
128 fi
129 ])
130
131
132dnl guile.m4 ends here