Make cgminer look in the install directory for the .cl files making make install work correctly.
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
diff --git a/configure.ac b/configure.ac
index dab51dc..795f50d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,13 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatib
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
[Define if __attribute__((warn_unused_result))]))
-
+
+if test "x$prefix" = xNONE; then
+ prefix=/usr
+fi
+
+AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin/"], [Path to cgminer install])
+
AC_SUBST(OPENCL_LIBS)
AC_SUBST(JANSSON_LIBS)
AC_SUBST(PTHREAD_FLAGS)
diff --git a/ocl.c b/ocl.c
index 9c86161..5977e06 100644
--- a/ocl.c
+++ b/ocl.c
@@ -32,11 +32,19 @@ extern int opt_worksize;
char *file_contents(const char *filename, int *length)
{
- FILE *f = fopen(filename, "rb");
+ char *fullpath = alloca(strlen(CGMINER_PREFIX) + strlen(filename));
void *buffer;
+ FILE *f;
+
+ strcpy(fullpath, CGMINER_PREFIX);
+ strcat(fullpath, filename);
+
+ f = fopen(filename, "rb");
+ if (!f)
+ f = fopen(fullpath, "rb");
if (!f) {
- applog(LOG_ERR, "Unable to open %s for reading", filename);
+ applog(LOG_ERR, "Unable to open %s or %s for reading", filename, fullpath);
return NULL;
}