Few autotools fixes and fix for issue#30

Few autotools fixes that I did when I was working on the issue#30.