Support running autogen.sh from srcdir != builddir
Fix handling of mmap failure and mapping empty files

Check the return value of mmap() correctly.

Empty files cannot be mmap'd so we implement some
work around code for that.

https://bugs.freedesktop.org/show_bug.cgi?id=74773

Signed-off-by: Stef Walter <stef@thewalter.net>