In the maak function I moved this:
if [ "$(grep -c Error $CVS_SRC/logs/$X.log)" != 0 ]; then
echo "Compile failed, please see the logs for more information"
above make and after autogen.
The log only catches configure errors and not make error.
because that's how it is called on the autogen line.