This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How can I test whether I have libstdc++ of a particular version or better?


On 06/12/2013 12:36 PM, Andrew C. Morrow wrote:
> Hi -
> 
> I have a need to write a configure check to require libstdc++ greater
> than a particular version. In this case, 4.6.0. So for example, 4.6.0
> or better should be fine, 4.5.4 should be rejected, and 4.7.0
> accepted.
> 
> Looking at http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
> section 7, I had hoped to be able to write a configure check that
> included a standard library header, and compared against __GLIBCXX__
> like follows:
> 
> #include <vector>
> // 20110325 is 4.6.0
> #if defined(__GLIBCXX__) && (__GLIBCXX__ < 20110325)
> #error
> #endif
> 
> However, this won't work: 4.5.4 is newer by date than 4.6.0, so its
> __GLIBCXX__ value exceeds that of 4.6.0 and so the configure test
> would pass, even though 4.5.x is not 'newer' than 4.6.0 in terms of
> feature level.
> 
> Is there some set of values defined by libstdc++ in analogy with
> __GNUC__, __GNUC_MINOR__ which avoids this date vs. feature ordering
> issue? Or am I looking at this problem wrong?

Generally speaking, it's preferable to find a feature you need (which
are the reason for you rejecting older versions) and test for it rather
than depending specifically on version numbers.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]