B
    îè´c†  ã               @   sJ   d Z ddlZdd„ Zdd„ Zdd„ Zdd	d
„Zdd„ Zdd„ Zdd„ ZdS )zKThis module implements additional tests ala autoconf which can be useful.

é    Nc             C   sB   |   ¡  t d¡}x*dD ]"}|  |d|i dd¡}|r|S qW dS )z,Return the inline identifier (may be empty).zÜ
        #ifndef __cplusplus
        static %(inline)s int static_func (void)
        {
            return 0;
        }
        %(inline)s int nostatic_func (void)
        {
            return 0;
        }
        #endif)ÚinlineZ
__inline__Z__inliner   NÚ )Ú_check_compilerÚtextwrapÚdedentÚtry_compile)ÚcmdÚbodyÚkwÚst© r   úC/tmp/pip-install-v41xt_bg/numpy/numpy/distutils/command/autodist.pyÚcheck_inline   s    

r   c             C   sB   |   ¡  t d¡}x*dD ]"}|  |d|i dd¡}|r|S qW dS )z.Return the restrict identifier (may be empty).zj
        static int static_func (char * %(restrict)s a)
        {
            return 0;
        }
        )ÚrestrictZ__restrict__Z
__restrictr   Nr   )r   r   r   r   )r   r	   r
   r   r   r   r   Úcheck_restrict   s    
r   c             C   s    |   ¡  t d¡}|  |dd¡S )zCheck if the compiler is GCC.zš
        int
        main()
        {
        #if (! defined __GNUC__)
        #error gcc required
        #endif
            return 0;
        }
        N)r   r   r   r   )r   r	   r   r   r   Úcheck_compiler_gcc1   s    	r   c             C   sN   |   ¡  d t|ƒt|ƒt|ƒg¡}t d¡}||||dœ}|  || dd¡S )zB
    Check that the gcc version is at least the specified version.Ú.a1  
        int
        main()
        {
        #if (! defined __GNUC__) || (__GNUC__ < %(major)d) || \
                (__GNUC_MINOR__ < %(minor)d) || \
                (__GNUC_PATCHLEVEL__ < %(patchlevel)d)
        #error gcc >= %(version)s required
        #endif
            return 0;
        }
        )ÚversionÚmajorÚminorÚ
patchlevelN)r   ÚjoinÚstrr   r   r   )r   r   r   r   r   r	   r
   r   r   r   Úcheck_gcc_version_at_leastB   s    r   c             C   s,   |   ¡  t d¡||f }|  |dd¡dkS )z9Return True if the given function attribute is supported.a  
        #pragma GCC diagnostic error "-Wattributes"
        #pragma clang diagnostic error "-Wattributes"

        int %s %s(void* unused)
        {
            return 0;
        }

        int
        main()
        {
            return 0;
        }
        Nr   )r   r   r   r   )r   Ú	attributeÚnamer	   r   r   r   Úcheck_gcc_function_attributeZ   s    r   c             C   s0   |   ¡  t d¡||||f }|  |dd¡dkS )zMReturn True if the given function attribute is supported with
    intrinsics.z¶
        #include<%s>
        int %s %s(void)
        {
            %s;
            return 0;
        }

        int
        main()
        {
            return 0;
        }
        Nr   )r   r   r   r   )r   r   r   ÚcodeÚincluder	   r   r   r   Ú,check_gcc_function_attribute_with_intrinsicso   s    r   c             C   s*   |   ¡  t d¡|f }|  |dd¡dkS )z9Return True if the given variable attribute is supported.zÎ
        #pragma GCC diagnostic error "-Wattributes"
        #pragma clang diagnostic error "-Wattributes"

        int %s foo;

        int
        main()
        {
            return 0;
        }
        Nr   )r   r   r   r   )r   r   r	   r   r   r   Úcheck_gcc_variable_attribute…   s    r    )r   r   )	Ú__doc__r   r   r   r   r   r   r   r    r   r   r   r   Ú<module>   s   
