Module dependent on extension
The best solution for you is using hook_requirements .

function hook_requirements($phase){
       if ($phase =="install"){
         $requirements['php'] = array(
           'title' =&gt; 'LDAP extension',
           'value' =&gt; "LDAP",
          );
 if (function_exists('ldap_connect')) {
      $requirements['php']['description'] = 'YOU NEED TO install LADAP';
      $requirements['php']['severity'] = REQUIREMENT_ERROR;
     }
    }
return $requirements;

}


and another tricky solution (but NOT RECOMMENDED) is : Create Another module for php_ldap extension (let name it B), and on that module on hook_enable check the php_ldap extension is exists if not,  uninstall module(uninstall B module) , and  set your main module  dependent on first one(I mean Module B) . with this method you will be sure if the extension Available Module B can be installed and consequence Your main Module. 

Something like  following snippet could help you to implement that

function MODULEB_enable() {
  if (!function_exists('ldap_connect')) {
        module_disable(array('MODULEB'));
       drupal_uninstall_modules(array('MODULEB'));
       drupal_set_message(t('The Ldap extension needs to be enabled.'), 'error');
  }
}