# Append "lib_name_list" to the value of LIBS.
# "lib_namelist" is a list of strings.
# Return the value of LIBS before changing it (any type
-# can be used, it is passed to SetLIBS() later.
+# can be used, it is passed to SetLIBS() later.)
+#
+# context.PrependLIBS(lib_name_list)
+# Prepend "lib_name_list" to the value of LIBS.
+# "lib_namelist" is a list of strings.
+# Return the value of LIBS before changing it (any type
+# can be used, it is passed to SetLIBS() later.)
#
# context.SetLIBS(value)
# Set LIBS to "value". The type of "value" is what
# AppendLIBS() returned.
# Return the value of LIBS before changing it (any type
-# can be used, it is passed to SetLIBS() later.
+# can be used, it is passed to SetLIBS() later.)
#
# context.headerfilename
# Name of file to append configure results to, usually
_YesNoResult(context, ret, None, text)
return ret
-def _check_empty_program(context, comp, text, language):
+def CheckSHCC(context):
+ """
+ Configure check for a working shared C compiler.
+
+ This checks whether the C compiler, as defined in the $SHCC construction
+ variable, can compile a C source file. It uses the current $SHCCCOM value
+ too, so that it can test against non working flags.
+
+ """
+ context.Display("Checking whether the (shared) C compiler works")
+ text = """
+int foo()
+{
+ return 0;
+}
+"""
+ ret = _check_empty_program(context, 'SHCC', text, 'C', use_shared = True)
+ _YesNoResult(context, ret, None, text)
+ return ret
+
+def CheckCXX(context):
+ """
+ Configure check for a working CXX compiler.
+
+ This checks whether the CXX compiler, as defined in the $CXX construction
+ variable, can compile a CXX source file. It uses the current $CXXCOM value
+ too, so that it can test against non working flags.
+
+ """
+ context.Display("Checking whether the C++ compiler works")
+ text = """
+int main()
+{
+ return 0;
+}
+"""
+ ret = _check_empty_program(context, 'CXX', text, 'C++')
+ _YesNoResult(context, ret, None, text)
+ return ret
+
+def CheckSHCXX(context):
+ """
+ Configure check for a working shared CXX compiler.
+
+ This checks whether the CXX compiler, as defined in the $SHCXX construction
+ variable, can compile a CXX source file. It uses the current $SHCXXCOM value
+ too, so that it can test against non working flags.
+
+ """
+ context.Display("Checking whether the (shared) C++ compiler works")
+ text = """
+int main()
+{
+ return 0;
+}
+"""
+ ret = _check_empty_program(context, 'SHCXX', text, 'C++', use_shared = True)
+ _YesNoResult(context, ret, None, text)
+ return ret
+
+def _check_empty_program(context, comp, text, language, use_shared = False):
"""Return 0 on success, 1 otherwise."""
if not context.env.has_key(comp) or not context.env[comp]:
# The compiler construction variable is not set or empty
if msg:
return 1
- return context.CompileProg(text, suffix)
+ if use_shared:
+ return context.CompileSharedObject(text, suffix)
+ else:
+ return context.CompileProg(text, suffix)
def CheckFunc(context, function_name, header = None, language = None):
return st
def CheckLib(context, libs, func_name = None, header = None,
- extra_libs = None, call = None, language = None, autoadd = 1):
+ extra_libs = None, call = None, language = None, autoadd = 1,
+ append = True):
"""
Configure check for a C or C++ libraries "libs". Searches through
the list of libraries, until one is found where the test succeeds.
l = [ lib_name ]
if extra_libs:
l.extend(extra_libs)
- oldLIBS = context.AppendLIBS(l)
+ if append:
+ oldLIBS = context.AppendLIBS(l)
+ else:
+ oldLIBS = context.PrependLIBS(l)
sym = "HAVE_LIB" + lib_name
else:
oldLIBS = -1
# vim: set sw=4 et sts=4 tw=79 fo+=l:
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: