In addition to pkg-config (#1) another fallback option would be building libmagic if it is not installed for the target system.
This could be done using a Git submodule of file/file.
libmagic (and file) uses the GNU autotools to compile and install.
Building libmagic on Windows (#2) and OS X (#3) needs to be considered as well.