@@ -100,6 +100,26 @@ def get_march_flag(cls):
100
100
def get_version_flags (cls , command ):
101
101
return ['-dumpversion' ]
102
102
103
+ @classmethod
104
+ def autoconfig_run_test (cls , result ):
105
+ # Some versions of GCC/Clang (like those in Raspbian or ARM64 Debian)
106
+ # can't autodetect the CPU, in which case our unconditional passing of
107
+ # -march=native breaks. Here we try to see if -march=native works, and
108
+ # if not fall back to a generic (slow) build.
109
+ for target in ['native' , None ]:
110
+ result [cls .arch ] = target
111
+ executor = type ('Executor' , (cls ,), {'runtime_dict' : result })
112
+ executor .__module__ = cls .__module__
113
+ errors = []
114
+ success = executor .run_self_test (output = False , error_callback = errors .append )
115
+ if success :
116
+ message = 'Using %s (%s target)' % (result [cls .command ], target or 'generic' )
117
+ # Don't pollute the YAML in the default case
118
+ if target == 'native' :
119
+ del result [cls .arch ]
120
+ return result , success , message , None
121
+ return result , success , 'Failed self-test' , '\n ' .join (errors )
122
+
103
123
@classmethod
104
124
def autoconfig (cls ):
105
125
return super (GCCExecutor , cls ).autoconfig ()
0 commit comments