[PATCH] waf: Update the check_cc tests to a newer method supported by waf.
chrisj at rtems.org
chrisj at rtems.org
Mon May 27 01:04:08 UTC 2019
From: Chris Johns <chrisj at rtems.org>
- Fix a minor issue in covoar's use of 64bit calls.
---
misc/wscript | 7 +++++--
rtemstoolkit/wscript | 19 +++++++++++++------
tester/covoar/CoverageReaderQEMU.cc | 2 +-
tester/covoar/wscript | 12 ++++++++++--
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/misc/wscript b/misc/wscript
index 95c7bde..cd31091 100644
--- a/misc/wscript
+++ b/misc/wscript
@@ -33,8 +33,11 @@ def options(opt):
def configure(conf):
conf.load('compiler_c')
- conf.check_cc(function_name = 'strnlen', header_name="string.h",
- features = 'c', mandatory = False)
+ conf.check_cc(fragment = '''
+ #include <string.h>
+ int main() { size_t l = strnlen("string", 10); } ''',
+ cflags = '-Wall', define_name = 'HAVE_STRNLEN',
+ msg = 'Checking for strnlen', mandatory = False)
conf.write_config_header('config.h')
def build(bld):
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index 2c126c8..d9f01b9 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -45,8 +45,12 @@ def configure(conf):
conf.find_program('m4')
conf.check(header_name = 'sys/wait.h', features = 'c', mandatory = False)
- conf.check_cc(function_name = 'kill', header_name="signal.h",
- features = 'c', mandatory = False)
+ conf.check_cc(fragment = '''
+ #include <sys/types.h>
+ #include <signal.h>
+ int main() { pid_t pid = 1234; int r = kill(pid, SIGKILL); } ''',
+ cflags = '-Wall', define_name = 'HAVE_KILL',
+ msg = 'Checking for kill', mandatory = False)
conf.write_config_header('config.h')
def build(bld):
@@ -383,10 +387,13 @@ def conf_libiberty(conf):
conf.check(header_name='unistd.h', features = 'c', mandatory = False)
conf.check(header_name='vfork.h', features = 'c', mandatory = False)
- conf.check_cc(function_name='getrusage',
- header_name="sys/time.h sys/resource.h",
- features = 'c', mandatory = False)
-
+ conf.check_cc(fragment = '''
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ int main() { struct rusage ru = {0}; int r = getrusage(RUSAGE_SELF, &ru); } ''',
+ cflags = '-Wall', define_name = 'HAVE_GETRUSAGE',
+ msg = 'Checking for getrusage', mandatory = False)
conf.write_config_header('libiberty/config.h')
def bld_libiberty(bld, conf):
diff --git a/tester/covoar/CoverageReaderQEMU.cc b/tester/covoar/CoverageReaderQEMU.cc
index 3d3b50f..7c344e4 100644
--- a/tester/covoar/CoverageReaderQEMU.cc
+++ b/tester/covoar/CoverageReaderQEMU.cc
@@ -21,7 +21,7 @@
#include "qemu-traces.h"
-#if HAVE_STAT64
+#if HAVE_OPEN64
#define OPEN fopen64
#else
#define OPEN fopen
diff --git a/tester/covoar/wscript b/tester/covoar/wscript
index 6f722c2..7efa0dd 100644
--- a/tester/covoar/wscript
+++ b/tester/covoar/wscript
@@ -54,8 +54,16 @@ def options(opt):
def configure(conf):
conf.load('compiler_cxx')
- conf.check_cc(function_name='open64', header_name="stdlib.h", mandatory = False)
- conf.check_cc(function_name='stat64', header_name="stdlib.h", mandatory = False)
+ conf.check_cc(fragment = '''
+ #include <stdlib.h>
+ int main() { FILE* f = fopen64("name", "r"); } ''',
+ cflags = '-Wall', define_name = 'HAVE_OPEN64',
+ msg = 'Checking for fopen64', mandatory = False)
+ conf.check_cc(fragment = '''
+ #include <sys/stat.h>
+ int main() { struct stat64 sb; int f = 3; int r = stat64(f, &sb); } ''',
+ cflags = '-Wall', define_name = 'HAVE_STAT64',
+ msg = 'Checking for stat64', mandatory = False)
conf.write_config_header('covoar-config.h')
def build(bld):
--
2.20.1
More information about the devel
mailing list