It's a real bummer trying to work out versions on Linux. So don't even try. Really, it ain't worth it. I know, what a crap answer, what are you supposed to do? The trouble is Linux systems, even from the same distro CD can be completely different from each other. Different versions of libraries, even different libraries full stop.
So what I'd do is work out what features you need from the platform and check to see if they exist. A feature is something you want the code to do that's different on various platforms - an installed library, function in an installed library or a system call are all things that can be features.
Either:
- Use
AC_CHECK_FUNC
so you can test that a particular function is there when you configure your code for a particular platform
- write little programs to test the behaviour of the functions you want and use
AC_RUN_IFELSE
to set preprocessor defines or even the macros themselves.
Now you might be sitting there going "Huh, what's he wittering on about?" If you are I'm talking about autotools, a good way of generating configure scripts for programs that run on UNIXy style systems. They enable you to write a couple of relatively simple text files that'll generate the make file for you on just about any system. Cool or what?
They can be a bugger to use but if you're serious about programming on Linux then have a look at the
Goat Book[
^] which describes how to use the autotools. It's worth spending a while to learn how to use them. This
Wikipedia article[
^] gives a good overview of how the tools fit together.