remove __APPLE__ check and use !defined (helps with FreeBSD)