Add libffi prerequisites support

Change-Id: I5ba66e3f45fe4463ecb913539390f69be2f4b707