[FFmpeg-devel] configure needs to check for OpenCL version 1.2 and look elsewhere as well

Hanspeter Niederstrasser niederstrasser at gmail.com
Fri Apr 12 18:58:31 CEST 2013


The OpenCL test just checks for CL/cl.h which doesn't exist on OS X
(it's at OpenCL/cl.h).  In trying to fix that, I also noticed that
ffmpeg needs OpenCL >= 1.2, so I tried to add a version check to
configure as well.  Here's my current patch, but it is not setting
HAVE_OPENCL_CL_H, even though config.log says that the header and
library were found.

diff --git a/configure b/configure
index fe976fd..83bb71f 100755
--- a/configure
+++ b/configure
@@ -1471,6 +1471,7 @@ HAVE_LIST="
     mprotect
     msvcrt
     nanosleep
+    opencl_cl_h
     openjpeg_1_5_openjpeg_h
     PeekNamedPipe
     perl
@@ -4034,7 +4035,12 @@ enabled openal     && { { for al_libs in
"${OPENAL_LIBS}" "-lopenal" "-lOpenAL32
                         die "ERROR: openal not found"; } &&
                       { check_cpp_condition "AL/al.h"
"defined(AL_VERSION_1_1)" ||
                         die "ERROR: openal must be installed and
version must be 1.1 or compatible"; }
-enabled opencl     && require2 opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL
+enabled opencl     && { check_lib OpenCL/cl.h clEnqueueNDRangeKernel
-Wl,-framework,OpenCL ||
+                        check_lib CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
+                        die "ERROR: opencl not found"; } &&
+                      { check_cpp_condition "OpenCL/cl.h"
"defined(CL_VERSION_1_2)" ||
+                        check_cpp_condition "CL/cl.h"
"defined(CL_VERSION_1_2)"  ||
+                        die "ERROR: opencl must be installed and
version must be 1.2 or compatible"; }
 enabled openssl    && { check_lib openssl/ssl.h SSL_library_init
-lssl -lcrypto ||
                         check_lib openssl/ssl.h SSL_library_init
-lssl32 -leay32 ||
                         check_lib openssl/ssl.h SSL_library_init
-lssl -lcrypto -lws2_32 -lgdi32 ||
diff --git a/libavutil/opencl.h b/libavutil/opencl.h
index acafe36..5450537 100644
--- a/libavutil/opencl.h
+++ b/libavutil/opencl.h
@@ -31,7 +31,11 @@
 #ifndef LIBAVUTIL_OPENCL_H
 #define LIBAVUTIL_OPENCL_H

+#if HAVE_OPENCL_CL_H
+#include <OpenCL/cl.h>
+#else
 #include <CL/cl.h>
+#endif
 #include "config.h"
 #include "dict.h"


Hanspeter

--
Disclaimer:
By sending an email to ANY of my addresses you are agreeing that:
1. I am by definition, "the intended recipient"
2. All information in the email is mine to do with as I see fit and
make such financial profit, political mileage, or good joke as it
lends itself to.
3. I may take the contents as representing the views of your company.
4. This overrides any disclaimer or statement of confidentiality that
may be included with your message.


More information about the ffmpeg-devel mailing list