I've been working on making hwloc v1.7 pass our tests/embedded scripts
in the last days. I fixed some minor issues but here's the remaining
First problem is that we need the AM_CONDITIONAL for HWLOC_LTDL_INCLUDED
to be executed when embedded. I can fix this by moving into
We conditionally enable SUBDIRS=libltdl (in src/Makefile.am) when
plugins are enabled and the internal ltdl is used. Assuming embedders
don't want hwloc plugins, this builds fine since we don't enter libltdl
during "make", and we can avoid the (ugly) ltdl configuration entirely
. But "make distclean" still enters libltdl unconditionally, and it
fails if LTDL wasn't configured because the Makefile is missing.
For the record, you had a similar issue with doc/tests/tools where you
don't even have a Makefile.am in these directories in OMPI. You fixed it
by doing DIST_SUBDIRS=$(SUBDIRS). It means that distclean doesn't enter
those directories at all. But it also means that you don't get
doc/tests/tools in make dist when embedded is enabled. We don't build
hwloc tarballs in embedded mode so that's fine. Using the same idea for
my issue would require to build hwloc tarballs with plugins enabled and
ltld included (both non default), I don't thing we should to this way.
So we need a way to have src/libltdl stay in DIST_SUBDIRS by default, go
in SUBDIRS when needed, and disappear totally when embedded. So here's
the only solution I finally found: hwloc configure.ac sets a shell
variable to yes, and a new AM_CONDITIONAL adds src/libltdl to
DIST_SUBDIRS only when this variable is "yes".
This still causes hwloc tarballs to contain libltdl (because hwloc
configure.ac sets the variable to yes). It's still enabled only when the
system doesn't have libltdl installed or --with-included-ltdl is given,
as previously. And embedders totally ignore src/libltdl, including in
distclean, because they don't set the variable to yes.
If an embedder ever wants to use hwloc plugins, he will have to
duplicate what the hwloc configure.ac does , and it can still link
with another libltdl if needed (to be tested).
Patch attached, on top of trunk. Note that you may need these additional
commits if you or Pavan want to test things 
Let me know what you think because you have the same problem as Pavan
when OMPI switches to hwloc v1.6+
 Enabling ltdl requires some code like below:configure.ac
# Here's what we need to configure ltdl properly
# Tell src/Makefile.am that things were configured under src/libltdl/
libtool doesn't seem to like having it in a HWLOC_SETUP_LTDL macro
outside of the main, and I think we have to let embedders call
AM_PROG_LIBTOOL() directly in case they need other options.
There's also a hack below these lines that is specific to the
"recursive" mode, but we may switch to "subproject" mode (hwloc
configure explicitly calls libltdl configure) at some point if libtool
doesn't fix the issue.