The JControllerLegacy class was added in Joomla 2.5.6. Upgrade to that, and you'll be fine. If you're not able to upgrade, you could also define the classes yourself, since they are just a shell that extends JController. However, the recommended way would be to upgrade to at least 2.5.6.
If these classes were added from Joomla 2.5.0, then your classes can simply extend JControllerLegacy, JModelLegacy, and JViewLegacy. However, since these classes are not available before 2.5.6, I think you will need to define a temp class, something like :
if (version_compare(JVERSION, '3.0', 'ge')) {
class LegacyController extends JControllerLegacy {
}
} else {
jimport( 'joomla.application.component.controller' );
class LegacyController extends JController {
}
}
Then the controller class in your extension will extend LegacyController. That should work!
Another simpler solution would be to find/replace
JControllerLegacy, JModelLegacy, JViewLegacy
with
JController, JModel, JView
in your plugin's folder by using Notepad++ or any other IDE of your choice.
That's it..!! Enjoy :)