How can I require that browscap.ini / get_browser() is functioning before allow a my module to be installed? I have a module for my Drupal 7.x installation which needs browscap.ini / get_browser().

The module works perfectly, but I want to make sure the browscap.ini is installed before installing of enabling the module. That way the module will not work unless browscap is installed correctly.

How can I do this?
I fixed it using the following code:

/**
 * Implementation of hook_requirements().
 *
 */
function aserv_support_requirements($phase) {
  $requirements = [];

  if ($phase == 'install' || $phase == 'runtime') {

    if (!get_cfg_var('browscap')) {
      $requirements['aserv_support'] = [
        'title'    =&gt; t('Browscap not installed'),
        'value'    =&gt; 'Browscap has not be installed. Please install Browscap before enabling this module.',
        'severity' =&gt; REQUIREMENT_ERROR,
      ];
    }
  }

  return $requirements;
}

/**
 *  Implementation of hook_enable()
 */
function aserv_support_enable() {
  if (!get_cfg_var('browscap')) {
    drupal_set_message(t('ERROR Enabling Aserv_Support: Browscap has not be installed. Please install Browscap before enabling this module.'), 'error');
    module_disable(['aserv_support']);
  }
}