[autobuild] fix automake-1.12 problems
[tests] extend autowrapper.sh script
fix bugs found with clang-3.3 -fsanitize=address,undefined