brianmario / charlock_holmes

Character encoding detection, brought to you by ICU
MIT License
1.04k stars 141 forks source link

extconf: Explicitly mark which icu-config to use when detecting Homebrew #123

Closed mistydemeo closed 6 years ago

mistydemeo commented 7 years ago

This fixes an issue where the wrong icu-config could be chosen if have_library 'icui18n' fails, but the user still has an icu-config in their PATH.

I ran into this with a user who had Anaconda installed. Anaconda bundles a copy of icu4c, which is not located in one of the default lib paths and which therefore couldn't be found by have_library 'icui18n'; however, since its icu-config was in the user's PATH, it was picked up before Homebrew's icu-config here, causing build issues: https://github.com/brianmario/charlock_holmes/blob/master/ext/charlock_holmes/extconf.rb#L56

This fixes the issue by recording the path to icu-config when a Homebrew icu4c is selected, and only looking in the PATH in the case that we also accepted whatever icu4c have_library found.