On Tue, Nov 12, 2013 at 7:16 AM, Gerald Pfeifer <[email protected]> wrote:
> On Tue, 12 Nov 2013, Iyer, Balaji V wrote:
>>> Are you linking with -nostdlib or something similar? IIRC those
>>> routines are provided by libc on *bsd*. On other systems you may need
>>> to link in libdl via -ldl.
>> Yes, I am. In my system SUSE, I need to explicitly link it.
>>> I'm sure there's autoconf bits to test whether or not -ldl should be
>>> used for any given system.
>> Ah Ok. I will dig into it tomorrow.
>
> Thanks, appreciated! As a most simple approach, if others prove
> too complex, you could start by not linking in -ldl if it does not
> exist. I believe that'd be a strict improvement unbreaking several
> non-GNU/Linux platforms by itself.
>
> Gerald
Please try this.
--
H.J.
diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am
index 1a8bafa..56bc9eb 100644
--- a/libcilkrts/Makefile.am
+++ b/libcilkrts/Makefile.am
@@ -91,7 +91,7 @@ include include/internal/rev.mk
#libcilkrts_la_LDFLAGS = -rpath '$(libdir)'
libcilkrts_la_LDFLAGS = -version-info 5:0:0
-libcilkrts_la_LDFLAGS += -lpthread -ldl
+libcilkrts_la_LDFLAGS += -lpthread @lt_cv_dlopen_libs@
# If we're building on Linux, use the Linux version script
if LINUX_LINKER_SCRIPT
diff --git a/libcilkrts/Makefile.in b/libcilkrts/Makefile.in
index a35eb7b..5066bef 100644
--- a/libcilkrts/Makefile.in
+++ b/libcilkrts/Makefile.in
@@ -312,6 +312,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@@ -395,8 +396,9 @@ CILK_REVISION = 3902
#libcilkrts_la_LDFLAGS = -rpath '$(libdir)'
# Hack for Cygwin
-libcilkrts_la_LDFLAGS = -version-info 5:0:0 -lpthread -ldl \
- $(am__append_1) $(am__append_2) -no-undefined
+libcilkrts_la_LDFLAGS = -version-info 5:0:0 -lpthread \
+ @lt_cv_dlopen_libs@ $(am__append_1) $(am__append_2) \
+ -no-undefined
# C/C++ header files for Cilk.
cilkincludedir = $(includedir)/cilk
diff --git a/libcilkrts/configure b/libcilkrts/configure
index 41deb9f..2461b51 100644
--- a/libcilkrts/configure
+++ b/libcilkrts/configure
@@ -604,6 +604,7 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+lt_cv_dlopen_libs
toolexeclibdir
toolexecdir
CXXCPP
@@ -4982,6 +4983,10 @@ else
fi
+enable_dlopen=yes
+
+
+
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -7587,8 +7592,6 @@ done
- enable_dlopen=no
-
enable_win32_dll=no
@@ -11057,7 +11060,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11060 "configure"
+#line 11063 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11163,7 +11166,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11166 "configure"
+#line 11169 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14419,6 +14422,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
# Must be last
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac
index 4582d80..8af1bf0 100644
--- a/libcilkrts/configure.ac
+++ b/libcilkrts/configure.ac
@@ -146,9 +146,12 @@ case "${host}" in
esac
AM_CONDITIONAL(MAC_LINKER_SCRIPT, test "$mac_linker_script" = "yes")
+AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
+AC_SUBST(lt_cv_dlopen_libs)
+
# Must be last
AC_OUTPUT