The use of X11 can be controlled using the --x-includes and --x-libraries options, as in:
--x-includes="/opt/STM/STLinux-2.3/devkit/sh4/target/usr/include" --x-libraries="/opt/STM/STLinux-2.3/devkit/sh4/target/usr/lib"
Where /opt/STM/STLinux-2.3/devkit/sh4/target/usr is the full path to the ST40 version of X11.