I recently had a bug report https://github.com/AbiWord/enchant/issues/172
for a use of relocatable-lib-lgpl on Win32 which had some problems. After investigation, there are a couple of ways in which either my understanding of how to use relocatable is deficient, or there's a bug in relocatable.
1. For use in a library, relocatable.c should be built with IN_LIBRARY defined. The documentation (relocatable-maint.texi) says to add -DIN_LIBRARY to the defines for the library which is being made relocatable. Unfortunately, I wrote that documentation, and it appears to be a misunderstanding. The problem is that relocatable.c is compiled as part of gnulib, not as part of the gnulib-using library, so it doesn't see this define.
Presumably, relocatable should be built and linked into each library and program that uses it, as the way it needs to be built depends on the context (whether it is being used with a library or not, the setting of INSTALLDIR etc.). But as things stand, relocatable.c is compiled once and added to libgnu.a.
2. To get the correct path at which the library is installed, INSTALLDIR is defined. First, we have the same problem as above: where should INSTALLDIR be defined so that its definition is seen at compile time? But there's a further problem: on Win32, DLLs are installed to bindir, not libdir, so INSTALLDIR needs a different definition. Is there a suitable variable that points to "where the shared library will be installed"? (I presume this only makes sense for shared libraries: one can't have a relocatable static library!)
Help? Am I just using relocatable wrong? Or is there a problem/limitation here? (At least in my current case, I only want to use relocatable once, so just working out how to pass the correct INSTALLDIR (bindir or libdir) and -DIN_LIBRARY to the compilation of relocatable.c in gnulib would be sufficient.)