OpenGL is not a library that you usually compile and ship yourself (unless you are a Linux distribution and pack X.Org/Mesa). Your program simply dynamically links to libGL.so (Linux / BSD), opengl32.dll (Windows, on 64-bit systems, it also calls opengl32.dll, but it's actually a 64-bit DLL) or OpenGL Framework (MacOS X ), This gives your program access to install the OpenGL system. The version / profile you want to use does not affect the library you link!
Then after initializing your program, you can check which version of OpenGL is available. If you want to use OpenGL-3 or 4, you will have to shift a few additional hoops on Windows to make full use of them, but usually some kind of shell helps you with creating context in any case, boil it up to several lines.
Then in the program you can implement several code paths for different versions. Typically, lower versions of codecs of the OpenGL version have a large subset with higher versions of encodings. I recommend writing new code in the highest version, and then adding additional code codes (often just replacements that can be done by C preprocessor macros or similar) for lower versions until you reach the lowest common denominator of the functions you really need.
source share