From: g0dil Date: Thu, 30 Sep 2010 14:07:49 +0000 (+0000) Subject: Add configure check for timerfd.h path X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=1434d9ffc860a7b90da5b00d90a094f4ef20fab4;p=senf.git Add configure check for timerfd.h path git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1723 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/SConfigure b/SConfigure index 249f9b7..ebf2ae6 100644 --- a/SConfigure +++ b/SConfigure @@ -84,6 +84,7 @@ res = conf.CheckCXXHeader("boost/bimap.hpp"); \ res = conf.CheckTempBufferStrategy() # Standard library stuff +res = conf.FindCHeader("timerfd.h", [ 'sys', 'linux' ]) res = conf.CheckFunc("timerfd_create") res = conf.CheckSymbolWithExpression( "le16toh", "le16toh(0)", "#include ") diff --git a/senf/Scheduler/TimerSource.cc b/senf/Scheduler/TimerSource.cc index dea043b..0c3214a 100644 --- a/senf/Scheduler/TimerSource.cc +++ b/senf/Scheduler/TimerSource.cc @@ -29,7 +29,7 @@ // Custom includes #include "IdleEvent.hh" #ifdef HAVE_TIMERFD_CREATE -#include +#include TIMERFD_H_PATH #endif #include "senf/Utils/IgnoreValue.hh" diff --git a/site_scons/site_tools/CustomTests.py b/site_scons/site_tools/CustomTests.py index e482f80..6128ea6 100644 --- a/site_scons/site_tools/CustomTests.py +++ b/site_scons/site_tools/CustomTests.py @@ -1,5 +1,5 @@ import SCons.Environment, SCons.Util, SCons.Script, SCons.Conftest -import re +import re, os.path # Fix for SCons 0.97 compatibility import SCons.SConf @@ -140,14 +140,17 @@ def CheckSymbolWithExpression(context, symbol, expression, header="", language=" @DefaultTest def CheckByteorder(context): context.Message("Checking byteorder... ") - ret = context.TryRun('#include \n' - 'union byteorder_test { int i; char b; };\n' - 'int main() {\n' - ' union byteorder_test t; t.i=1;\n' - ' printf(t.b ? "little\\n" : "big\\n");\n' - ' return 0;\n' - '}\n', - ".c")[-1].strip() + if context.env.has_key("BYTEORDER"): + ret = context.env["BYTEORDER"] + else: + ret = context.TryRun('#include \n' + 'union byteorder_test { int i; char b; };\n' + 'int main() {\n' + ' union byteorder_test t; t.i=1;\n' + ' printf(t.b ? "little\\n" : "big\\n");\n' + ' return 0;\n' + '}\n', + ".c")[-1].strip() if not ret: context.Result("failed") return False @@ -157,6 +160,23 @@ def CheckByteorder(context): "Define BYTEORDER_LITTLE_ENDIAN or BYTEORDER_BIG_ENDIAN") return ret +@DefaultTest +def FindCHeader(context, name, dirs): + defn = name.upper() + defn = re.sub('[^A-Z0-9_]', '_', defn) + defn += "_PATH" + + context.Message("Checking for %s... " % name) + for dir in dirs: + path = os.path.join(dir, name); + ret = context.TryCompile("#include <%s>" % path, ".c"); + if ret: + context.Result(path) + context.sconf.Define(defn, "<%s>" % path, + "Define %s as " % (defn, name)) + return ret + return False + def generate(env): env.Append( CUSTOM_TESTS = DefaultTest.tests ) env._CustomTests_orig_Configure = env.Configure