configure: Support older version of openjpeg1

It should work best for debian stable and people not installing the .pc
file.

(cherry picked from commit aa807425395caa17a85ed2833133278e8bd44a76)