From uKnowva 2.5.1, you can do it this way:
if(JComponentHelper::exists('com_hrm')){
//component is installed and enabled....
}
For earlier versions, you can use this:
if(JComponentHelper::isEnabled('com_hrm',true)){
//component is installed and enabled....
}