Mac, BSD: FNM_EXTMATCH unavailable

The flag FNM_EXTMATCH for fnmatch() is a glibc extension. Make it a no-op when it's unavailable.
Mac: xattr functions are different

OS X has no l*xattr(), instead using *xattr() with a flag argument of XATTR_NOFOLLOW. Also, getxattr() and setxattr() take an extra argument for resource forks.

Just use macros for l*xattr() which adapt to the different API.
Mac, BSD: Use sysctl() instead of sysconf()

Both for finding the number of processors, and for finding the
amount of physical memory.

Header #ifdef for sysinfo.h is mysteriously missing in unsquashfs.c . Use the
exact same code as mksquashfs.c .
Mac, BSD: strdupa() is non-standard

Replace with strdup() and free it manually.
Mac: Emulate sigtimedwait()

Use sigwait() and alarm() for POSIX-compatible handling of SIGQUIT
printing.
clang: Use 'static inline' instead of 'inline'

Clang compiles in C99 mode by default, where 'inline' means there should be
another definition: http://clang.llvm.org/compatibility.html#inline

Using 'static inline' instead works.
Mac, BSD: Ensure endianness is known

- Add endian macros to xattr.c
- Move stdlib.h before squashfs_swap.h in read_xattrs.c
FreeBSD: Add missing header

We need <sys/stat.h> for S_ISDIR and friends.
OpenBSD: Add missing pthread.h include