diff options
Diffstat (limited to 'src/engine/SCons/Conftest.py')
-rw-r--r-- | src/engine/SCons/Conftest.py | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 87a3022..abaf00d 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -101,7 +101,6 @@ Autoconf-like configuration support; low level implementation of tests. # import re -from types import IntType # # PUBLIC VARIABLES @@ -707,11 +706,12 @@ def CheckProg(context, prog_name): def _YesNoResult(context, ret, key, text, comment = None): """ 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. - "comment" is the C comment to add above the line defining the symbol (the - comment is automatically put inside a /* */). If None, no comment is added. + + :Parameters: + - `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. + - `comment` is the C comment to add above the line defining the symbol (the comment is automatically put inside a /\* \*/). If None, no comment is added. """ if key: _Have(context, key, not ret, comment) @@ -725,18 +725,20 @@ def _YesNoResult(context, ret, key, text, comment = None): def _Have(context, key, have, comment = None): """ Store result of a test in context.havedict and context.headerfilename. - "key" is a "HAVE_abc" name. It is turned into all CAPITALS and non- - alphanumerics are replaced by an underscore. + + :Parameters: + - `key` - is a "HAVE_abc" name. It is turned into all CAPITALS and non-alphanumerics are replaced by an underscore. + - `have` - value as it should appear in the header file, include quotes when desired and escape special characters! + - `comment` is the C comment to add above the line defining the symbol (the comment is automatically put inside a /\* \*/). If None, no comment is added. + + 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! + - 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". + + """ key_up = key.upper() key_up = re.sub('[^A-Z0-9_]', '_', key_up) @@ -745,7 +747,7 @@ def _Have(context, key, have, comment = None): line = "#define %s 1\n" % key_up elif have == 0: line = "/* #undef %s */\n" % key_up - elif isinstance(have, IntType): + elif isinstance(have, int): line = "#define %s %d\n" % (key_up, have) else: line = "#define %s %s\n" % (key_up, str(have)) @@ -787,10 +789,11 @@ def _lang2suffix(lang): 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 + - lang = the unified language name + - suffix = the suffix, including the leading dot + - msg = an error message """ if not lang or lang in ["C", "c"]: return ("C", ".c", None) |