I am trying to use relocatable-lib-lgpl, to make Enchant relocatable. (Enchant is a spell-checker library wrapper, itself a library, and it needs to be able to find resources such as dictionaries at run-time, relative to the library's location. See
https://github.com/AbiWord/enchant/ )
(Thanks, Bruno!)
However, I can't work out how to use relocatable-lib in a library, as the documentation seems only to cover use in programs (which I've used before).
There seem to be some magic symbols such as IN_LIBRARY (not defined anywhere in gnulib that I can see) and the function compute_curr_prefix is automagically renamed to local_compute_curr_prefix and made static in a library. It seems that a library has to arrange calling set_relocation_prefix itself; I presume the first argument can be passed in from the configure-time prefix?
Anyway, given some brief details, I'd be very happy to mark the 10th anniversary of this excellent contribution to gnulib by adding documentation for relocatable-lib{,-lgpl}.
As relocatable-lib was originally written for gettext, I had a look at gettext to see what I could glean. I see that it defines IN_LIBRARY when building libintl.
So my guess at what a library should do is something like:
Installation considerations are the same as for relocatable{,-prog,…}, so no need to add anything there. (That is, the only differences are for maintainers.)
Maintainers need to:
1. Define IN_LIBRARY when building the library sources.
2. Call set_relocation_prefix at a suitable time, e.g. when the library is initialised, or the first time it needs to look for other files. The first argument can be set from @address@hidden
Otherwise, usage seems is the same: call "relocate" as needed, except the convenience function "compute_curr_prefix" is called "local_compute_curr_prefix".
--