If when building in Scratchbox you get an error like:

configure: error: Can’t find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))

The solution is to update your mozconfig with the following line:

ac_add_options –with-maemo-version=5

for a complete mozconfig check: https://wiki.mozilla.org/Mobile/Build/Fennec