Commit c8d40fb4348b0029d20f91ad45ffd965fcb0f9c2

Con Kolivas 2011-09-07T09:33:43

Win32 does not use dlopen so link in -ldl only when not on win32 and display what ldflags are being passed on ./configure.

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"