
    e                     D    d Z ddlZddlZdgZd Zd Zd Zd Zd Zd	 Z	dS )
z Based on numpy's approach to exposing compiler features via a config header.
Unfortunately that file is not exposed, so re-implement the portions we need.
    N)HAVE_ATTRIBUTE_OPTIMIZE_OPT_3z__attribute__((optimize("O3")))c                     t          | j        dd          }t          |t                    r|                                }|S )a   Return the compiler command as a list of strings. Distutils provides a
    wildly inconsistent API here:
      - UnixCCompiler returns a list
      - MSVCCompiler intentionally doesn't set this variable
      - CygwinCompiler returns a string

    As we are focused on identifying gcc vs clang right now, we ignore MSVC's
    bad result and convert all results into lists of strings
    compiler )getattrr   
isinstancestrsplit)cmdr   s     8lib/python3.11/site-packages/bottleneck/src/bn_config.py_get_compiler_listr      s=     s|Z44H(C   $>>##O    c                 N    t          d t          |           D                       S )Nc              3      K   | ]}d |v V  	dS )gccN .0xs     r   	<genexpr>zis_gcc.<locals>.<genexpr>   s&      ;;auz;;;;;;r   anyr   r   s    r   is_gccr      s(    ;;#5c#:#:;;;;;;r   c                 N    t          d t          |           D                       S )Nc              3      K   | ]}d |v V  	dS )clangNr   r   s     r   r   zis_clang.<locals>.<genexpr>!   s&      ==w!|======r   r   r   s    r   is_clangr       s(    ==%7%<%<======r   c                     |                                   t          j        d          }dD ]$}|                     |d|iz  dd          }|r|c S %dS )z,Return the inline identifier (may be empty).an  
        #ifndef __cplusplus
        static %(inline)s int static_func (void)
        {
            return 0;
        }
        %(inline)s int nostatic_func (void)
        {
            return 0;
        }
        #endif
        int main(void) {
            int r1 = static_func();
            int r2 = nostatic_func();
            return r1 + r2;
        }
        )inline
__inline____inliner    Nr   )_check_compilertextwrapdedenttry_compile)r   bodykwsts       r   check_inliner*   $   sv    ?	 D( 3  __TXrN2D$?? 	III	 2r   c                     |                                   t          |           rd}nt          |           rd}nd}t          j        d          |||fz  }|                     |dd          dk    S )z9Return True if the given function attribute is supported.z+#pragma GCC diagnostic error "-Wattributes"z-#pragma clang diagnostic error "-Wattributes"r   zq
        %s

        int %s %s(void*);

        int main(void)
        {
            return 0;
        }
        Nr   )r#   r   r   r$   r%   r&   )r   	attributenamepragmar'   s        r   check_gcc_function_attributer/   C   s    c{{ >	# @ 			
 	
 9d
#	$ 	 ??4t,,11r   c                 @   t           j                            t                    }t           j                            |d          }t           j                            |          r;t          j        t                    j        t          j        |          j        k     rd S g }t          D ]W\  }}t          | ||
                                          r|                    |df           @|                    |df           Xt          |           }t          |d          5 }|D ]}|                     dj        |             |dk    r|                    d           n(|                    d                    |                     d d d            d S # 1 swxY w Y   d S )	Nzbn_config.h10wz#define {} {}
r    z/* undef inline */
z#define inline {}
)ospathdirname__file__joinexistsstatst_mtimeOPTIONAL_FUNCTION_ATTRIBUTESr/   lowerappendr*   openwriteformat)	configr6   config_houtputconfig_attr	func_attrinline_aliasfsettings	            r   create_config_hrJ   _   s   gooh''Gw||G]33H 	x  GH&):):)CCCF"> . .Y'	;;L;L;N;NOO 	.MM;,----MM;,----''L	h		 @ 	8 	8GGG,%,g677778##GG*++++GG)00>>???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @s   A'FFF)
__doc__r4   r$   r<   r   r   r   r*   r/   rJ   r   r   r   <module>rL      s     
			  I  
   < < <> > >  >2 2 28@ @ @ @ @r   