Check that the gcc version is at least the specified version.
(cmd, major, minor=0, patchlevel=0)
| 64 | |
| 65 | |
| 66 | def check_gcc_version_at_least(cmd, major, minor=0, patchlevel=0): |
| 67 | """ |
| 68 | Check that the gcc version is at least the specified version.""" |
| 69 | |
| 70 | cmd._check_compiler() |
| 71 | version = '.'.join([str(major), str(minor), str(patchlevel)]) |
| 72 | body = textwrap.dedent(""" |
| 73 | int |
| 74 | main() |
| 75 | { |
| 76 | #if (! defined __GNUC__) || (__GNUC__ < %(major)d) || \\ |
| 77 | (__GNUC_MINOR__ < %(minor)d) || \\ |
| 78 | (__GNUC_PATCHLEVEL__ < %(patchlevel)d) |
| 79 | #error gcc >= %(version)s required |
| 80 | #endif |
| 81 | return 0; |
| 82 | } |
| 83 | """) |
| 84 | kw = {'version': version, 'major': major, 'minor': minor, |
| 85 | 'patchlevel': patchlevel} |
| 86 | |
| 87 | return cmd.try_compile(body % kw, None, None) |
| 88 | |
| 89 | |
| 90 | def check_gcc_function_attribute(cmd, attribute, name): |
no test coverage detected