I am currently researching how to generate a recompilation warning from Latex if somthing in the auxfile changes and found this solution.
However I find it rather confusing, it uses:
\AtEndDocument{\def\newreference#1#2{...}}
Which looks to me as if it simply redefines the macro \newreference#1#2 (where #1 and #2 expand to the arguments given to the surrounding macro). However I do not know from where \newreference#1#2 is "called" (expanded? used?) to actually do the check.
I tried taking a look at clsguide and at the points when the auxfile is read. But neither was helpful (apparently the auxfile is only read at \begin{document} so this does not explain it).
.logoutput, where you'll see references to the.auxbeing printed multiple times. – Werner Nov 24 '14 at 21:40