Use libattr and libacl to copy permissions if available

This is a patch we ship in the Fedora RPM. It copies ACLs and other extended attributes to the modified executable. I'm not sure you want to apply as it is, because it adds some ifdefs directly to the code, though it is fairly clean.