[Build system cleanups clinton@unknownlamer.org**20081112203714 * Renamed doc to documentation and moved infotex manual there * Moved contents of acinclude.m4 to m4/bobot.m4 * Imported guile.m4 so as to not rely on Guile being installed to build * Removed acinclude.m4 as it is no longer needed with proper ACLOCAL_AMFLAGS ] { move ./bobot++.texinfo ./doc/bobot++.texinfo move ./doc ./documentation adddir ./m4 hunk ./Makefile.am 1 -SUBDIRS = source scripts +SUBDIRS = documentation source scripts hunk ./Makefile.am 3 -EXTRA_DIST = examples scripts doc -info_TEXINFOS = bobot++.texinfo +EXTRA_DIST = examples m4 scripts + +ACLOCAL_AMFLAGS = -I m4 hunk ./acinclude.m4 1 -# -# Copyright (c) 1998 Etienne Bernard -# Copyright (c) 2002 Clinton Ebadi -# - -# Check if we have a decent C++ compiler -# that supports Standard Template Library (STL) -AC_DEFUN([AC_CPP_STL], -[ - AC_MSG_CHECKING([for STL support]) - - AC_CACHE_VAL(ac_cv_cpp_stl, - [ - AC_LANG_CPLUSPLUS - cat > conftest.$ac_ext < - int main() { - std::list l; - return 0; - }; -EOF - - - if AC_TRY_EVAL(ac_link) && test -s conftest; then - ac_cv_cpp_stl="have_stl=yes" - else - ac_cv_cpp_stl="have_stl=no" - fi - rm -f conftest* - ])dnl - eval "$ac_cv_cpp_stl" - - AC_MSG_RESULT([$have_stl]) - - if test "$have_stl" != "yes"; then - AC_MSG_ERROR([Sorry, you need STL support with your compiler]) - fi -]) - - -# Check is compiler has ios_base -AC_DEFUN([AC_CPP_STL_IOSBASE], -[ - AC_MSG_CHECKING([for std::ios_base in iostreams]) - - AC_CACHE_VAL(ac_cv_cpp_iosbase, - [ - AC_LANG_CPLUSPLUS - cat > conftest.$ac_ext < - #include - int main() { - std::ifstream file ("README", std::ios_base::in); - return 0; - }; -EOF - - if AC_TRY_EVAL(ac_link) && test -s conftest; then - ac_cv_cpp_iosbase="have_iosbase=yes" - else - ac_cv_cpp_iosbase="have_iosbase=no" - fi - rm -f conftest* - ])dnl - eval "$ac_cv_cpp_iosbase" - - AC_MSG_RESULT([$have_iosbase]) - - if test "$have_iosbase" = "yes"; then - HAVE_IOSBASE="-DHAVE_IOSBASE" - AC_DEFINE(HAVE_IOSBASE,1, [std::ios_base]) - else - AC_DEFINE(HAVE_IOSBASE,0) - fi -]) - -# Check if STL elements support the clear() method -AC_DEFUN([AC_CPP_STL_CLEAR], -[ - AC_MSG_CHECKING([for clear() method in STL objects]) - - AC_CACHE_VAL(ac_cv_cpp_stl_clear, - [ - AC_LANG_CPLUSPLUS - cat > conftest.$ac_ext < - int main() { - std::map > m; - m.clear(); - return 0; - }; -EOF - - if AC_TRY_EVAL(ac_link) && test -s conftest; then - ac_cv_cpp_stl_clear="have_stl_clear=yes" - else - ac_cv_cpp_stl_clear="have_stl_clear=no" - fi - rm -f conftest* - ])dnl - eval "$ac_cv_cpp_stl_clear" - - AC_MSG_RESULT([$have_stl_clear]) - - if test "$have_stl_clear" = "yes"; then - HAVE_STL_CLEAR="-DHAVE_STL_CLEAR" - AC_DEFINE(HAVE_STL_CLEAR,1, [STL Objects have a clear method]) - fi -]) - -include([guile.m4]) + rmfile ./acinclude.m4 hunk ./configure.ac 102 -AC_OUTPUT(source/Makefile scripts/Makefile Makefile) +AC_OUTPUT(documentation/Makefile source/Makefile scripts/Makefile Makefile) addfile ./documentation/Makefile.am hunk ./documentation/Makefile.am 1 - +info_TEXINFOS = bobot++.texinfo +EXTRA_DIST = index.html addfile ./m4/bobot.m4 hunk ./m4/bobot.m4 1 +# +# Copyright (c) 1998 Etienne Bernard +# Copyright (c) 2002 Clinton Ebadi +# + +# Check if we have a decent C++ compiler +# that supports Standard Template Library (STL) +AC_DEFUN([AC_CPP_STL], +[ + AC_MSG_CHECKING([for STL support]) + + AC_CACHE_VAL(ac_cv_cpp_stl, + [ + AC_LANG_CPLUSPLUS + cat > conftest.$ac_ext < + int main() { + std::list l; + return 0; + }; +EOF + + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + ac_cv_cpp_stl="have_stl=yes" + else + ac_cv_cpp_stl="have_stl=no" + fi + rm -f conftest* + ])dnl + eval "$ac_cv_cpp_stl" + + AC_MSG_RESULT([$have_stl]) + + if test "$have_stl" != "yes"; then + AC_MSG_ERROR([Sorry, you need STL support with your compiler]) + fi +]) + + +# Check is compiler has ios_base +AC_DEFUN([AC_CPP_STL_IOSBASE], +[ + AC_MSG_CHECKING([for std::ios_base in iostreams]) + + AC_CACHE_VAL(ac_cv_cpp_iosbase, + [ + AC_LANG_CPLUSPLUS + cat > conftest.$ac_ext < + #include + int main() { + std::ifstream file ("README", std::ios_base::in); + return 0; + }; +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + ac_cv_cpp_iosbase="have_iosbase=yes" + else + ac_cv_cpp_iosbase="have_iosbase=no" + fi + rm -f conftest* + ])dnl + eval "$ac_cv_cpp_iosbase" + + AC_MSG_RESULT([$have_iosbase]) + + if test "$have_iosbase" = "yes"; then + HAVE_IOSBASE="-DHAVE_IOSBASE" + AC_DEFINE(HAVE_IOSBASE,1, [std::ios_base]) + else + AC_DEFINE(HAVE_IOSBASE,0) + fi +]) + +# Check if STL elements support the clear() method +AC_DEFUN([AC_CPP_STL_CLEAR], +[ + AC_MSG_CHECKING([for clear() method in STL objects]) + + AC_CACHE_VAL(ac_cv_cpp_stl_clear, + [ + AC_LANG_CPLUSPLUS + cat > conftest.$ac_ext < + int main() { + std::map > m; + m.clear(); + return 0; + }; +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + ac_cv_cpp_stl_clear="have_stl_clear=yes" + else + ac_cv_cpp_stl_clear="have_stl_clear=no" + fi + rm -f conftest* + ])dnl + eval "$ac_cv_cpp_stl_clear" + + AC_MSG_RESULT([$have_stl_clear]) + + if test "$have_stl_clear" = "yes"; then + HAVE_STL_CLEAR="-DHAVE_STL_CLEAR" + AC_DEFINE(HAVE_STL_CLEAR,1, [STL Objects have a clear method]) + fi +]) addfile ./m4/guile.m4 hunk ./m4/guile.m4 1 +## Autoconf macros for working with Guile. +## +## Copyright (C) 1998,2001, 2006 Free Software Foundation, Inc. +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# serial 9 + +## Index +## ----- +## +## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs +## GUILE_FLAGS -- set flags for compiling and linking with Guile +## GUILE_SITE_DIR -- find path to Guile "site" directory +## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value +## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module +## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module +## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable +## GUILE_MODULE_EXPORTS -- check if a module exports a variable +## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable + +## Code +## ---- + +## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged +## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory). + +# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs +# +# Usage: GUILE_PROGS +# +# This macro looks for programs @code{guile}, @code{guile-config} and +# @code{guile-tools}, and sets variables @var{GUILE}, @var{GUILE_CONFIG} and +# @var{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 @code{AC_SUBST}. +# +AC_DEFUN([GUILE_PROGS], + [AC_PATH_PROG(GUILE,guile) + if test "$GUILE" = "" ; then + AC_MSG_ERROR([guile required but not found]) + fi + AC_SUBST(GUILE) + AC_PATH_PROG(GUILE_CONFIG,guile-config) + if test "$GUILE_CONFIG" = "" ; then + AC_MSG_ERROR([guile-config required but not found]) + fi + AC_SUBST(GUILE_CONFIG) + AC_PATH_PROG(GUILE_TOOLS,guile-tools) + AC_SUBST(GUILE_TOOLS) + ]) + +# GUILE_FLAGS -- set flags for compiling and linking with Guile +# +# Usage: GUILE_FLAGS +# +# This macro runs the @code{guile-config} script, installed with Guile, to +# find out where Guile's header files and libraries are installed. It sets +# two variables, @var{GUILE_CFLAGS} and @var{GUILE_LDFLAGS}. +# +# @var{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 @code{-I} flag. +# +# @var{GUILE_LDFLAGS}: flags to pass to the linker to link a program against +# Guile. This includes @code{-lguile} for the Guile library itself, any +# libraries that Guile itself requires (like -lqthreads), and so on. It may +# also include a @code{-L} flag to tell the compiler where to find the +# libraries. +# +# The variables are marked for substitution, as by @code{AC_SUBST}. +# +AC_DEFUN([GUILE_FLAGS], + [AC_REQUIRE([GUILE_PROGS])dnl + AC_MSG_CHECKING([libguile compile flags]) + GUILE_CFLAGS="`$GUILE_CONFIG compile`" + AC_MSG_RESULT([$GUILE_CFLAGS]) + AC_MSG_CHECKING([libguile link flags]) + GUILE_LDFLAGS="`$GUILE_CONFIG link`" + AC_MSG_RESULT([$GUILE_LDFLAGS]) + AC_SUBST(GUILE_CFLAGS) + AC_SUBST(GUILE_LDFLAGS) + ]) + +# GUILE_SITE_DIR -- find path to Guile "site" directory +# +# Usage: GUILE_SITE_DIR +# +# This looks for Guile's "site" directory, usually something like +# PREFIX/share/guile/site, and sets var @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 @code{AC_SUBST}. +# +AC_DEFUN([GUILE_SITE_DIR], + [AC_REQUIRE([GUILE_PROGS])dnl + AC_MSG_CHECKING(for Guile site directory) + GUILE_SITE=`[$GUILE_CONFIG] info pkgdatadir`/site + AC_MSG_RESULT($GUILE_SITE) + AC_SUBST(GUILE_SITE) + ]) + +# GUILE_CHECK -- evaluate Guile Scheme code and capture the return value +# +# Usage: GUILE_CHECK_RETVAL(var,check) +# +# @var{var} is a shell variable name to be set to the return value. +# @var{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. +# +AC_DEFUN([GUILE_CHECK], + [AC_REQUIRE([GUILE_PROGS]) + $GUILE -c "$2" > /dev/null 2>&1 + $1=$? + ]) + +# GUILE_MODULE_CHECK -- check feature of a Guile Scheme module +# +# Usage: GUILE_MODULE_CHECK(var,module,featuretest,description) +# +# @var{var} is a shell variable name to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v. +# @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING). +# +AC_DEFUN([GUILE_MODULE_CHECK], + [AC_MSG_CHECKING([if $2 $4]) + GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3)))) + if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi + AC_MSG_RESULT($$1) + ]) + +# GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module +# +# Usage: GUILE_MODULE_AVAILABLE(var,module) +# +# @var{var} is a shell variable name to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# +AC_DEFUN([GUILE_MODULE_AVAILABLE], + [GUILE_MODULE_CHECK($1,$2,0,is available) + ]) + +# GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable +# +# Usage: GUILE_MODULE_REQUIRED(symlist) +# +# @var{symlist} is a list of symbols, WITHOUT surrounding parens, +# like: ice-9 common-list. +# +AC_DEFUN([GUILE_MODULE_REQUIRED], + [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1)) + if test "$ac_guile_module_required" = "no" ; then + AC_MSG_ERROR([required guile module not found: ($1)]) + fi + ]) + +# GUILE_MODULE_EXPORTS -- check if a module exports a variable +# +# Usage: GUILE_MODULE_EXPORTS(var,module,modvar) +# +# @var{var} is a shell variable to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{modvar} is the Guile Scheme variable to check. +# +AC_DEFUN([GUILE_MODULE_EXPORTS], + [GUILE_MODULE_CHECK($1,$2,$3,exports `$3') + ]) + +# GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable +# +# Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar) +# +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{modvar} is the Guile Scheme variable to check. +# +AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT], + [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2) + if test "$guile_module_required_export" = "no" ; then + AC_MSG_ERROR([module $1 does not export $2; required]) + fi + ]) + +## guile.m4 ends here }