configure: add version check for pkg libraries, and use it for vidstab

Also fix trac ticket #3296.

Signed-off-by: Georg Martius <martius@mis.mpg.de>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
