Fixed configure.ac to properly detect OpenCL on windows/mingw.
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
diff --git a/README b/README
index 1b0aa05..139f437 100644
--- a/README
+++ b/README
@@ -25,7 +25,7 @@ Native WIN32 build instructions (on mingw32, on windows):
Install mingw32
Install libcurl, copy libcurl.m4 into /mingw/share/aclocal
Run:
- ./autogen.sh
+ autoreconf -fvi
CFLAGS="-O3 -Wall -msse2 -I<path to AMD APP include>" LDFLAGS="-L<path to AMD APP lib/x86>" ./configure
make
diff --git a/configure.ac b/configure.ac
index 49da950..60859ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,8 +43,20 @@ case $target in
;;
esac
-#AC_CHECK_LIB(OpenCL, clSetKernelArg, OPENCL_LIBS=-lOpenCL)
-OPENCL_LIBS=-lOpenCL
+# Check for OpenCL (the long way needed on mingw32 due to calling conventions)
+AC_MSG_CHECKING([for OpenCL])
+SAVED_LIBS=$LIBS
+LIBS="$LIBS -lOpenCL"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <CL/cl.h>]],
+ [[return clSetKernelArg(0, 0, 0, 0); ]])],
+ [AC_MSG_RESULT(yes)
+ AM_CONDITIONAL(HAVE_OPENCL, true)
+ OPENCL_LIBS=-lOpenCL],
+ [AC_MSG_RESULT(no)
+ AM_CONDITIONAL(HAVE_OPENCL, false)])
+LIBS=$SAVED_LIBS
+
AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)