| 1402 | cc, r"(^Apple (?:clang|LLVM) version) ([0-9]+\.[0-9]+)") |
| 1403 | |
| 1404 | def get_gas_version(cc): |
| 1405 | try: |
| 1406 | custom_env = os.environ.copy() |
| 1407 | custom_env["LC_ALL"] = "C" |
| 1408 | proc = subprocess.Popen(shlex.split(cc) + ['-Wa,-v', '-c', '-o', |
| 1409 | '/dev/null', '-x', |
| 1410 | 'assembler', '/dev/null'], |
| 1411 | stdin=subprocess.PIPE, stderr=subprocess.PIPE, |
| 1412 | stdout=subprocess.PIPE, env=custom_env) |
| 1413 | except OSError: |
| 1414 | error('''No acceptable C compiler found! |
| 1415 | |
| 1416 | Please make sure you have a C compiler installed on your system and/or |
| 1417 | consider adjusting the CC environment variable if you installed |
| 1418 | it in a non-standard prefix.''') |
| 1419 | |
| 1420 | with proc: |
| 1421 | gas_ret = to_utf8(proc.communicate()[1]) |
| 1422 | |
| 1423 | match = re.match(r"GNU assembler version ([2-9]\.[0-9]+)", gas_ret) |
| 1424 | |
| 1425 | if match: |
| 1426 | return match.group(1) |
| 1427 | |
| 1428 | warn(f'Could not recognize `gas`: {gas_ret}') |
| 1429 | return '0.0' |
| 1430 | |
| 1431 | def get_openssl_version(o): |
| 1432 | """Parse OpenSSL version from opensslv.h header file. |