The build system searches for <attr/xattr.h> and doesn't bother looking to see if setxattr(), getxattr() and friends are provided by the system libc. Worse, on successfully finding <attr/xattr.h> it then proceeds to include it but then links nagainst libc for the *xattr() functions.

This patch has the build system look for <sys/xattr.h> first and if it success, links against libc. On failing to find <sys/xattr.h>, it then search for <attr/xattr.h> and links against libattr.so. This can happen, for instance, on a uClibc system where UCLIBC_HAS_XATTR is not set, but libattr.so is present. Then the *xattr() functions must be provided by libattr.so.