ó
!Æ^c           @   s  d  Z  d d l m Z d d l m Z d d l m Z m Z m Z d Z	 d Z
 e d ƒ e d ƒ d	 „  ƒ ƒ Z e d e d
 „ ƒ Z d Z d d d g Z e d „  ƒ Z d Z e d „  ƒ Z d Z d e j f d „  ƒ  YZ e d ƒ e d ƒ d „  ƒ ƒ Z e d „  ƒ Z d S(   s   
Various configuration tests.
iÿÿÿÿ(   t   Task(   t   conf(   t   featuret   before_methodt   after_methods†   
#ifdef _MSC_VER
#define testEXPORT __declspec(dllexport)
#else
#define testEXPORT
#endif
testEXPORT int lib_func(void) { return 9; }
sÒ   
#ifdef _MSC_VER
#define testEXPORT __declspec(dllimport)
#else
#define testEXPORT
#endif
testEXPORT int lib_func(void);
int main(int argc, char **argv) {
	(void)argc; (void)argv;
	return !(lib_func() == 9);
}
t   link_lib_testt   process_sourcec         C   s  d „  } g  } t  |  d t ƒ r? |  j j j ƒ  j ƒ  g } n  |  j } d | | f } |  j rg d pj d } |  j } | d | d d | d	 t ƒ | d | d d
 | d	 t	 ƒ | d d | d d | d d ƒ | d d | | f d d
 | d d d d d | ƒ d S(   sÊ   
	The configuration test :py:func:`waflib.Configure.run_build` declares a unique task generator,
	so we need to create other task generators from here to check if the linker is able to link libraries.
	c         S   s   |  j  d j |  j j ƒ d  S(   Ni    (   t   outputst   writet	   generatort   code(   t   task(    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   write_test_file*   s    t	   add_rpaths   %s %st	   test_exect    t   rulet   targets   test.R
   s   main.t   featuress   %sshlibt   sourcet   tests   %sprogram %st   appt   uset   rpathN(
   t   getattrt   Falset   bldt   patht   get_bldt   abspatht   modeR   t   LIB_CODEt	   MAIN_CODE(   t   selfR   R   R   t   mt   exR   (    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   link_lib_test_fun#   s    			!c         C   sP   | s$ d } |  j  j r$ d } q$ n  |  j d g  d d d d d | d	 | ƒ d
 S(   s§   
	Checks if libraries can be linked with the current linker. Uses :py:func:`waflib.Tools.c_tests.link_lib_test_fun`.

	:param mode: c or cxx or d
	:type mode: string
	t   ct   cxxt   compile_filenameR   R   t   msgs   Checking for librariesR   R   N(   t   envt   CXXt   check(   R!   R   R   (    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   check_library:   s    	s^   
typedef int foo_t;
static %s foo_t static_foo () {return 0; }
%s foo_t foo () {
	return 0;
}
t   inlinet
   __inline__t   __inlinec         K   sø   |  j  d ƒ d | k r& d | d <n  d | k r^ |  j j rN d g | d <q^ d g | d <n  x† t D]~ } t | | f | d <y |  j | �  Wn |  j j k
 r¬ qe qe X|  j | ƒ | d k rß |  j	 d | d	 t
 ƒn  | Sqe W|  j d
 ƒ d S(   sž  
	Checks for the right value for inline macro.
	Define INLINE_MACRO to 1 if the define is found.
	If the inline macro is not 'inline', add a define to the ``config.h`` (#define inline __inline__)

	:param define_name: define INLINE_MACRO by default to 1 if the macro is defined
	:type define_name: string
	:param features: by default *c* or *cxx* depending on the compiler present
	:type features: list of string
	s   Checking for inlinet   define_namet   INLINE_MACROR   R&   R%   t   fragmentR-   t   quotes   could not use inline functionsN(   t	   start_msgR)   R*   t   INLINE_VALUESt   INLINE_CODER+   t   errorst   ConfigurationErrort   end_msgt   defineR   t   fatal(   R!   t   kwt   x(    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   check_inlineX   s$    sp   #include <unistd.h>
int main(int argc, char **argv) {
	(void)argc; (void)argv;
	return !(sizeof(off_t) >= 8);
}
c         K   s?  d | k r d | d <n  d | k r2 t  | d <n  d | k rp |  j j r] d d g | d <qp d d g | d <n  t | d	 <d
 | d <t  } y( |  j j d k r± |  j | �  } n  Wn |  j j k
 rË n X| rÖ t  Sd | d <d g | d <y |  j | �  } Wn |  j j k
 rn X|  j d d ƒ | S|  j	 d ƒ d S(   s$  
	Checks for large file support and define the macro HAVE_LARGEFILE
	The test is skipped on win32 systems (DEST_BINFMT == pe).

	:param define_name: define to set, by default *HAVE_LARGEFILE*
	:type define_name: string
	:param execute: execute the test (yes by default)
	:type execute: bool
	R0   t   HAVE_LARGEFILEt   executeR   R&   t
   cxxprogramR%   t   cprogramR2   s   Checking for large file supportR(   t   pes#   Checking for -D_FILE_OFFSET_BITS=64s   _FILE_OFFSET_BITS=64t   definest   _FILE_OFFSET_BITSi@   s#   There is no support for large filesN(
   t   TrueR)   R*   t   LARGE_FRAGMENTt   DEST_BINFMTR+   R7   R8   R:   R;   (   R!   R<   t   ret(    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   check_large_file…   s6    


sÈ  
short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
int use_ascii (int i) {
	return ascii_mm[i] + ascii_ii[i];
}
short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
int use_ebcdic (int i) {
	return ebcdic_mm[i] + ebcdic_ii[i];
}
extern int foo;
t   grep_for_endiannessc           B   s   e  Z d  Z d Z d „  Z RS(   sB   
	Task that reads a binary and tries to determine the endianness
	t   PINKc         C   s€   |  j  d j d d ƒ j d ƒ } | j d ƒ d k rM |  j j j d ƒ n/ | j d ƒ d k rx |  j j j d	 ƒ n d Sd  S(
   Ni    t   flagst   rbs   latin-1t   LiTTleEnDianiÿÿÿÿt   littlet   BIGenDianSySt   big(   t   inputst   readt   decodet   findR	   t   tmpt   append(   R!   t   txt(    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   runÉ   s    "(   t   __name__t
   __module__t   __doc__t   colorRZ   (    (    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyRK   Ä   s   c         C   s"   |  j  d |  j d j d ƒ d S(   s-   
	Used by the endianness configuration test
	RK   i    N(   t   create_taskt   compiled_tasksR   (   R!   (    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   grep_for_endianness_funÒ   s    c            sQ   g  ‰  ‡  f d †  } |  j  d t d d d d d d d	 ˆ  d
 | d d ƒ ˆ  d S(   s=   
	Executes a configuration test to determine the endianness
	c            s   ˆ  d S(   Ni    (    (   R!   (   RW   (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt	   check_msgà   s    R2   R   s   c grep_for_endiannessR(   s   Checking for endiannessR:   t
   ENDIANNESSRW   t   okmsgt	   confcachei    N(   R+   t   ENDIAN_FRAGMENTt   None(   R!   Rb   (    (   RW   s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   check_endiannessÚ   s    N(   R]   t   waflibR    t   waflib.ConfigureR   t   waflib.TaskGenR   R   R   R   R    R$   Rg   RF   R,   R6   R5   R>   RG   RJ   Rf   RK   Ra   Rh   (    (    (    s7   /git_repos/PolyLV2/poly_mclk_in/waflib/Tools/c_tests.pyt   <module>   s&   		+=	