How do I find the version number of system libraries in different versions of OS X? My specific situation is that I am trying to find out whether Apple bumped the system version of libcairo to 1.12.16 in Yosemite from an earlier version of libcairo in Mavericks.

I can somewhat easily find the version on my current system by inspecting the header files, but I can't seem to find that information online.

Does there exist a reference online for all the files included in different versions of OS X, or a way to find versions of system libraries (short of having access to a computer running a specific version of OS X)?

Failing that, I'd appreciate someone running Mavericks taking a peek in /opt/X11/include/cairo/cairo-version.h and telling me the version listed there.
To answer the specific question, in newer releases, libcairo is part of cairo, which is part of XQuartz rather than the Apple-supplied X11 installation. You can find out the supplied version by checking the page for the release in question - for example, here for 2.7.7.

As has been answered by Mark, the Apple Open Source site provides listings of all of the open source software included in each release.