mò &U²Ic@s©dZdZdkZdkZdkZdkZdkTdklZdk l Z dk l Z dk lZhdd <d d  s iÿÿÿÿ( tLANG_EXTtlangtfilenametopentfiletheaderstheadertwritetbodytclose(R R2R/R+R0R,R.((Rt_gen_temp_sourcefileus  cCsT|i|||ƒ}d}|ii||gƒ|i i ||d|ƒ||fS(Ns _configtest.iR ( R R4R2R/R+tsrctoutRtextendR t preprocessR (R R2R/R R+R5R6((Rt _preprocess‚s cCs…|i|||ƒ}|iot|d|ƒn|ii |gƒ\}|i i ||gƒ|ii |gd|ƒ||fS(Nscompiling '%s':R (R R4R2R/R+R5Rt dump_fileR tobject_filenamestobjRR7tcompileR (R R2R/R R+R5R<((Rt_compile‰s c Cs¬|i||||ƒ\}}ti i ti i |ƒƒd} |i i|g| d|d|d|ƒ|i idj o| |i i} n|ii| ƒ||| fS(NiRRt target_lang(R R>R2R/R R+R5R<RtpathtsplitexttbasenametprogR tlink_executableRRt exe_extensionR Rtappend( R R2R/R RRR+R<R5RC((Rt_link’s" cGsr|p|i}g|_ntidti|ƒƒx5|D]-}yti |ƒWq=t j oq=Xq=WdS(Ns removing: %s( t filenamesR RtlogtinfoRtjoinR,RtremovetOSError(R RHR,((Rt_clean¢s  RcCsadkl}|iƒd}y|i||||ƒWn|j o d}nX|i ƒ|S(sQConstruct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('body' probably isn't of much use, but what the heck.) (s CompileErroriiN( Rt CompileErrorR R'tokR9R2R/R R+RN(R R2R/R R+RPRO((Rttry_cpp¸s    c Cs¹|iƒ|i||||ƒ\}} t |ƒt jot i |ƒ}nt| ƒ}d} x>|iƒ}|djoPn|i|ƒo d} PqcqcW|iƒ|iƒ| S(s´Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If both 'body' and 'headers' are None, preprocesses an empty file -- which can be useful to determine the symbols the preprocessor and compiler set by default. iitN(R R'R9R2R/R R+R5R6RtpatternRtreR=R-R.tmatchtreadlinetlinetsearchR3RN( R RSR2R/R R+R5R.RWR6RU((Rt search_cppÊs$       cCs|dkl}|iƒy |i||||ƒd}Wn|j o d}nXt i |odpdƒ|i ƒ|S(swTry to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. (s CompileErroriissuccess!sfailure.N( RROR R'R>R2R/R R+RPRIRJRN(R R2R/R R+RPRO((Rt try_compileès     c CsŽdkl} l}|iƒy&|i||||||ƒd}Wn| |fj o d}nXt i|odpdƒ|iƒ|S(sžTry to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise. (s CompileErrors LinkErroriissuccess!sfailure.N(RROt LinkErrorR R'RGR2R/R RRR+RPRIRJRN( R R2R/R RRR+RPR[RO((Rttry_linkøs     c Cs¬dkl} l} |iƒyA|i||||||ƒ\} }}|i|gƒd} Wn"| | tfj o d} nXti| odpdƒ|iƒ| S(sœTry to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. (s CompileErrors LinkErroriissuccess!sfailure.N(RROR[R R'RGR2R/R RRR+R5R<texetspawnRPtDistutilsExecErrorRIRJRN( R R2R/R RRR+R]R<R5R[RORP((Rttry_run s    ic Cs¢|iƒg}|o|id|ƒn|idƒ|o|id|ƒn|id|ƒ|idƒti|dƒd}|i |||||ƒS(sÛDetermine if function 'func' is available by constructing a source file that refers to 'func', and compiles and links it. If everything succeeds, returns true; otherwise returns false. The constructed source file starts out by including the header files listed in 'headers'. If 'decl' is true, it then declares 'func' (as "int func()"); you probably shouldn't supply 'headers' and set 'decl' true in the same call, or you might get errors about a conflicting declarations for 'func'. Finally, the constructed 'main()' function either references 'func' or (if 'call' is true) calls it. 'libraries' and 'library_dirs' are used when linking. s int %s ();s int main () {s %s();s %s;t}s N(R R'R2tdeclRFtfunctcallRRKR\R/R RR( R RcR/R RRRbRdR2((Rt check_func(s   cCs*|iƒ|id|||g||ƒS(sáDetermine if 'library' is available to be linked against, without actually checking that any particular symbols are provided by it. 'headers' will be used in constructing the source file to be compiled, but the only effect of this is to check if all the header files listed are available. Any libraries listed in 'other_libraries' will be included in the link, in case 'library' has symbols that depend on other libraries. sint main (void) { }N(R R'R\R/R tlibrarytother_librariesR(R RfRR/R Rg((Rt check_libLs   cCs|iddd|gd|ƒS(s¤Determine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise. R2s /* No body */R/R N(R RQR0R (R R0R RR+((Rt check_header[s(s compiler=Nsspecify the compiler type(scc=Nsspecify the compiler executable(s include-dirs=Rs.list of directories to search for header files(sdefine=RsC preprocessor macros to define(sundef=Rs!C preprocessor macros to undefine(s libraries=Rs!external C libraries to link with(s library-dirs=Rs.directories to search for external C libraries(snoisyNs1show every action (compile, link, run, ...) taken(s dump-sourceNs=dump generated source files before attempting to compile them(t__name__t __module__t descriptionR t user_optionsRRRR'R4R9R>RGRNRQRYRZR\R`ReRhRi(((RRs&!       $cCsO|djo |dGHn|GHt|ƒ}tii|iƒƒ|i ƒdS(Nt:( theadR R,R-R.tsyststdoutR1treadR3(R,RoR.((RR:hs    (t__doc__t __revision__RpRRRTttypestdistutils.coretCommandtdistutils.errorsR_tdistutils.sysconfigR#t distutilsRIR*RR R:( R#RtR_RRRpRTRwR*RR:RI((Rt? s$    ÿO