Calculate the kinetic energy of the system and factor out the generalized velocity so that you have a form that looks like
T = (1/2) qdot^2 I(q)
where I(q) is the generalized inertia which is a function of the generalized coordinate q that describes the system configuration. Then it is a simple matter to extract the function I(q) from this expression. Note that for the four bar linkage it will be variable, depending on q.