+
+# Can we rebuild the parsers?
+# We really want flex and refuse other lex. So, the parser is portable and
+# does not induce extra lib dependency
+AC_PROG_FLEX(2.5.30)
+
+# Can we rebuild the xml-lexers from the XML specification?
+# if not, simply touch the flex source files (which are distributed in
+# tarballs even if generated by flexml) and hope for the best.
+AC_CHECK_PROG(FLEXML,flexml,`which flexml`,NOTFOUND)
+AM_CONDITIONAL(HAVE_FLEXML,test x$FLEXML != xNOTFOUND)
+
+# Check for doxygen when in maintainer mode which is helpful to build doc & dist
+AC_PATH_PROG(DOXYGEN,doxygen,`which doxygen`)
+AC_PATH_PROG(FIG2DEV,fig2dev,`which fig2dev`)
+AM_CONDITIONAL(HAVE_DOXYGEN,test x$DOXYGEN != x &&
+ test x$FIG2DEV != x)
+
+# Can we rebuild the publication list from the bib file?
+AC_CHECK_PROG(BIBTEX,bibtex,`which flexml`,NOTFOUND)
+AC_CHECK_PROG(BIBTOOL,bibtool,`which bibtool`,NOTFOUND)
+AC_CHECK_PROG(ICONV,iconv,`which iconv`,NOTFOUND)
+AC_CHECK_PROG(BIBTEX2HTML,bibtex2html,`which bibtex2html`,NOTFOUND)
+
+BIBTEX2HTML_VER="date"
+if test "x$BIBTEX2HTML" != "xNOTFOUND" ; then
+ BIBTEX2HTML_VER=`$BIBTEX2HTML --help 2>&1 | grep date`
+fi;
+
+AC_MSG_CHECKING(whether you have the right bibtex2html and will be able to build HTML files from the bibtex file)
+AM_CONDITIONAL(HAVE_BIBTEX2HTML,test "x$BIBTEX2HTML_VER" == "x" &&
+ test "x$BIBTEX2HTML" != "xNOTFOUND" &&
+ test "x$BIBTOOL" != "xNOTFOUND" &&
+ test "x$ICONV" != "xNOTFOUND" )
+
+if test "x$BIBTEX2HTML_VER" == "x" &&
+ test "x$BIBTEX2HTML" != "xNOTFOUND" &&
+ test "x$BIBTOOL" != "xNOTFOUND" &&
+ test "x$ICONV" != "xNOTFOUND"; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+# Can we extract really usable backtraces? (also need the popen function)
+AC_PATH_PROG(ADDR2LINE, addr2line)
+if test x$ADDR2LINE != x ; then
+ AC_DEFINE_UNQUOTED(ADDR2LINE,"$ADDR2LINE",[Path to the addr2line tool])
+fi
+
+AC_SUBST(ac_configure_args)
+AC_DEFINE_UNQUOTED(AC_CONFIGURE_ARGS,"$ac_configure_args",[Arguments passed to the configure script])
+# Can we make status line about the compilation result?
+dnl A C_CHECK_PROG(MD5SUM,md5sum,`which md5sum`)
+build_id="$PACKAGE ver=$VERSION args=\"$ac_configure_args\""
+AC_SUBST(build_id)
+
+###################
+## Makes the output
+##
+
+
+#
+# examples/gras/chord/Makefile examples/gras/chord/test_sg examples/gras/chord/test_rl
+# src/amok/Makefile
+
+SG_CONFIGURE_PART(Generating files...)
+
+# Core of the libraries