make setup functions static as appropriate to avoid errors
Apply patch from C. Daniel Chase for 4.0 compatibility.