OK, this certainly seems to fix the error.
As explained in my response to your PM, I had applied a fix in my 1284P arduino.h file.
I removed that and tried compiling and got the original error.
I then added the keypad.h fix like this
//#if defined(ARDUINO) && ARDUINO < 101
#ifndef INPUT_PULLUP // fix for MCU with custom bootloaders/cores that don't have the update, like 1284P
#define INPUT_PULLUP INPUT
#endif
This now compiles fine with the following custom MCU entries:-
Mighty1284P with Optiboot, using maniacbug, bobuino and avrdude variants
Custom 644P with Optiboot, using bobuino variant