We are shipping some drivers for some linux for our usb products. And in our driver code to make it distribution independent we have to dynamically get the distribution name and find whether there are libraries available in each target distribution at runtime.
To do that, we need to run some commands like ldconfig, pkg-config etc etc. And this question is related to this one. So according to the answer there some distributions may have commands and it's always good to find out whether those commands are available in the distribution before executing them.
So the question is to find out whether these commands are available or not. I'm thinking about checking executable file for it's existance. for a example,
if [ -f /usr/bin/pkg-config ] ; then
Any other better way to do this ?