lua 5.2 compatibility

This makes the module compile with Lua 5.2.

Tested with the stock Lua interpreter (v5.2.2) on Linux x86_64 only. Other build platforms / cross compiling were not tested. The first commit shows the steps I had to take to get the autotools to cooperate.