List of language codes by country
The countryInfo file from http://geonames.org (http://download.geonames.org/export/dump/countryInfo.txt) has names, country codes, languages and lots of other info. It is a tab separated list so awk or any text editor will let you select just the columns you need.
The information you are looking for is actually 2 separate pieces of information. I am not sure there is a direct correlation between the two.
Country codes are available at: www.iso.org/iso/english_country_names_and_code_elements
And language codes are available at: www.loc.gov/standards/iso639-2/php/code_list.php
Mixing the pieces of information together is something done in "locales". This seems to be something that is not real standardized. Lots of companies appear to be doing it on their own and even providing utilities for supporting this in things like Java (See http://java.sun.com/developer/technicalArticles/J2SE/locale/).
This site has more information on language tags: www.langtag.net/.
BTW, the relationship of country codes to language code is not usually that meaningful in a user application. There are lots of users in a country that use "non-native" languages. (IE: someone in the U.S. that uses Chinese, or vice-versa.)