Jeff, 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 (big) one.
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 HWLOC_DO_AM_CONDITIONAL. But... 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 [1]. 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 [1], 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 [2] Let me know what you think because you have the same problem as Pavan when OMPI switches to hwloc v1.6+ Brice [1] Enabling ltdl requires some code like below:configure.ac AM_PROG_LIBTOOL([dlopen win32-dll]) LT_LANG([C]) # Here's what we need to configure ltdl properly LT_CONFIG_LTDL_DIR([src/libltdl]) LTDL_INIT([recursive convenience]) AC_CONFIG_FILES([src/libltdl/Makefile]) # Tell src/Makefile.am that things were configured under src/libltdl/ hwloc_mayenter_src_libltdl=yes 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. [2] https://svn.open-mpi.org/trac/hwloc/changeset/5563 https://svn.open-mpi.org/trac/hwloc/changeset/5562
diff --git a/config/hwloc.m4 b/config/hwloc.m4 index 4b627a8..5c06bca 100644 --- a/config/hwloc.m4 +++ b/config/hwloc.m4 @@ -1191,6 +1191,9 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[ AM_CONDITIONAL([HWLOC_GL_BUILD_STATIC], [test "x$hwloc_gl_component" = "xstatic"]) AM_CONDITIONAL([HWLOC_XML_LIBXML_BUILD_STATIC], [test "x$hwloc_xml_libxml_component" = "xstatic"]) + AM_CONDITIONAL([HWLOC_LTDL_INCLUDED], [test "x$with_included_ltdl" = "xyes"]) + AM_CONDITIONAL([HWLOC_MAYENTER_SRC_LIBLTDL], [test "x$hwloc_mayenter_src_libltdl" = "xyes"]) + AM_CONDITIONAL([HWLOC_HAVE_CXX], [test "x$hwloc_have_cxx" = "xyes"]) ]) hwloc_did_am_conditionals=yes diff --git a/configure.ac b/configure.ac index f05fd2d..8ed1e65 100644 --- a/configure.ac +++ b/configure.ac @@ -154,9 +154,6 @@ cat <<EOF ### EOF -# Run the AM_CONDITIONALs -HWLOC_DO_AM_CONDITIONALS - # Set the final flags CFLAGS="$HWLOC_EMBEDDED_CFLAGS $CFLAGS" CPPFLAGS="$HWLOC_EMBEDDED_CPPFLAGS $CPPFLAGS" @@ -168,10 +165,13 @@ AM_ENABLE_SHARED AM_DISABLE_STATIC AM_PROG_LIBTOOL([dlopen win32-dll]) LT_LANG([C]) + +# Here's what we need to configure ltdl properly LT_CONFIG_LTDL_DIR([src/libltdl]) LTDL_INIT([recursive convenience]) AC_CONFIG_FILES([src/libltdl/Makefile]) - +# Tell src/Makefile.am that things were configured under src/libltdl/ +hwloc_mayenter_src_libltdl=yes # Workarounds for libtool LT_CONFIG_H bug #CPPFLAGS="$CPPFLAGS -I$HWLOC_top_builddir" AC_CONFIG_COMMANDS_PRE([LT_CONFIG_H=`expr "$LT_CONFIG_H" : '.*/\(.*\)'`]) @@ -184,9 +184,9 @@ if test "x$hwloc_have_plugins" = xyes; then HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $lt_cv_dlopen_libs" fi -# Is ltdl included? -AM_CONDITIONAL([HWLOC_LTDL_INCLUDED], [test "x$with_included_ltdl" = xyes]) +# Run the AM_CONDITIONALs +HWLOC_DO_AM_CONDITIONALS # Party on AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 320222c..8ef87f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -213,6 +213,11 @@ SUBDIRS = libltdl endif endif +if HWLOC_MAYENTER_SRC_LIBLTDL +# only enter libltdl whenever configure.ac did everything needed to configure it +DIST_SUBDIRS = libltdl +endif + # Embedded library (note the lack of a .so version number -- that # intentionally only appears in the installable library). Also note # the lack of _LDFLAGS -- all libs are added by the upper layer (via