1--- numpy/distutils/fcompiler/gnu.py.orig	2021-05-08 21:14:06 UTC
2+++ numpy/distutils/fcompiler/gnu.py
3@@ -79,7 +79,7 @@ class GnuFCompiler(FCompiler):
4             return None
5         return v[1]
6
7-    possible_executables = ['g77', 'f77']
8+    possible_executables = ['%%FC%%', 'g77', 'f77']
9     executables = {
10         'version_cmd'  : [None, "-dumpversion"],
11         'compiler_f77' : [None, "-g", "-Wall", "-fno-second-underscore"],
12@@ -103,11 +103,13 @@ class GnuFCompiler(FCompiler):
13         for key in ['version_cmd', 'compiler_f77', 'linker_so', 'linker_exe']:
14             executables[key].append('-mno-cygwin')
15
16-    g2c = 'g2c'
17+    g2c = '%%FC%%'
18     suggested_f90_compiler = 'gnu95'
19
20     def get_flags_linker_so(self):
21         opt = self.linker_so[1:]
22+        if 'FFLAGS' in os.environ:
23+            opt.append(os.environ['FFLAGS'])
24         if sys.platform == 'darwin':
25             target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
26             # If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value
27@@ -287,7 +289,7 @@ class Gnu95FCompiler(GnuFCompiler):
28                     self.executables[key].append('-mno-cygwin')
29         return v
30
31-    possible_executables = ['gfortran', 'f95']
32+    possible_executables = ['%%FC%%', 'gfortran', 'f95']
33     executables = {
34         'version_cmd'  : ["<F90>", "-dumpversion"],
35         'compiler_f77' : [None, "-Wall", "-g", "-ffixed-form",
36