Detecting the init.d command: CHKCONFIG := $(wildcard /sbin/chkconfig) UPDATE_RCD := $(wildcard /usr/sbin/update-rc.d) ifdef CHKCONFIG ADD_INITD := $(CHKCONFIG) --add zaptel else ifdef $(UPDATE_RCD) ADD_INITD := $(UPDATE_RCD) zaptel defaults 15 30 endif endif ... config: if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \ install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/ zaptel; \ elif [ -d $(INSTALL_PREFIX)/etc/init.d ]; then \ install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zapte l; \ fi ifdef ADD_INITD $(ADD_INITD) endif