> >I should add the caveat that they are need when linking statically, but
> >not when using shared libraries.
>
> And therein lies the problem. We have a number of users who build Open
> MPI statically and even some who build both static and shared libraries in
> the same build. We've never been able to figure out a reasonable way to
> guess if we need to add -lhwloc or -ldl, so we add them. It's better to
> list them and have some redundant dependencies (since you have to have the
> library anyways) than to not list them and have odd link errors.

So pkg-config has the --static option for exactly this reason. Let's look
at Cairo as an example.

Now I'm not saying that Open MPI should commit to pkg-config instead of
wrapper compilers, but the concept of linking differently for static versus
shared libraries is something that should be observed.

(Over-linking is an ongoing problem with HPC-oriented packages. We are
probably all guilty of it, but tools like pkg-config don't handle multiple
configurations well and I don't know of a similar system that manages both
static/shared and multi-configuration well.)