This fixes a couple of problems:
* Lua 5.1 doesn't have SYSLIBS, so wasn't being linked with any
libraries.
* SYSLIBS doesn't include -lm, so we had to add that manually to
pkgconfig. LIBS includes -lm, so we don't need that hack any more.
On other OSes, like NetBSD, these are part of libc. Fortunately, the
Lua Makefile already knows about this, and has a SYSLIBS variable we
can use for this.
We do this same patch in three different ways for four different Lua
versions, even though the structure of the Makefile barely changes
between releases. We can easily consolidate this by just modifying
the Makefile ourselves instead of using patches (Makefiles are very
amenable to this).