context.Result( ret[0] )
return ret[0]
+@env.ConfTest()
+def CheckExpression(context, name, expression, header="", language="C"):
+ import SCons.Conftest
+
+ lang, suffix, msg = SCons.Conftest._lang2suffix(language)
+ if msg:
+ context.Message("Cannot check for header file %s: \n" % header_name)
+ context.Result(msg)
+ return False
+
+ text = ("#include <assert.h>\n"
+ "%s\n"
+ "int main() {\n"
+ "%s;\n"
+ "return 0;\n"
+ "}\n") % (header, expression)
+
+ context.Message("Checking for valid %s expression %s... " % (lang, expression))
+ ret = context.TryLink(text, suffix)
+ context.Result(ret)
+ if ret:
+ import re
+ key = name.upper()
+ key = re.sub('[^A-Z0-9_]', '_', key)
+ context.sconf.Define("HAVE_%s" % key,
+ 1,
+ "Define to 1 if the expression `%s' is valid on your system"
+ % expression)
+
+ return ret
+
###########################################################################
conf = env.Configure(clean=False, help=False, config_h="#/senf/autoconf.hh")
# Standard library stuff
res = conf.CheckFunc("timerfd_create")
+res = conf.CheckExpression("le16toh", "le16toh(0)",
+ "#include <senf/Packets/80211Bundle/radiotap/platform.h>")
+res = conf.CheckExpression("le32toh", "le32toh(0)",
+ "#include <senf/Packets/80211Bundle/radiotap/platform.h>")
res = conf.CheckSTLCopyN(); \
conf.env.Fail(condition=not res, message="No 'copy_n' implementation found")
SConscript(env.Glob("*/SConscript"))
-SENFSCons.AutoPacketBundle(env, '80211Bundle', subdirs=['radiotap'])
+SENFSCons.AutoPacketBundle(env, '80211Bundle',
+ subdirs=['radiotap'], exclude=['radiotap/radiotap.c'])
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2010
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# include <senf/autoconf.hh>
+#
+# ifndef HAVE_LE16TOH
+# define le16toh(x) (x)
+# endif
+#
+# ifndef HAVE_LE32TOH
+# define le32toh(x) (x)
+# endif
+#
+# include "radiotap/radiotap.c"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
import SENFSCons
env.SetDefault(
- RADIOTAP_FILES = env.Glob("*.h") + env.Glob("*.c"),
RADIOTAP_URL = 'http://git.sipsolutions.net/radiotap.git',
)
'update-radiotap', [],
[ Delete('$GITDIR'),
'git clone $RADIOTAP_URL $GITDIR',
- 'cp $_RADIOTAP_FILES $HERE',
+ 'cp $RADIOTAP_FILES $HERE',
Delete('$GITDIR') ],
- HERE = env.Dir('.'),
- GITDIR = env.Dir('radiotap.git'),
- _RADIOTAP_FILES = [ env.Dir('radiotap.git').File(f)
- for f in env.Flatten(env.subst_list('$RADIOTAP_FILES')) ])
+ HERE = env.Dir('.'),
+ GITDIR = env.Dir('radiotap.git'),
+ RADIOTAP_FILES = [ env.Dir('radiotap.git').File(f)
+ for f in env.Glob("*.h") + env.Glob("*.c") ])