Skip to content

Commit ffbe610

Browse files
committed
add check for opencl requirements
1 parent 71e226c commit ffbe610

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

configure.ac

100644100755
+19-4
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,27 @@ AC_ARG_ENABLE([opencl],
160160
[enable_opencl=$enableval],
161161
[enable_opencl="no"])
162162
AC_MSG_RESULT($enable_opencl)
163-
AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"])
164163
if test "$enable_opencl" = "yes"; then
165-
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
166-
AC_SUBST([OPENCL_HDR_PATH],[$OPENCL_INC])
167-
AC_SUBST([OPENCL_LIB],[$OPENCL_LIBS])
164+
# check for opencl header
165+
AC_CHECK_HEADERS(CL/cl.h, [], [
166+
AC_CHECK_HEADERS(OpenCL/cl.h, [], [
167+
AC_MSG_ERROR(OpenCL headers file was not found)
168+
])
169+
])
170+
# check for libtiff
171+
have_tiff=false
172+
AC_CHECK_HEADERS(tiffio.h, have_tiff=true, have_tiff=false)
173+
if !($have_tiff); then
174+
AC_MSG_WARN(OpenCL will not be used - required TIFF headers not found)
175+
AC_MSG_WARN(Try to install libtiff-dev?? package.)
176+
enable_opencl="no"
177+
else
178+
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
179+
AC_SUBST([OPENCL_HDR_PATH],[$OPENCL_INC])
180+
AC_SUBST([OPENCL_LIB],[$OPENCL_LIBS])
181+
fi
168182
fi
183+
AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"])
169184

170185
# check whether to build tesseract with -fvisibility=hidden -fvisibility-inlines-hidden
171186
# http://gcc.gnu.org/wiki/Visibility

0 commit comments

Comments
 (0)