Make configure --llvm-path check llvm version

The --llvm-path configure option was missing the check
for the llvm-config version.  This caused a problem with
setting the llvm_api.

Also use llvm-config --build-mode to check the build mode
instead of relying on the directory location for setting
this value.