Only set up the warning message hook when API is available.