Package SCons :: Module Conftest
[show private | hide private]
[frames | no frames]

Module SCons.Conftest

SCons.Conftest

Autoconf-like configuration support; low level implementation of tests.

Function Summary
  CheckBuilder(context, text, language)
Configure check to see if the compiler works.
  CheckFunc(context, function_name, header, language)
Configure check for a function "function_name".
  CheckHeader(context, header_name, header, language, include_quotes)
Configure check for a C or C++ header file "header_name".
  CheckLib(context, libs, func_name, header, extra_libs, call, language, autoadd)
Configure check for a C or C++ libraries "libs".
  CheckType(context, type_name, fallback, header, language)
Configure check for a C or C++ type "type_name".
  CheckTypeSize(context, type_name, header, language, expect)
This check can be used to get the size of a given type, or to check whether the type is of expected size.

Function Details

CheckBuilder(context, text=None, language=None)

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.

CheckFunc(context, function_name, header=None, language=None)

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.

CheckHeader(context, header_name, header=None, language=None, include_quotes=None)

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.

CheckLib(context, libs, func_name=None, header=None, extra_libs=None, call=None, language=None, autoadd=1)

Configure check for a C or C++ libraries "libs". Searches through the list of libraries, until one is found where the test succeeds. 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 ";". Both "func_name" and "call" arguments are optional, and in that case, just linking against the libs is tested. "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.

CheckType(context, type_name, fallback=None, header=None, language=None)

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.

CheckTypeSize(context, type_name, header=None, language=None, expect=None)

This check can be used to get the size of a given type, or to check whether the type is of expected size.

Arguments:
  • type : str

    the type to check

  • includes : sequence

    list of headers to include in the test code before testing the type

  • language : str

    'C' or 'C++'

  • expect : int

    if given, will test wether the type has the given number of bytes. If not given, will automatically find the size.

Returns:
status : int
0 if the check failed, or the found size of the type if the check succeeded.

Generated by Epydoc 2.1 on Wed Dec 12 09:39:32 2007 http://epydoc.sf.net