automake 1.12+ build fix

Fix build issues arising with recent automake versions as documented
here:
http://lists.gnu.org/archive/html/bug-automake/2012-05/msg00009.html

Also make autoconf stop complaining about non-POSIX variable names
as described here:
http://gnu-automake.7480.n7.nabble.com/Warn-non-POSIX-variable-name-td4931.html