Automake : what are the valid values for *_la_LDFLAGS in Makefile.am?
Question
I am wondering what are the possible value for *_la_LDFLAGS in Makefile.am ?
If I ask this question, it is because I would like the following :
Actual shared library : libA.so (or with the version number I don't care)
Symbolic links : libA-X.Y.Z.so, libA-X.so, libA.so
soname : libA-X.so
However here is what I get by using the -release flag :
Actual shared library : libA-X.Y.Z.so
Symbolic links : libA.so
soname : libA-X.Y.Z.so !!! this is not what I want
I also tried with no flags at all and got
Actual shared library : libA-0.0.0.so !!! 0.0.0 and not the real version
Symbolic links : libA.so, libA-0.so
soname : libA-0.so !!! 0.0.0 and not the real version
How should I do ? which flag should I use ?
Thanks in advance
Solution
You should use the -version-info
option of Libtool to specify the interface version of the library, but be sure to read
how versioning works (or here for the official manual.)
You can additionally play with -release
to make the version number of your package more apparent, but I doubt you will ever get the exact naming you'd like. Libtool has its own set of rules to define how to name the file and what symlinks to create depending on the system: these should really be regarded as implementation details of how a shared library is installed.
OTHER TIPS
IMHO, the layout you want is broken. Apps that are linked to your library will depend on libA-X.so because of the soname. But what happens when libA.so is version X+1? To what will the libA-X.so symlink point?
The idea behind the layout you get with the -release flag is, when an app links with -lA, it will result in it being linked against the latest version. It will then, because of the soname, depend on libA-X.Y.Z.so at runtime. When you install a new version of the library, that will install a new libA-X.Y.Q.so, but it will leave the old one alone - exactly as old apps that depend on it expect. New apps will still, because of the libA symlink, link against the latest version.
Years of thought by some very smart people have went into a versioning scheme that allows new apps to link against the latest version of a library, while allowing multiple versions to co-exist peacefully to satisfy dependencies for apps that need them. My advice is, don't second-guess all that.