clang/find_clang.cr: Auto-detect if linking libclang using .a or .so
Hello,
Was toying with bindgen today and noticed that ArchLinux joined the distros who want static linking of libclang. It annoyed me so in OSS fashion I decided to do something about it.
If both static and dynamic versions are available it'll prefer the
static library, which is hopefully more stable when the user decides
to update their system. The user can still use BINDGEN_DYNAMIC=1/0
as before, but simply not setting it will trigger the auto-detection.
However this could break stuff horribly on non-ArchLinux machines,
so I PR'd this before I break master out of the blue. Does this work for
everyone?
Also, find_clang.cr has code to read the OS name to force the default
to static linking on a bunch of distros - Do we still need this code with
this change?
Cheers!
Hey @Papierkorb I think we already covered this previously and it was working in both cases. But @ZaWertun and @kalinon would be better to comment, since the current implementation came from them.
(Or, on a second thought, maybe you are right. Currently there is no autodetection (DYNAMIC needs to be set manually), and the feature/change which I was thinking about was the one where we just made sure that we only linked against .a's or .so's, and not both.)