I have been asked by many to explain how to make shadowmapping and GLSL to work together, and because I am lazy I will try to explain it all here. ;)
First off: if you don't know C++, OpenGL and some basics about shadowmapping, you need to go read up on that first. Other people descibe how to get that working, so I will not repeat (badly) what they write.
If you havn't read it, read this shadowmapping tutorial straight away.
Here is the fixed function code to set up the projection of the shadow (still using the texture matrix, easier to switch to GLSL from that position):