Only compile X11 and other components on Linux. Use DYLD_LIBRARY_PATH on macOS instead of LD_LIBRARY_PATH.