In autogen.sh refactor autodetection of makefile locations