MacPorts compilation support

Fix main.o compilation and add definition of MacPorts specific env variables