Modernize the autogen.sh script

It was failing to find the m4 macros directory with automake
1.13.2. This is exactly the same autogen.sh we are using in
all the core sugar modules.