Win32 does not use dlopen so link in -ldl only when not on win32 and display what ldflags are being passed on ./configure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/Makefile.am b/Makefile.am
index fd8d239..78e2aca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,7 +27,7 @@ cgminer_SOURCES = elist.h miner.h compat.h bench_block.h \
adl.c adl.h adl_functions.h \
phatk110817.cl poclbm110817.cl
-cgminer_LDFLAGS = $(PTHREAD_FLAGS) -ldl
+cgminer_LDFLAGS = $(PTHREAD_FLAGS) $(DLOPEN_FLAGS)
cgminer_LDADD = @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ lib/libgnu.a ccan/libccan.a
cgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
diff --git a/configure.ac b/configure.ac
index f9d4764..c4e146a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ AC_FUNC_ALLOCA
have_win32=false
PTHREAD_FLAGS="-pthread"
+DLOPEN_FLAGS="-ldl"
OPENCL_FLAGS="-lOpenCL"
WS2_LIBS=""
@@ -79,6 +80,7 @@ case $target in
have_x86_64=false
have_win32=true
PTHREAD_FLAGS=""
+ DLOPEN_FLAGS=""
WS2_LIBS="-lws2_32"
;;
*-*-darwin*)
@@ -130,6 +132,8 @@ if test "$found_opencl" = 1; then
if test x$have_adl = xtrue
then
AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
+ else
+ DLOPEN_FLAGS=""
fi
fi
fi
@@ -287,7 +291,7 @@ echo
echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
echo " CFLAGS...............: $CFLAGS"
-echo " LDFLAGS..............: $LDFLAGS"
+echo " LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS $DLOPEN_FLAGS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"