Here's a patch that seems to work. I stole the code that libtool.m4 uses
to find ltdl dependencies, put it inside a new HWLOC_CHECK_LTDL_DEPS
that stores these dependencies in HWLOC_LIBS_PRIVATE. It properly adds
-ldl on Linux and nothing on FreeBSD.
The rest of the patch is similar to Jeff's, with things moved inside
HWLOC_SETUP_CORE.
Brice
Le 14/05/2013 10:27, Brice Goglin a écrit :
> I am reviving this thread since I interrupted it to discuss "enabling
> plugins vs embedding hwloc" (1) but we didn't close the discussion
> about "not embedding libltdl anymore" (2).
>
> We committed a fix for (1) that (sometimes) generates tarballs without
> src/libltdl directory. It doesn't always happen, I don't understand
> why, but it certainly makes those tarballs unusable (configure
> complains that a Makefile.in is missing). My original patch for (1)
> fixed the problem, but (2) is a better way to avoid any such issue.
>
> The patch below does pretty much what we need, except putting the
> right ltdl static libs in hwloc.pc
>
> I am going to look at this before releasing v1.7.1
>
> Brice
>
>
>
>
> Le 08/05/2013 02:47, Jeff Squyres (jsquyres) a écrit :
>> How's this patch?
>>
>> The only question I have is: how do we figure out what libraries to put in
>> the .pc file in the --disable-shared --enable-static case?
>>
>>
>> On May 7, 2013, at 8:24 PM, Samuel Thibault <[email protected]> wrote:
>>
>>> > Jeff Squyres (jsquyres), le Wed 08 May 2013 02:21:02 +0200, a écrit :
>>>> >> On May 7, 2013, at 6:25 PM, Brice Goglin <[email protected]> wrote:
>>>> >>
>>>>> >>> I don't have anything against this. What was the reason for not using
>>>>> >>> the default/system libltdl in OMPI? libtool was buggy when you started
>>>>> >>> using it?
>>>> >>
>>>> >>
>>>> >> I neglected to answer this.
>>>> >>
>>>> >> Yes, plus libltdl grew new functionality that we needed (global/local
>>>> >> symbol visibility).
>>>> >>
>>>> >> We might be getting to the point soon where we can rely on the
>>>> >> installed libltdl to be new enough everywhere, but we haven't had that
>>>> >> conversation.
>>> >
>>> > We could already check that the installed version is new enough for our
>>> > needs.
>>> >
>>> > Samuel
>>> > _______________________________________________
>>> > hwloc-devel mailing list
>>> > [email protected]
>>> > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>> -- Jeff Squyres [email protected] For corporate legal information go
>> to: http://www.cisco.com/web/about/doing_business/legal/cri/
>>
>> no-embed-libltdl.diff
>>
>>
>> Index: configure.ac
>> ===================================================================
>> --- configure.ac (revision 5606)
>> +++ configure.ac (working copy)
>> @@ -168,30 +168,25 @@
>> AM_DISABLE_STATIC
>> AM_PROG_LIBTOOL([dlopen win32-dll])
>> LT_LANG([C])
>> -LT_CONFIG_LTDL_DIR([src/libltdl])
>> -LTDL_INIT([recursive convenience])
>> -AC_CONFIG_FILES([src/libltdl/Makefile])
>>
>> -# Workarounds for libtool LT_CONFIG_H bug
>> -#CPPFLAGS="$CPPFLAGS -I$HWLOC_top_builddir"
>> -AC_CONFIG_COMMANDS_PRE([LT_CONFIG_H=`expr "$LT_CONFIG_H" : '.*/\(.*\)'`])
>> +# If we want plugins, look for ltdl.h and libltdl
>> +LIBLTDL=
>> +AS_IF([test "$enable_plugins" = "yes"],
>> + [AC_CHECK_HEADER([ltdl.h], [],
>> + [AC_MSG_WARN([Plugin support requested, but could not find
>> ltdl.h])
>> + AC_MSG_ERROR([Cannot continue])])
>> + AC_CHECK_LIB([ltdl], [lt_dlopenext], [],
>> + [AC_MSG_WARN([Plugin support requested, but could not find
>> libltdl])
>> + AC_MSG_ERROR([Cannot continue])])
>> + ])
>> +AC_SUBST(LIBLTDL)
>>
>> # Add libltdl static-build dependencies to hwloc.pc
>> if test "x$hwloc_have_plugins" = xyes; then
>> - if test "x$with_included_ltdl" = xno; then
>> - HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $LIBLTDL"
>> - fi
>> + # JMS What to put here for static builds?
>> HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $lt_cv_dlopen_libs"
>> fi
>>
>> -# Is ltdl included?
>> -HWLOC_LTDL_SUBDIR=
>> -AS_IF([test "x$with_included_ltdl" = xyes],
>> - [HWLOC_LIBLTDL_SUBDIR=libltdl])
>> -AC_SUBST(HWLOC_LIBLTDL_SUBDIR)
>> -dnl AM_CONDITIONAL([HWLOC_LTDL_INCLUDED], [test "x$with_included_ltdl" =
>> xyes])
>> -
>> -
>> # Party on
>> AC_OUTPUT
>>
>> Index: src
>> ===================================================================
>> --- src (revision 5606)
>> +++ src (working copy)
>>
>> Property changes on: src
>> ___________________________________________________________________
>> Modified: svn:ignore
>> ## -1,5 +1,4 ##
>> .deps
>> Makefile.in
>> Makefile
>> -libltdl
>> static-components.h
>> Index: src/Makefile.am
>> ===================================================================
>> --- src/Makefile.am (revision 5606)
>> +++ src/Makefile.am (working copy)
>> @@ -207,8 +207,6 @@
>> AM_CPPFLAGS += $(LTDLINCL)
>> libhwloc_la_LDFLAGS += -export-dynamic
>> libhwloc_la_LIBADD = $(LIBLTDL)
>> -libhwloc_la_DEPENDENCIES = $(LTDLDEPS)
>> -SUBDIRS = $(HWLOC_LIBLTDL_SUBDIR)
>> endif
>>
>> # Embedded library (note the lack of a .so version number -- that
>>
>>
>> _______________________________________________
>> hwloc-devel mailing list
>> [email protected]
>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>
>
>
> _______________________________________________
> hwloc-devel mailing list
> [email protected]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
diff --git a/config/hwloc.m4 b/config/hwloc.m4
index 818fcc6..0a28a92 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -1041,6 +1041,19 @@ EOF])
[AC_MSG_WARN([Plugins not supported on non-native Windows build, plugins support cannot be enabled.])
AC_MSG_ERROR([Cannot continue])])
+ # If we want plugins, look for ltdl.h and libltdl
+ if test "x$hwloc_have_plugins" = xyes; then
+ AC_CHECK_HEADER([ltdl.h], [],
+ [AC_MSG_WARN([Plugin support requested, but could not find ltdl.h])
+ AC_MSG_ERROR([Cannot continue])])
+ AC_CHECK_LIB([ltdl], [lt_dlopenext],
+ [HWLOC_LIBS="$HWLOC_LIBS -lltdl"],
+ [AC_MSG_WARN([Plugin support requested, but could not find libltdl])
+ AC_MSG_ERROR([Cannot continue])])
+ # Add libltdl static-build dependencies to hwloc.pc
+ HWLOC_CHECK_LTDL_DEPS
+ fi
+
AC_ARG_WITH([hwloc-plugins-path],
AC_HELP_STRING([--with-hwloc-plugins-path=dir:...],
[Colon-separated list of plugin directories. Default: "$prefix/lib/hwloc". Plugins will be installed in the first directory. They will be loaded from all of them, in order.]),
@@ -1277,3 +1290,72 @@ AC_DEFUN([_HWLOC_CHECK_DECLS], [
[Define to 1 if you have the declaration of `$1', and to 0 if you don't])
])
+#-----------------------------------------------------------------------
+
+dnl HWLOC_CHECK_LTDL_DEPS
+dnl
+dnl Add ltdl dependencies to HWLOC_LIBS_PRIVATE
+AC_DEFUN([HWLOC_CHECK_LTDL_DEPS], [
+ # save variables that we'll modify below
+ save_lt_cv_dlopen="$lt_cv_dlopen"
+ save_lt_cv_dlopen_libs="$lt_cv_dlopen_libs"
+ save_lt_cv_dlopen_self="$lt_cv_dlopen_self"
+ ###########################################################
+ # code stolen from LT_SYS_DLOPEN_SELF in libtool.m4
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+ # end of code stolen from LT_SYS_DLOPEN_SELF in libtool.m4
+ ###########################################################
+
+ HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $lt_cv_dlopen_libs"
+
+ # restore modified variable in case the actual libtool code uses them
+ lt_cv_dlopen="$save_lt_cv_dlopen"
+ lt_cv_dlopen_libs="$save_lt_cv_dlopen_libs"
+ lt_cv_dlopen_self="$save_lt_cv_dlopen_self"
+])
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index a71a8e9..bd78f92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,27 +168,7 @@ AM_ENABLE_SHARED
AM_DISABLE_STATIC
AM_PROG_LIBTOOL([dlopen win32-dll])
LT_LANG([C])
-LT_CONFIG_LTDL_DIR([src/libltdl])
-LTDL_INIT([recursive convenience])
-AC_CONFIG_FILES([src/libltdl/Makefile])
-
-# Workarounds for libtool LT_CONFIG_H bug
-#CPPFLAGS="$CPPFLAGS -I$HWLOC_top_builddir"
-AC_CONFIG_COMMANDS_PRE([LT_CONFIG_H=`expr "$LT_CONFIG_H" : '.*/\(.*\)'`])
-
-# Add libltdl static-build dependencies to hwloc.pc
-if test "x$hwloc_have_plugins" = xyes; then
- if test "x$with_included_ltdl" = xno; then
- HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $LIBLTDL"
- fi
- HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE $lt_cv_dlopen_libs"
-fi
-# Is ltdl included?
-HWLOC_LTDL_SUBDIR=
-AS_IF([test "x$with_included_ltdl" = xyes],
- [HWLOC_LIBLTDL_SUBDIR=libltdl])
-AC_SUBST(HWLOC_LIBLTDL_SUBDIR)
# Party on
diff --git a/src/Makefile.am b/src/Makefile.am
index f428149..fc91214 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -207,8 +207,6 @@ if HWLOC_HAVE_PLUGINS
AM_CPPFLAGS += $(LTDLINCL)
libhwloc_la_LDFLAGS += -export-dynamic
libhwloc_la_LIBADD = $(LIBLTDL)
-libhwloc_la_DEPENDENCIES = $(LTDLDEPS)
-SUBDIRS = $(HWLOC_LIBLTDL_SUBDIR)
endif
# Embedded library (note the lack of a .so version number -- that