use ATISTREAMSDKROOT env variable if available... ... to determine the location of OpenCL libs clean up the use of OPENCL_* vars in autostuff
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/Makefile.am b/Makefile.am
index 78e2aca..a0ab8a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,7 @@ cgminer_SOURCES = elist.h miner.h compat.h bench_block.h \
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
+cgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @OPENCL_FLAGS@
if HAVE_x86_64
if HAS_YASM
diff --git a/configure.ac b/configure.ac
index 6b7e48d..1a659b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,7 +63,7 @@ AC_FUNC_ALLOCA
have_win32=false
PTHREAD_FLAGS="-lpthread"
DLOPEN_FLAGS="-ldl"
-OPENCL_FLAGS="-lOpenCL"
+OPENCL_LIBS="-lOpenCL"
WS2_LIBS=""
case $target in
@@ -84,10 +84,20 @@ case $target in
WS2_LIBS="-lws2_32"
;;
*-*-darwin*)
- OPENCL_FLAGS="-framework OpenCL"
+ OPENCL_LIBS="-framework OpenCL"
;;
esac
+if test "x$ATISTREAMSDKROOT" != x; then
+ if test "x$have_x86_64" = xtrue; then
+ ATI_STREAM_ARCH_DIR=x86_64
+ else
+ ATI_STREAM_ARCH_DIR=x86
+ fi
+ OPENCL_FLAGS="-I$ATISTREAMSDKROOT/include $OPENCL_FLAGS"
+ OPENCL_LIBS="-L$ATISTREAMSDKROOT/lib/$ATI_STREAM_ARCH_DIR $OPENCL_LIBS"
+fi
+
AC_ARG_ENABLE([opencl],
[AC_HELP_STRING([--disable-opencl],[Override detection and disable building with opencl])],
[opencl=$enableval]
@@ -96,7 +106,9 @@ if test "x$opencl" != xno; then
# Check for OpenCL (the long way needed on mingw32 due to calling conventions)
AC_MSG_CHECKING([for OpenCL])
SAVED_LIBS=$LIBS
- LIBS="$LIBS $OPENCL_FLAGS"
+ SAVED_CFLAGS=$CFLAGS
+ LIBS="$LIBS $OPENCL_LIBS"
+ CFLAGS="$CFLAGS $OPENCL_FLAGS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#ifdef __APPLE_CC__
@@ -109,10 +121,11 @@ if test "x$opencl" != xno; then
[AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL is present on the system.])
found_opencl=1
- OPENCL_LIBS=$OPENCL_FLAGS],
+ ],
[AC_MSG_RESULT(no)
found_opencl=0])
LIBS=$SAVED_LIBS
+ CFLAGS=$SAVED_CFLAGS
fi
AC_CHECK_LIB(pthread, pthread_create, ,
@@ -238,6 +251,7 @@ fi
AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
AC_SUBST(OPENCL_LIBS)
+AC_SUBST(OPENCL_FLAGS)
AC_SUBST(JANSSON_LIBS)
AC_SUBST(PTHREAD_FLAGS)
AC_SUBST(DLOPEN_FLAGS)