title: How do I build ImageMagick with OpenCL?
body: <p>I have the latest Ubuntu LTS and Intel OpenCL drivers for it. I need to build ImageMagick library so it would have OpenCL enabled but I cant figure out how to do this. I'd like to build it from the source so that I could tinker on it myself.</p>
  
  <p>I got ImageMagick 7.0 from <a href="https://github.com/ImageMagick/ImageMagick" rel="nofollow">the official mirror at GitHub</a>. Support for OpenCL is stated on the website of the library, but unfortunately the documentation is very scattered and intricate.</p>
  
  <p>I built the library with <code>./configure</code> (no args) and <code>make</code> <code>make install</code>. Surely no support for OpenCL was provided as prompted by <code>convert -version</code>. For the sake of an experiment, i wrote a C++ program that calls <code>image.blur(6, 1.5)</code>. Before the library's building, I put into the <code>BlurImage()</code> funciton in <a href="https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/effect.c" rel="nofollow">MagickCore\effect.c</a> a small snippet that creates a file and prompt some string into it.</p>
  
  <p>I got both blurred image and a file issued, so the library seems to work. Now I need to build it with OpenCL.</p>
  
  <p>I executed <code>./configure --enable-opencl LIBS=-ldl</code>. When I built the library form this execution, <code>convert -version</code> promted an OpenCL support.</p>
  
  <p>As far as I learned the source of ImageMagick, the OpenCL kernels are kept in <a href="https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/accelerate-private.h" rel="nofollow">MagickCore\accelerate-private.h</a> and compiled runtime. Actual code in C that calls accelerated functions is stored in <a href="https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/accelerate.c" rel="nofollow">MagickCore\accelerate.c</a>. I made the same moves, and put that file creation snippet into <code>AccelerateBlurImage()</code> function. I got the blurred image, but no file was created so this function was never called even though OpenCL feature is stated.</p>
  
  <p>The wierd thing I've noticed is that none of none of accelerated counterparts of the effect functions are actually called anyplace else. So I can't actullay realise how OpenCL-supporting functions are used.</p>
  
  <p>Another wierd thing I've noticed is the result from <code>diff Makefile_without_OpenCL Makefile_with_OpenCL</code>. <code>Makefile_without_OpenCL</code> is the <code>Makefile</code> created by <code>./configure</code> command, <code>Makefile_with_OpenCL</code> is the <code>Makefile</code> created by <code>./configure --enable-OpenCL LIBS=-ldl</code>. The result shows that the latter file additionally includes <code>-pthread</code> flag and <code>-ldl</code> lib, but nothing actually related to OpenCL is used.</p>
  
  <p>Do I get something wrong and OpenCL is already in use, even though <code>AccelerateBlurImage()</code> funciton is not called? If that's not the case, what is the correct flow in order to build ImageMagick with OpenCL?</p>