Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep backwards compatibility with source installations
All previous installation of Themis from source on Linux used "/usr" prefix. This means that installing a newer version into "/usr/local" will result in two completely unmanaged side-by-side installations of Themis. It is brittle and can cause all sorts of trouble, both when building software and when loading shared libraries. Add a shim for backwards compatibility for Linux. If we detect that there is already a "make install" installation of Themis in /usr then we keep using the old "/usr" prefix by default. Otherwise we use the new "/usr/local" prefix. If the user has explicitly specified the prefix then we go with that value regardless of the installation status. It's kinda tricky to detect source-based installation. We do as follows: 1. Check for the main header file <themis/themis.h> It is always installed by "make install", and it may be installed by Themis package (DEB or RPM). If there is no such file then Themis is not installed to "/usr", we can simply use the new prefix. 2. Otherwise, check DEB and RPM packages If there is "libthemis" package installed then Themis installation is managed by the system's package manager. We should not use "/usr" prefix to avoid overwriting system installation, use "/usr/local". In this way we prefer "/usr/local" prefix if possible, avoid overwriting installations by package managers, and keep using the old "/usr" prefix if the user had Themis installed there before. macOS has always used "/usr/local" prefix so we can just keep using the default there.
- Loading branch information