aboutsummaryrefslogtreecommitdiff
path: root/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-07-30 21:44:40 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-07-30 21:44:40 +0300
commit658a82651897676ab036d922b9603e81a5ba7333 (patch)
tree696223805ae020bb20e0fb80b1852972079fd969 /environment.py
parent08d18671aeefda22325375909f3bc960d29a6c52 (diff)
downloadmeson-658a82651897676ab036d922b9603e81a5ba7333.zip
meson-658a82651897676ab036d922b9603e81a5ba7333.tar.gz
meson-658a82651897676ab036d922b9603e81a5ba7333.tar.bz2
Can check if headers have functions of a given name.
Diffstat (limited to 'environment.py')
-rw-r--r--environment.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/environment.py b/environment.py
index 03fa21b..3ccd385 100644
--- a/environment.py
+++ b/environment.py
@@ -188,6 +188,19 @@ int main(int argc, char **argv) {
raise EnvironmentException('Could not run sizeof test binary.')
return int(res.stdout)
+ def has_function(self, funcname, prefix):
+ # This fails (returns true) if funcname is a ptr or a variable.
+ # The correct check is a lot more difficult.
+ # Fix this to do that eventually.
+ templ = '''%s
+int main(int argc, char **argv) {
+ void *ptr = (void*)(%s);
+ return 0;
+};
+'''
+ res = self.run(templ % (prefix, funcname))
+ return res.compiled
+
class CPPCompiler(CCompiler):
def __init__(self, exelist):
CCompiler.__init__(self, exelist)