; 1B?c@sdZdkZdklZeedZeedZeeedZeeedZeeeeddZ d Z d Z d Z d Z dS( sXSCons.Conftest Autoconf-like configuration support; low level implementation of tests. N(sIntTypecCst|\}}}|o|id||Sn| o d}n|id||i||}t ||t ||SdS(s Configure check to see if the compiler works. Note that this uses the current value of compiler and linker flags, make sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. "language" should be "C" or "C++" and is used to select the compiler. Default is "C". "text" may be used to specify the code to be build. Returns an empty string for success, an error message for failure. s%s sW int main() { return 0; } s(Checking if building a %s file works... N( s _lang2suffixslanguageslangssuffixsmsgscontextsDisplaystexts BuildProgsrets _YesNoResultsNone(scontextstextslanguageslangssuffixsretsmsg((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys CheckBuilderks  c Cs|iod|i} nd} | od|}nt|\}}}|o|i d||f|Sndhd|<d| <d|<}|i d ||f|i ||}t||d |||Sd S( s7 Configure check for a function "function_name". "language" should be "C" or "C++" and is used to select the compiler. Default is "C". Optional "header" can be defined to define a function prototype, include a header file or anything else that comes before main(). Sets HAVE_function_name in context.havedict according to the result. Note that this uses the current value of compiler and linker flags, make sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. Returns an empty string for success, an error message for failure. s #include "%s"ssp #ifdef __cplusplus extern "C" #endif char %s();sCannot check for %s(): %s sb %(include)s #include %(hdr)s int main() { #if defined (__stub_%(name)s) || defined (__stub___%(name)s) fail fail fail #else %(name)s(); #endif return 0; } snamesincludeshdrs!Checking for %s function %s()... sHAVE_N(scontextsheaderfilenames includetextsheaders function_names _lang2suffixslanguageslangssuffixsmsgsDisplaystexts BuildProgsrets _YesNoResult( scontexts function_namesheaderslanguageslangssuffixstextsretsmsgs includetext((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys CheckFuncs  %c Cs|iod|i} nd} | o d}nt|\}} }|o|i d||f|Sn| o d}nd| ||d||df}|i d||f|i || }t||d |||Sd S( s. Configure check for a C or C++ header file "header_name". Optional "header" can be defined to do something before including the header file (unusual, supported for consistency). "language" should be "C" or "C++" and is used to select the compiler. Default is "C". Sets HAVE_header_name in context.havedict according to the result. Note that this uses the current value of compiler and linker flags, make sure $CFLAGS and $CPPFLAGS are set correctly. Returns an empty string for success, an error message for failure. s#include "%s" ss$Cannot check for header file %s: %s s<>s%s%s #include %s%s%s iis"Checking for %s header file %s... sHAVE_N(scontextsheaderfilenames includetextsheaders _lang2suffixslanguageslangssuffixsmsgsDisplays header_namesinclude_quotesstexts CompileProgsrets _YesNoResult( scontexts header_namesheaderslanguagesinclude_quotesslangstextsretsmsgs includetextssuffix((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys CheckHeaders"   !c Cs*|iod|i} nd} | o d}nt|\}}} | o|i d|| f| Sndhd| <d|<d|<}|i d||f|i ||} t|| d ||| o|o|io7t|id }|id ||f|in| Sd S( s Configure check for a C or C++ type "type_name". Optional "header" can be defined to include a header file. "language" should be "C" or "C++" and is used to select the compiler. Default is "C". Sets HAVE_type_name in context.havedict according to the result. Note that this uses the current value of compiler and linker flags, make sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. Returns an empty string for success, an error message for failure. s #include "%s"ssCannot check for %s type: %s s %(include)s %(header)s int main() { if ((%(name)s *) 0) return 0; if (sizeof (%(name)s)) return 0; } sincludesheadersnamesChecking for %s type %s... sHAVE_sastypedef %s %s; N(scontextsheaderfilenames includetextsheaders _lang2suffixslanguageslangssuffixsmsgsDisplays type_namestexts BuildProgsrets _YesNoResultsfallbacksopensfswritesclose( scontexts type_namesfallbacksheaderslanguageslangssuffixsfstextsretsmsgs includetext((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys CheckTypes&    % icCs|iod|i} nd} | o d}nt|\}}} | o|i d|| f| Snd| |f} |o|djo| o| d|} n| od|}n| d|} ti|d }|d jo|| d } n&|d d jo|d } n|} |i d| ||f|o>|g}|o|i|n|i|}d|}n d }t}|i| |} t|| || |d jo | p| o|i|n| SdS(s Configure check for a C or C++ library "lib_name". Tests if "func_name" or "call" exists in the library. Note: if it exists in another library the test succeeds anyway! Optional "header" can be defined to include a header file. If not given a default prototype for "func_name" is added. Optional "extra_libs" is a list of library names to be added after "lib_name" in the build command. To be used for libraries that "lib_name" depends on. Optional "call" replaces the call to "func_name" in the test code. It must consist of complete C statements, including a trailing ";". There must either be a "func_name" or a "call" argument (or both). "language" should be "C" or "C++" and is used to select the compiler. Default is "C". Note that this uses the current value of compiler and linker flags, make sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly. Returns an empty string for success, an error message for failure. s #include "%s"ss Cannot check for library %s: %s s %s %s smainsp #ifdef __cplusplus extern "C" #endif char %s();s%s();sg int main() { %s return 0; } s is..is;s$Checking for %s in %s library %s... sHAVE_LIBN(scontextsheaderfilenames includetextsheaders _lang2suffixslanguageslangssuffixsmsgsDisplayslib_namestexts func_namescallsstringsfindsiscalltextsls extra_libssextends AppendLIBSsoldLIBSssymsNones BuildProgsrets _YesNoResultsautoaddsSetLIBS(scontextslib_names func_namesheaders extra_libsscallslanguagesautoaddssuffixstextscalltextsretsmsgs includetextssymsoldLIBSslangsisl((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pysCheckLib4sH    cCsU|ot||| n|o!|idt|||n|iddS(s Handle the result of a test with a "yes" or "no" result. "ret" is the return value: empty if OK, error message when not. "key" is the name of the symbol to be defined (HAVE_foo). "text" is the source code of the program used for testing. sno syes N(skeys_HavescontextsretsDisplays _LogFailedstext(scontextsretskeystext((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys _YesNoResults cCs-ti|}ti|dd}ti|dd}ti|dd}ti|dd}||i|<|iot |id}|djo|i d|nn|d jo|i d |nLt |t jo|i d ||fn|i d |t|f|ind S(s Store result of a test in context.havedict and context.headerfilename. "key" is a "HAVE_abc" name. It is turned into all CAPITALS and ":./" are replaced by an underscore. The value of "have" can be: 1 - Feature is defined, add "#define key". 0 - Feature is not defined, add "/* #undef key */". Adding "undef" is what autoconf does. Not useful for the compiler, but it shows that the test was done. number - Feature is defined to this number "#define key have". Doesn't work for 0 or 1, use a string then. string - Feature is defined to this string "#define key have". Give "have" as is should appear in the header file, include quotes when desired and escape special characters! s:s_s.s/s sais #define %s is/* #undef %s */ s#define %s %d s#define %s %s N(sstringsupperskeyskey_upsreplaceshavescontextshavedictsheaderfilenamesopensfswritestypesIntTypesstrsclose(scontextskeyshavesfskey_up((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys_Haves"    cCs|idti|d}t|o|ddjo|d }nd}x/|D]'}|id||f|d}qXW|id|dS( sr Write to the log about a failed program. Add line numbers, so that error messages can be understood. sFailed program was: s isis%d: %s sError message: %s N( scontextsLogsstringssplitstextslinesslensnslinesmsg(scontextstextsmsgslinessnsline((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys _LogFaileds cCsn| p|ddgjoddtfSn|dddddgjodd tfSnttd |fSd S( s` Convert a language name to a suffix. When "lang" is empty or None C is assumed. Returns a tuple (lang, suffix, None) when it works. For an unrecognized language returns (None, None, msg). Where: lang = the unified language name suffix = the suffix, including the leading dot msg = an error message sCscs.csc++sC++scppsCXXscxxs.cppsUnsupported language: %sN(slangsNone(slang((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys _lang2suffixs (s__doc__sstringstypessIntTypesNones CheckBuilders CheckFuncs CheckHeaders CheckTypesCheckLibs _YesNoResults_Haves _LogFaileds _lang2suffix( sIntTypesstrings _YesNoResults_Haves CheckTypes _lang2suffixs _LogFaileds CheckFuncs CheckHeaders CheckBuildersCheckLib((s-/mnt/gmirror/ports/devel/aap/work/Conftest.pys?sZ  B/=Y  #