Should be an EJ-20 or EJ-18 (2.0l or 1.8l). You can confirm this by checking the manufacture tag on the firewall. Some were also released with the EJ-20 T (which is just the turbo model)
The 2002 Subaru Legacy has a 5-speed manual.
The 2008 Subaru Legacy has a 5-speed manual.
The 2011 Subaru Legacy has a 6-speed manual.
The 2009 Subaru Legacy has a 5-speed manual.
The 2005 Subaru Legacy has a 5-speed manual.
The 2006 Subaru Legacy has a 5-speed manual.
The 2010 Subaru Legacy has a 6-speed manual.
The 2013 Subaru Legacy has a 6-speed manual.
The 2014 Subaru Legacy has a 6-speed manual.
The 2012 Subaru Legacy has a 6-speed manual.
The 2003 Subaru Legacy has a 5-speed manual.
The 2001 Subaru Legacy has a 5-speed manual.