File tree Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -70,32 +70,46 @@ const char *cc(
7070    }
7171}
7272
73- /* Is current compiler clang */ 
7473static 
75- bool  is_clang (bake_src_lang  lang )
74+ bool  is_compiler (
75+     const  char  * name ,
76+     bake_src_lang  lang )
7677{
77-     if  (!strncmp (cc (lang ), "clang" , 5 )) {
78+     const  char  * compiler  =  cc (lang );
79+     size_t  name_len  =  strlen (name );
80+ 
81+     /* First test if user is running clang from a non-standard path. */ 
82+     const  char  * cc_command  =  strrchr (compiler , UT_OS_PS [0 ]);
83+     if  (!cc_command ) {
84+         cc_command  =  name ;
85+     } else  {
86+         cc_command  ++ ;
87+     }
88+ 
89+     if  (!strncmp (cc_command , compiler , name_len )) {
7890        return  true;
91+     } else  {
92+         return  false;
7993    }
80-     return  false;
94+ }
95+ 
96+ /* Is current compiler clang */ 
97+ static 
98+ bool  is_clang (bake_src_lang  lang )
99+ {
100+     return  is_compiler ("clang" , lang );
81101}
82102
83103/* Is current compiler emcc */ 
84104static  
85105bool  is_emcc (void ) {
86-     if  (!strncmp (cc (false), "emcc" , 4 )) {
87-         return  true;
88-     }
89-     return  false;
106+     return  is_compiler ("emcc" , 0 );
90107}
91108
92109/* Is current compiler icc */ 
93110static  
94111bool  is_icc (void ) {
95-     if  (!strncmp (cc (false), "icc" , 3 )) {
96-         return  true;
97-     }
98-     return  false;
112+     return  is_compiler ("icc" , 0 );
99113}
100114
101115static 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments