3
­?d]á  ã               @   sT   d Z ddlmZmZmZ ddlZdd„ Zdd„ Z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.

é    )ÚdivisionÚabsolute_importÚprint_functionNc             C   sB   | j ƒ  tjdƒ}x*dD ]"}| j|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ÚinlineÚ
__inline__Ú__inlineNÚ )r   r   r   )Ú_check_compilerÚtextwrapÚdedentÚtry_compile)ÚcmdÚbodyÚkwÚst© r   úA/tmp/pip-build-op5p2y5_/numpy/numpy/distutils/command/autodist.pyÚcheck_inline
   s    

r   c             C   sB   | j ƒ  tjdƒ}x*dD ]"}| j|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;
        }
        ÚrestrictÚ__restrict__Ú
__restrictNr   )r   r   r   )r	   r
   r   r   )r   r   r   r   r   r   r   Úcheck_restrict!   s    
r   c             C   s    | j ƒ  tjdƒ}| j|ddƒS )z)Return True if the C compiler is GCC 4.x.z±
        int
        main()
        {
        #if (! defined __GNUC__) || (__GNUC__ < 4)
        #error gcc >= 4 required
        #endif
            return 0;
        }
        N)r	   r
   r   r   )r   r   r   r   r   Úcheck_compiler_gcc43   s    	r   c             C   s,   | j ƒ  tjdƒ||f }| j|ddƒdkS )z9Return True if the given function attribute is supported.zÔ
        #pragma GCC diagnostic error "-Wattributes"
        #pragma clang diagnostic error "-Wattributes"

        int %s %s(void*);

        int
        main()
        {
            return 0;
        }
        Nr   )r	   r
   r   r   )r   Ú	attributeÚnamer   r   r   r   Úcheck_gcc_function_attributeC   s    r   c             C   s0   | j ƒ  tjdƒ||||f }| j|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_intrinsicsU   s    r   c             C   s*   | j ƒ  tjdƒ|f }| j|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_attributek   s    r   )Ú__doc__Ú
__future__r   r   r   r
   r   r   r   r   r   r   r   r   r   r   Ú<module>   s   