locale/Makefile.am:5: `localedir' is not a legitimate directory for `DATA'
Hmm, seeing the code would help. We are not prescient.
My guess is line 5 of Makefile.am contains text like "locale_DATA = ...." and the localedir variable has not been defined. Just a guess, because of the dearth of actual information in the question.
The i18n infrastructure of some projects gets a little weird when integrating with the autotools. There may be a locale/Makefile.am.in file that needs to get preprocessed before the autotools get run. You could check that, too.
If there is a file called 'autogen.sh' present, you should try running that to refresh the build infrastructure to match the tool versions on your system.