How to detect GL version at compile-time

How can I detect the OpenGL version at compile time? I know that Gl 1.1 defines GL_VERSNIO_1_1 (on Windows at least). So I was wandering, how can I know if the compiling system has GL 1.0 or 1.2 installed?

The idea is for the library to use (or not) features of GL depending on the GL installed. (for example, GL_RGB_1_5_5_5 isn’t defined in 1.0)…

I know that it’s GL_VERSION_1_2 for 1.2, so I would assume that its GL_VERSION_1_0 for 1.0.
I think that people who still use 1.0 are very rare though.

I’ll check out the GL_VERSION_1_2 thing. Thanks a lot.
As for GL 1.0, it doesn’t define anythign special, just just look if neither GL_VERSION_1_1 nor GL_VERSION_1_2 are defined.

also lookup glGetString( GL_VERSION )
of course this is not a compile-time check, but depending on the operations you are looking for, it can be important to check at runtime. (Polygon offset is like that)

Ellers