Commit cb13e2cfe510927b2e845ac0e6aa5fba1d796255

Con Kolivas 2011-07-05T19:47:03

Make it possible to build without opencl for cpu mining only.

diff --git a/findnonce.c b/findnonce.c
index af1525a..de9890e 100644
--- a/findnonce.c
+++ b/findnonce.c
@@ -8,6 +8,9 @@
  * any later version.  See COPYING for more details.
  */
 
+#include "config.h"
+#ifdef HAVE_OPENCL
+
 #include <stdio.h>
 #include <inttypes.h>
 #include <pthread.h>
@@ -252,3 +255,4 @@ void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res)
 		return;
 	}
 }
+#endif /* HAVE_OPENCL */
diff --git a/findnonce.h b/findnonce.h
index bc5070f..e526aab 100644
--- a/findnonce.h
+++ b/findnonce.h
@@ -1,12 +1,15 @@
 #ifndef __FINDNONCE_H__
 #define __FINDNONCE_H__
 #include "miner.h"
+#include "config.h"
 
 #define MAXTHREADS (0xFFFFFFFEULL)
 /* Maximum worksize 512 * maximum vectors 4 plus one flag entry */
 #define MAXBUFFERS (4 * 512)
 #define BUFFERSIZE (sizeof(uint32_t) * (MAXBUFFERS + 1))
 
+#ifdef HAVE_OPENCL
 extern void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data);
 extern void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res);
+#endif /* HAVE_OPENCL */
 #endif /*__FINDNONCE_H__*/
diff --git a/miner.h b/miner.h
index 7aad072..fd824b9 100644
--- a/miner.h
+++ b/miner.h
@@ -9,11 +9,14 @@
 #include <pthread.h>
 #include <jansson.h>
 #include <curl/curl.h>
+
+#ifdef HAVE_OPENCL
 #ifdef __APPLE_CC__
 #include <OpenCL/opencl.h>
 #else
 #include <CL/cl.h>
 #endif
+#endif /* HAVE_OPENCL */
 
 #ifdef STDC_HEADERS
 # include <stdlib.h>
@@ -211,6 +214,7 @@ extern struct thr_info *thr_info;
 extern int longpoll_thr_id;
 extern struct work_restart *work_restart;
 
+#ifdef HAVE_OPENCL
 typedef struct {
     cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
     cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
@@ -222,6 +226,11 @@ typedef struct {
 	cl_uint W16; cl_uint W17; cl_uint W2;
 	cl_uint PreVal4; cl_uint T1;
 } dev_blk_ctx;
+#else
+typedef struct {
+	uint32_t nonce;
+} dev_blk_ctx;
+#endif
 
 struct work {
 	unsigned char	data[128];