Detecting enabled state within shader

Is there a way for a shader to determine if a particular light is enabled, or is fog is enabled, or similar?

Pass it through as a boolean uniform parameter to your shaders from your main code.

Is that the only way? I find that GLSL is trouble in general for trying to find the state of the fixed functionality, in general - is there no way to access this kind of information without explicitly sending it to the shader?

Actually, just checked the book and there is a built-in uniform variable that you can access from both types of shaders: gl_FogParameters

Found this reference: http://www.ce.chalmers.se/edu/course/EDA425/glsl_quickref.pdf

I had this discussion over at www.opengl.org about why the selection stack wasn’t available in GLSL, there were a few guesses until an ATI developer answered me, heres what he said:

GLSL subsumes (or takes over) a particular part of the pipeline, what states are enabled is actually none of its business…And with OpenGL ES 2.0, even gl_Light wont be available, its all going through uniforms and such…

Hope this helps,
DP

I was looking in a textbook I had, and I found there are ways to access the state of the fixed-functionality lights - gl_LightSource[i] accesses the ith light. The example shows use of gl_LightSource[i].position, gl_LightSource[i].diffuse, gl_LightSource[i].ambient, and gl_LightSource[i].specular, and I presume there’s more; I admit, this isn’t quite the same as checking the enabled state, but its part of the state, at least.