the configure should also create a USE_WAYLAND  for the buildsystem side. The use that in the Makefile like

ifeq (@USE_OPENGLES@,1)
SRCS += AMLUtils.cpp
endif

This also begs the point that about 1/2 our code uses build guards (#ifdef HAVE_WAYLAND), the other 1/2 handles it in the Makefile (ifeq (@USE_WAYLAND@,1)) . We really should make up our minds with way we want to do this.