summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-26 11:00:55 -0500
committerDavid Robillard <d@drobilla.net>2017-12-29 10:57:47 -0500
commita0d07391dadf5007674b625eb166e938368ebced (patch)
tree58b13d928aa8941db0190d2e58c1bf04d8ba9562
parent8baf9f0ed7552f98fc0aeaa545dffb818031f70a (diff)
downloadautowaf-a0d07391dadf5007674b625eb166e938368ebced.tar.gz
autowaf-a0d07391dadf5007674b625eb166e938368ebced.tar.bz2
autowaf-a0d07391dadf5007674b625eb166e938368ebced.zip
Add autowaf.check_function
-rw-r--r--autowaf.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/autowaf.py b/autowaf.py
index 838fcc1..8ed46b2 100644
--- a/autowaf.py
+++ b/autowaf.py
@@ -11,7 +11,7 @@ import os
import subprocess
import sys
-from waflib import Build, Logs, Options
+from waflib import Build, Logs, Options, Utils
from waflib.TaskGen import feature, before, after
global g_is_child
@@ -111,6 +111,19 @@ def check_header(conf, lang, name, define='', mandatory=True):
else:
check_func(header_name=name, includes=includes, mandatory=mandatory)
+def check_function(conf, lang, name, **args):
+ "Check for a function"
+ header_names = Utils.to_list(args['header_name'])
+ includes = ''.join(['#include <%s>\n' % x for x in header_names])
+ fragment = '''
+%s
+int main() { return !(void(*)())(%s); }
+''' % (includes, name)
+
+ check_func = get_check_func(conf, lang)
+ args['msg'] = 'Checking for %s' % name
+ check_func(fragment=fragment, **args)
+
def nameify(name):
return name.replace('/', '_').replace('++', 'PP').replace('-', '_').replace('.', '_')