2 # Copyright (c) 1998 Etienne Bernard
3 # Copyright (c) 2002 Clinton Ebadi
6 # Check if we have a decent C++ compiler
7 # that supports Standard Template Library (STL)
10 AC_MSG_CHECKING([for STL support])
12 AC_CACHE_VAL(ac_cv_cpp_stl,
15 cat > conftest.$ac_ext <<EOF
24 if AC_TRY_EVAL(ac_link) && test -s conftest; then
25 ac_cv_cpp_stl="have_stl=yes"
27 ac_cv_cpp_stl="have_stl=no"
33 AC_MSG_RESULT([$have_stl])
35 if test "$have_stl" != "yes"; then
36 AC_MSG_ERROR([Sorry, you need STL support with your compiler])
41 # Check is compiler has ios_base
42 AC_DEFUN(AC_CPP_STL_IOSBASE,
44 AC_MSG_CHECKING([for std::ios_base in iostreams])
46 AC_CACHE_VAL(ac_cv_cpp_iosbase,
49 cat > conftest.$ac_ext <<EOF
53 std::ifstream file ("README", std::ios_base::in);
58 if AC_TRY_EVAL(ac_link) && test -s conftest; then
59 ac_cv_cpp_iosbase="have_iosbase=yes"
61 ac_cv_cpp_iosbase="have_iosbase=no"
65 eval "$ac_cv_cpp_iosbase"
67 AC_MSG_RESULT([$have_iosbase])
69 if test "$have_iosbase" = "yes"; then
70 HAVE_IOSBASE="-DHAVE_IOSBASE"
71 AC_DEFINE(HAVE_IOSBASE,1, [std::ios_base])
73 AC_DEFINE(HAVE_IOSBASE,0)
77 # Check if STL elements support the clear() method
78 AC_DEFUN(AC_CPP_STL_CLEAR,
80 AC_MSG_CHECKING([for clear() method in STL objects])
82 AC_CACHE_VAL(ac_cv_cpp_stl_clear,
85 cat > conftest.$ac_ext <<EOF
88 std::map<int, int, std::less<int> > m;
94 if AC_TRY_EVAL(ac_link) && test -s conftest; then
95 ac_cv_cpp_stl_clear="have_stl_clear=yes"
97 ac_cv_cpp_stl_clear="have_stl_clear=no"
101 eval "$ac_cv_cpp_stl_clear"
103 AC_MSG_RESULT([$have_stl_clear])
105 if test "$have_stl_clear" = "yes"; then
106 HAVE_STL_CLEAR="-DHAVE_STL_CLEAR"
107 AC_DEFINE(HAVE_STL_CLEAR,1, [STL Objects have a clear method])
110 ## Autoconf macros for working with Guile.
112 ## Copyright (C) 1998,2001 Free Software Foundation, Inc.
114 ## This program is free software; you can redistribute it and/or modify
115 ## it under the terms of the GNU General Public License as published by
116 ## the Free Software Foundation; either version 2, or (at your option)
117 ## any later version.
119 ## This program is distributed in the hope that it will be useful,
120 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
121 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
122 ## GNU General Public License for more details.
124 ## You should have received a copy of the GNU General Public License
125 ## along with this software; see the file COPYING. If not, write to
126 ## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
127 ## Boston, MA 02110-1301 USA
129 ## As a special exception, the Free Software Foundation gives permission
130 ## for additional uses of the text contained in its release of GUILE.
132 ## The exception is that, if you link the GUILE library with other files
133 ## to produce an executable, this does not by itself cause the
134 ## resulting executable to be covered by the GNU General Public License.
135 ## Your use of that executable is in no way restricted on account of
136 ## linking the GUILE library code into it.
138 ## This exception does not however invalidate any other reasons why
139 ## the executable file might be covered by the GNU General Public License.
141 ## This exception applies only to the code released by the
142 ## Free Software Foundation under the name GUILE. If you copy
143 ## code from other Free Software Foundation releases into a copy of
144 ## GUILE, as the General Public License permits, the exception does
145 ## not apply to the code that you add in this way. To avoid misleading
146 ## anyone as to the status of such modified files, you must delete
147 ## this exception notice from them.
149 ## If you write modifications of your own for GUILE, it is your choice
150 ## whether to permit this exception to apply to your modifications.
151 ## If you do not wish that, delete this exception notice.
156 ## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
157 ## GUILE_FLAGS -- set flags for compiling and linking with Guile
158 ## GUILE_SITE_DIR -- find path to Guile "site" directory
159 ## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
160 ## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
161 ## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module
162 ## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable
163 ## GUILE_MODULE_EXPORTS -- check if a module exports a variable
164 ## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable
169 ## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged
170 ## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory).
172 # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
176 # This macro looks for programs @code{guile}, @code{guile-config} and
177 # @code{guile-tools}, and sets variables @var{GUILE}, @var{GUILE_CONFIG} and
178 # @var{GUILE_TOOLS}, to their paths, respectively. If either of the first two
179 # is not found, signal error.
181 # The variables are marked for substitution, as by @code{AC_SUBST}.
183 AC_DEFUN([GUILE_PROGS],
184 [AC_PATH_PROG(GUILE,guile)
185 if test "$GUILE" = "" ; then
186 AC_MSG_ERROR([guile required but not found])
189 AC_PATH_PROG(GUILE_CONFIG,guile-config)
190 if test "$GUILE_CONFIG" = "" ; then
191 AC_MSG_ERROR([guile-config required but not found])
193 AC_SUBST(GUILE_CONFIG)
194 AC_PATH_PROG(GUILE_TOOLS,guile-tools)
195 AC_SUBST(GUILE_TOOLS)
198 # GUILE_FLAGS -- set flags for compiling and linking with Guile
202 # This macro runs the @code{guile-config} script, installed with Guile, to
203 # find out where Guile's header files and libraries are installed. It sets
204 # two variables, @var{GUILE_CFLAGS} and @var{GUILE_LDFLAGS}.
206 # @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that
207 # uses Guile header files. This is almost always just a @code{-I} flag.
209 # @var{GUILE_LDFLAGS}: flags to pass to the linker to link a program against
210 # Guile. This includes @code{-lguile} for the Guile library itself, any
211 # libraries that Guile itself requires (like -lqthreads), and so on. It may
212 # also include a @code{-L} flag to tell the compiler where to find the
215 # The variables are marked for substitution, as by @code{AC_SUBST}.
217 AC_DEFUN([GUILE_FLAGS],
218 [AC_REQUIRE([GUILE_PROGS])dnl
219 AC_MSG_CHECKING([libguile compile flags])
220 GUILE_CFLAGS="`$GUILE_CONFIG compile`"
221 AC_MSG_RESULT([$GUILE_CFLAGS])
222 AC_MSG_CHECKING([libguile link flags])
223 GUILE_LDFLAGS="`$GUILE_CONFIG link`"
224 AC_MSG_RESULT([$GUILE_LDFLAGS])
225 AC_SUBST(GUILE_CFLAGS)
226 AC_SUBST(GUILE_LDFLAGS)
229 # GUILE_SITE_DIR -- find path to Guile "site" directory
231 # Usage: GUILE_SITE_DIR
233 # This looks for Guile's "site" directory, usually something like
234 # PREFIX/share/guile/site, and sets var @var{GUILE_SITE} to the path.
235 # Note that the var name is different from the macro name.
237 # The variable is marked for substitution, as by @code{AC_SUBST}.
239 AC_DEFUN([GUILE_SITE_DIR],
240 [AC_REQUIRE([GUILE_PROGS])dnl
241 AC_MSG_CHECKING(for Guile site directory)
242 GUILE_SITE=`[$GUILE_CONFIG] info pkgdatadir`/site
243 AC_MSG_RESULT($GUILE_SITE)
247 # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
249 # Usage: GUILE_CHECK_RETVAL(var,check)
251 # @var{var} is a shell variable name to be set to the return value.
252 # @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and
253 # returning either 0 or non-#f to indicate the check passed.
254 # Non-0 number or #f indicates failure.
255 # Avoid using the character "#" since that confuses autoconf.
257 AC_DEFUN([GUILE_CHECK],
258 [AC_REQUIRE([GUILE_PROGS])
259 $GUILE -c "$2" > /dev/null 2>&1
263 # GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
265 # Usage: GUILE_MODULE_CHECK(var,module,featuretest,description)
267 # @var{var} is a shell variable name to be set to "yes" or "no".
268 # @var{module} is a list of symbols, like: (ice-9 common-list).
269 # @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v.
270 # @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING).
272 AC_DEFUN([GUILE_MODULE_CHECK],
273 [AC_MSG_CHECKING([if $2 $4])
274 GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3))))
275 if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi
279 # GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module
281 # Usage: GUILE_MODULE_AVAILABLE(var,module)
283 # @var{var} is a shell variable name to be set to "yes" or "no".
284 # @var{module} is a list of symbols, like: (ice-9 common-list).
286 AC_DEFUN([GUILE_MODULE_AVAILABLE],
287 [GUILE_MODULE_CHECK($1,$2,0,is available)
290 # GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable
292 # Usage: GUILE_MODULE_REQUIRED(symlist)
294 # @var{symlist} is a list of symbols, WITHOUT surrounding parens,
295 # like: ice-9 common-list.
297 AC_DEFUN([GUILE_MODULE_REQUIRED],
298 [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1))
299 if test "$ac_guile_module_required" = "no" ; then
300 AC_MSG_ERROR([required guile module not found: ($1)])
304 # GUILE_MODULE_EXPORTS -- check if a module exports a variable
306 # Usage: GUILE_MODULE_EXPORTS(var,module,modvar)
308 # @var{var} is a shell variable to be set to "yes" or "no".
309 # @var{module} is a list of symbols, like: (ice-9 common-list).
310 # @var{modvar} is the Guile Scheme variable to check.
312 AC_DEFUN([GUILE_MODULE_EXPORTS],
313 [GUILE_MODULE_CHECK($1,$2,$3,exports `$3')
316 # GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable
318 # Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar)
320 # @var{module} is a list of symbols, like: (ice-9 common-list).
321 # @var{modvar} is the Guile Scheme variable to check.
323 AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT],
324 [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2)
325 if test "$guile_module_required_export" = "no" ; then
326 AC_MSG_ERROR([module $1 does not export $2; required])
330 ## guile.m4 ends here