Fix compilation for OCaml 4.01+

The prefilter mechanism had to be changed because the stlib interface
for Marshal is not backwards compatible with 4.00. Therefore, we
now need to prefilter on both major and minor versions. Instead of
a horribly complex sed secript, I've written a simple Perl script
build/prefilter.pl that does the filtering.