In weston/configure.ac, there's something like:
  if test x$enable_egl = xyes; then
      AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
      COMPOSITOR_MODULES="$COMPOSITOR_MODULES egl >= 7.10 glesv2"
  fi