Fix gfortran 7 detection (#7017)
This commit is contained in:
parent
5af9256d4f
commit
f7f4bae154
@ -126,14 +126,14 @@ def pic_flag(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_version(cls, comp):
|
def default_version(cls, comp):
|
||||||
"""The '--version' option works for clang compilers.
|
"""The ``--version`` option works for clang compilers.
|
||||||
On most platforms, output looks like this::
|
On most platforms, output looks like this::
|
||||||
|
|
||||||
clang version 3.1 (trunk 149096)
|
clang version 3.1 (trunk 149096)
|
||||||
Target: x86_64-unknown-linux-gnu
|
Target: x86_64-unknown-linux-gnu
|
||||||
Thread model: posix
|
Thread model: posix
|
||||||
|
|
||||||
On Mac OS X, it looks like this::
|
On macOS, it looks like this::
|
||||||
|
|
||||||
Apple LLVM version 7.0.2 (clang-700.1.81)
|
Apple LLVM version 7.0.2 (clang-700.1.81)
|
||||||
Target: x86_64-apple-darwin15.2.0
|
Target: x86_64-apple-darwin15.2.0
|
||||||
|
@ -91,6 +91,21 @@ def pic_flag(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_version(cls, cc):
|
def default_version(cls, cc):
|
||||||
|
"""Older versions of gcc use the ``-dumpversion`` option.
|
||||||
|
Output looks like this::
|
||||||
|
|
||||||
|
4.4.7
|
||||||
|
|
||||||
|
In GCC 7, this option was changed to only return the major
|
||||||
|
version of the compiler::
|
||||||
|
|
||||||
|
7
|
||||||
|
|
||||||
|
A new ``-dumpfullversion`` option was added that gives us
|
||||||
|
what we want::
|
||||||
|
|
||||||
|
7.2.0
|
||||||
|
"""
|
||||||
# Skip any gcc versions that are actually clang, like Apple's gcc.
|
# Skip any gcc versions that are actually clang, like Apple's gcc.
|
||||||
# Returning "unknown" makes them not detected by default.
|
# Returning "unknown" makes them not detected by default.
|
||||||
# Users can add these manually to compilers.yaml at their own risk.
|
# Users can add these manually to compilers.yaml at their own risk.
|
||||||
@ -104,10 +119,32 @@ def default_version(cls, cc):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fc_version(cls, fc):
|
def fc_version(cls, fc):
|
||||||
return get_compiler_version(
|
"""Older versions of gfortran use the ``-dumpversion`` option.
|
||||||
|
Output looks like this::
|
||||||
|
|
||||||
|
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
|
||||||
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
or::
|
||||||
|
|
||||||
|
4.8.5
|
||||||
|
|
||||||
|
In GCC 7, this option was changed to only return the major
|
||||||
|
version of the compiler::
|
||||||
|
|
||||||
|
7
|
||||||
|
|
||||||
|
A new ``-dumpfullversion`` option was added that gives us
|
||||||
|
what we want::
|
||||||
|
|
||||||
|
7.2.0
|
||||||
|
"""
|
||||||
|
version = get_compiler_version(
|
||||||
fc, '-dumpversion',
|
fc, '-dumpversion',
|
||||||
# older gfortran versions don't have simple dumpversion output.
|
r'(?:GNU Fortran \(GCC\) )?([\d.]+)')
|
||||||
r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)')
|
if version in ['7']:
|
||||||
|
version = get_compiler_version(fc, '-dumpfullversion')
|
||||||
|
return version
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def f77_version(cls, f77):
|
def f77_version(cls, f77):
|
||||||
|
@ -82,7 +82,7 @@ def pic_flag(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_version(cls, comp):
|
def default_version(cls, comp):
|
||||||
"""The '--version' option seems to be the most consistent one
|
"""The ``--version`` option seems to be the most consistent one
|
||||||
for intel compilers. Output looks like this::
|
for intel compilers. Output looks like this::
|
||||||
|
|
||||||
icpc (ICC) 12.1.5 20120612
|
icpc (ICC) 12.1.5 20120612
|
||||||
|
@ -73,7 +73,7 @@ def fc_rpath_arg(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_version(self, comp):
|
def default_version(self, comp):
|
||||||
"""The '-V' option works for nag compilers.
|
"""The ``-V`` option works for nag compilers.
|
||||||
Output looks like this::
|
Output looks like this::
|
||||||
|
|
||||||
NAG Fortran Compiler Release 6.0(Hibiya) Build 1037
|
NAG Fortran Compiler Release 6.0(Hibiya) Build 1037
|
||||||
|
Loading…
Reference in New Issue
Block a user