@@ -27,22 +27,24 @@ def clean_files(source, executable):
2727 os .remove (source )
2828 os .remove (executable )
2929
30- def call_security_check ( cc : str , source : str , executable : str , options ) -> tuple :
30+ def env_flags ( ) -> list [ str ] :
3131 # This should behave the same as AC_TRY_LINK, so arrange well-known flags
3232 # in the same order as autoconf would.
3333 #
3434 # See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for
3535 # reference.
36- env_flags : list [str ] = []
36+ flags : list [str ] = []
3737 for var in ['CFLAGS' , 'CPPFLAGS' , 'LDFLAGS' ]:
38- env_flags += filter (None , os .environ .get (var , '' ).split (' ' ))
38+ flags += filter (None , os .environ .get (var , '' ).split (' ' ))
39+ return flags
3940
40- subprocess .run ([* cc ,source ,'-o' ,executable ] + env_flags + options , check = True )
41+ def call_security_check (cc : str , source : str , executable : str , options ) -> tuple :
42+ subprocess .run ([* cc ,source ,'-o' ,executable ] + env_flags () + options , check = True )
4143 p = subprocess .run ([os .path .join (os .path .dirname (__file__ ), 'security-check.py' ), executable ], stdout = subprocess .PIPE , text = True )
4244 return (p .returncode , p .stdout .rstrip ())
4345
4446def get_arch (cc , source , executable ):
45- subprocess .run ([* cc , source , '-o' , executable ], check = True )
47+ subprocess .run ([* cc , source , '-o' , executable ] + env_flags () , check = True )
4648 binary = lief .parse (executable )
4749 arch = binary .abstract .header .architecture
4850 os .remove (executable )
0 commit comments