
* Is it possible to detect the Darwin version number (to separate 10.0 from 9.x)?
A quick find/grep through the system headers did not come up with anything obvious.
:-(
I would not attempt to detect the version using a shell variable like OSTYPE, though, since that would presumably detect the version of Darwin that you are running on, not the version that you are compiling for. It's possible to have multiple versions of Apple's developer tools installed, and each one of them can support SDKs from older systems, so the version of Darwin that's running would not be a reliable indicator of where the stdc++ headers are stored.
* Do you know what happens if someone installs gcc from source (ie not from Apples developer tools)?
It's been some time since I've done this, but my recollection is that by default, the stdc++ headers that come with gcc get installed into a deep, deep subdirectory of /usr/local whose location is known only to gcc. This is done so you have have multiple versions of gcc and stdc+ + installed simultaneously.
I think that perhaps there's another way out of this situation.
I'm assuming that the reason you can't simply #include <iostream> is that you are defining a header whose name is also <iostream>, and attempting to include the stdc++ version of the header simply leads to infinite recursion.
I believe that gcc has a non-standard extension called #include_next that is designed to handle exactly this situation. It includes another file, but searches for it _only_ in the directories that come later in the search path than the current directory. You can read more about it at:
Sigh, this is what I used to use, but changed it because of bug reports: the issue is that if you install boost in say /usr/include (as some Linux distro's do) then #include_next can never get you from /usr/include to the unknown location of the g++ std lib headers :-( I think what I'm going to do for now is revert to using #include_next on Darwin, and hope folks don't install Boost into a system directory! Thanks for your help with this, John.