instead of patching lib/Makefile.in directly, try autoreconf in rules