Rearrange Makefile for consistency between packages. Add m4 patch to fix compilation under some systems. Signed-off-by: Rosen Penev <rosenp@gmail.com>