Such is life Ideally that should be standardized by ISO or the PIP initiative. Until then, your can use e.g., Logtalk as a portability layer or you can use
Or, traditionally, write a file for each Prolog system for everything you need that is not portable and load the right file for the system. Finally, you can use the portability layer of SWI-Prolog using expects_dialect/1. Note that the various dialect emulation libraries have been constructed on demand for certain applications. So, add what you need and send a pull request to get it into the distribution.