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):

const GLdouble bias[] = {0.5, 0.0, 0.0, 0.0, 
                0.0, 0.5, 0.0, 0.0,
                0.0, 0.0, 0.5, 0.0,
                0.5, 0.5, 0.5, 1.0};

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);

if ( bFixedFunction )
{
    const GLdouble x[] = {1.0, 0.0, 0.0, 0.0};
    const GLdouble y[] = {0.0, 1.0, 0.0, 0.0};
    const GLdouble z[] = {0.0, 0.0, 1.0, 0.0};
    const GLdouble w[] = {0.0, 0.0, 0.0, 1.0};

    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);
    glEnable(GL_TEXTURE_GEN_R);
    glEnable(GL_TEXTURE_GEN_Q);

    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
    glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
    glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

    glTexGendv(GL_S, GL_EYE_PLANE, x );
    glTexGendv(GL_T, GL_EYE_PLANE, y );
    glTexGendv(GL_R, GL_EYE_PLANE, z );
    glTexGendv(GL_Q, GL_EYE_PLANE, w );
}

glMatrixMode(GL_TEXTURE);
glLoadMatrixd(bias);
glMultMatrixd(l->get_proj_matrix());
glMultMatrixd(l->get_model_matrix());
glMatrixMode(GL_MODELVIEW);

In the GLSL version, only the texgen stuff needs to be moved into the GLSL program. The texture-matrix is still used, but from the vertex-program.

Vertex program:
varying vec4 ProjShadow;

void main(void)
{
    ProjShadow       = gl_TextureMatrix[1] * gl_Vertex;
    gl_Position     = ftransform();
}

.. and then projected into the scene in the Fragment program:

uniform sampler2DShadow ShadowMap;
varying vec4 ProjShadow;

void main (void)
{
    vec3 color = vec3(1, 1, 1);
    color *= shadow2DProj(ShadowMap, ProjShadow).r;
    gl_FragColor = vec4(color, 1);
}

This GLSL program is very bare, just to show the bare essential to get shadows working.
I will try and create a tiny program with source. Right now the code is entangled in, lots of other code I can't relase.