+
+AC_DEFUN(STEPMAKE_FLEX, [
+ # ugh, automake: we want (and check for) flex
+ # AC_PROG_LEX
+ # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
+
+ # AC_PROG_LEX()
+ # ugh, ugh
+ ac_cv_prog_lex_root=lex.yy
+ STEPMAKE_PROGS(FLEX, flex, $1)
+])
+
+
+AC_DEFUN(STEPMAKE_FLEXLEXER, [
+ AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
+ if test $? -ne 0; then
+ warn='FlexLexer.h (flex package)'
+ STEPMAKE_ADD_ENTRY($1, $warn)
+ fi
+ # check for yyFlexLexer.yy_current_buffer,
+ # in 2.5.4 <= flex < 2.5.29
+ AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
+ [stepmake_cv_flexlexer_yy_current_buffer],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+using namespace std;
+#include <FlexLexer.h>
+class yy_flex_lexer: public yyFlexLexer
+{
+ public:
+ yy_flex_lexer ()
+ {
+ yy_current_buffer = 0;
+ }
+};
+]])],
+ [stepmake_cv_flexlexer_yy_current_buffer=yes],
+ [stepmake_cv_flexlexer_yy_current_buffer=no]))
+ if test $stepmake_cv_flexlexer_yy_current_buffer = yes; then
+ AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
+ fi
+])
+
+
+
+AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
+ AC_MSG_CHECKING([FlexLexer.h location])
+
+ # ugh.
+ cat <<EOF > conftest.cc
+using namespace std;
+#include <FlexLexer.h>
+EOF
+ FLEXLEXER_FILE=`eval $ac_cpp conftest.cc | \
+ sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
+ sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
+ rm conftest.cc
+ AC_SUBST(FLEXLEXER_FILE)
+ AC_MSG_RESULT($FLEXLEXER_FILE)
+])
+
+AC_DEFUN(STEPMAKE_GCC_OR_CLANG, [
+ STEPMAKE_HAS_CLANG()
+ if test "$HAS_CLANG" = "no"; then
+ if test "$GCC" = "yes"; then
+ STEPMAKE_CHECK_VERSION(CC, $1, $2)
+ else
+ warn="$CC (Please install *GNU* cc)"
+ STEPMAKE_ADD_ENTRY($1, $warn)
+ fi
+ fi
+ # no else, we're fine with any clang
+])
+
+AC_DEFUN(STEPMAKE_GETTEXT, [
+ presome=${prefix}
+ if test "$prefix" = "NONE"; then
+ presome=${ac_default_prefix}
+ fi
+ LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
+
+ AC_SUBST(localedir)
+ AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
+ AC_CHECK_LIB(intl, gettext)
+ AC_CHECK_FUNCS(gettext)
+])
+
+
+# Check for guile, between minimum ($2) and maximum version ($3).
+# If missing, add entry to missing-list ($1, one of 'OPTIONAL', 'REQUIRED')
+AC_DEFUN(STEPMAKE_GUILE, [
+ AC_MSG_CHECKING([for guile])
+ guile="guile"
+ found="no"
+ for r in $GUILE guile guile2 guile2.0 guile-2.0 guile1 guile1.9 guile1.8 guile-1 guile-1.9 guile-1.8; do
+ exe=`STEPMAKE_GET_EXECUTABLE($r)`
+ if ! $exe --version > /dev/null 2>&1 ; then
+ continue
+ fi
+ ver=`STEPMAKE_GET_VERSION($exe)`
+ num=`STEPMAKE_NUMERIC_VERSION($ver)`
+ req=`STEPMAKE_NUMERIC_VERSION($2)`
+ sup=`STEPMAKE_NUMERIC_VERSION($3)`
+ if test -n "$2" && test "$num" -lt "$req"; then
+ guile=["$r >= $2 (installed: $ver)"]
+ continue
+ else
+ if test -n "$3" && test "$num" -ge "$sup"; then
+ guile=["$r < $3 (installed: $ver)"]
+ continue
+ else
+ guile=$r
+ found=$r
+ break
+ fi
+ fi
+ done
+ AC_MSG_RESULT([$found])
+ if test "$found" != "no"; then
+ AC_MSG_CHECKING([$guile version])
+ AC_MSG_RESULT([$ver])
+ GUILE=$found
+ else
+ STEPMAKE_ADD_ENTRY($1, $guile)
+ fi
+ STEPMAKE_PATH_PROG(GUILE, $GUILE)
+])
+
+
+# STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
+#
+# This macro runs the guile-config script, installed with Guile,
+# to find out where Guile's header files and libraries are
+# installed. It sets two variables, marked for substitution, as
+# by AC_SUBST.
+#
+# 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.
+
+AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
+ exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
+ if test -x $exe; then
+ AC_MSG_CHECKING([guile compile flags])
+ GUILE_CFLAGS="`$guile_config compile`"
+ AC_MSG_RESULT($GUILE_CFLAGS)
+ AC_MSG_CHECKING([guile link flags])
+ GUILE_LDFLAGS="`$guile_config link`"
+ AC_MSG_RESULT($GUILE_LDFLAGS)
+ fi
+ AC_SUBST(GUILE_CFLAGS)
+ AC_SUBST(GUILE_LDFLAGS)
+])
+
+
+# Check for guile-config, between minimum ($2) and maximum version ($3).
+# If missing, add entry to missing-list ($1, one of 'OPTIONAL', 'REQUIRED')
+AC_DEFUN(STEPMAKE_GUILE_DEVEL, [