I have created a communication library which is linked statically into several different applications. The library provides support for communication via different kinds of hardware. Some of the hardware is supported from the vendor via a shared library. On systems without those kinds of hardware, the shared library is not available.
Previously we handled this by compiling dual versions of the communication library and the applications. This is however not very practical, so I thought about using a more dynamic communication library which tries to load the vendor library with dlopen()/dlsym() if it is available. This seems to work well. But a problem is that everyone who use my library will need to pass the -ldl option when linking their application with my library. Even if this is a minor nuisance I wonder on how this is normally solved.
Is it somehow possible to create a static library that will automatically (at compile-time or run-time) bring in the needed shared library?
Is it considered good practice to let static libraries have dependencies on shared libraries?
EDIT: I know that libtool could probably solve this, but that would still change the build process for all applications even more, which I would prefer to avoid.
EDIT 2: Target platforms are primarily Linux and Solaris. Gcc as compiler.