Commit 6d093b6a42e53ae6b9382fadfb81fbaa9cbebf80
1 parent
bdbdf33f
Finished waf script (almost)
Showing
1 changed file
with
38 additions
and
13 deletions
wscript
| ... | ... | @@ -6,7 +6,7 @@ APPNAME='libmodbus' |
| 6 | 6 | |
| 7 | 7 | # these variables are mandatory ('/' are converted automatically) |
| 8 | 8 | srcdir = '.' |
| 9 | -blddir = '_build_' | |
| 9 | +blddir = 'build' | |
| 10 | 10 | |
| 11 | 11 | def init(): |
| 12 | 12 | print "A groovy libmodbus for Linux!" |
| ... | ... | @@ -18,27 +18,52 @@ def set_options(opt): |
| 18 | 18 | def configure(conf): |
| 19 | 19 | conf.check_tool('compiler_cc') |
| 20 | 20 | conf.check_pkg('glib-2.0', destvar='GLIB', mandatory=True) |
| 21 | + conf.check_tool('misc') | |
| 21 | 22 | |
| 22 | - e = conf.create_header_enumerator() | |
| 23 | - e.mandatory = 1 | |
| 24 | - # Add AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termio.h termios.h unistd.h]) | |
| 25 | - e.name = 'arpa/inet.h' | |
| 26 | - e.run() | |
| 23 | + headers = 'arpa/inet.h fcntl.h netinet/in.h stdlib.h \ | |
| 24 | + string.h sys/ioctl.h sys/socket.h sys/time.h \ | |
| 25 | + termio.h termios.h unistd.h' | |
| 27 | 26 | |
| 28 | - # Add AC_CHECK_FUNCS([inet_ntoa memset select socket]) | |
| 27 | + # check for headers and append found headers to headers_found for later use | |
| 28 | + headers_found = [] | |
| 29 | + for header in headers.split(): | |
| 30 | + if conf.check_header(header): | |
| 31 | + headers_found.append(header) | |
| 32 | + | |
| 33 | + functions_defines = ( | |
| 34 | + ('inet_ntoa', 'HAVE_INET_NTOA'), | |
| 35 | + ('memset', 'HAVE_MEMSET'), | |
| 36 | + ('select', 'HAVE_SELECT'), | |
| 37 | + ('socket', 'HAVE_SOCKET')) | |
| 38 | + | |
| 39 | + for (function, define) in functions_defines: | |
| 40 | + e = conf.create_function_enumerator() | |
| 41 | + e.mandatory = True | |
| 42 | + e.function = function | |
| 43 | + e.headers = headers_found | |
| 44 | + e.define = define | |
| 45 | + e.run() | |
| 46 | + | |
| 29 | 47 | conf.define('VERSION', VERSION) |
| 30 | 48 | conf.define('PACKAGE', 'libmodbus') |
| 31 | 49 | |
| 32 | 50 | conf.write_config_header() |
| 33 | 51 | |
| 34 | 52 | def build(bld): |
| 35 | - bld.add_subdirs('src'); | |
| 53 | + import misc | |
| 54 | + | |
| 55 | + bld.add_subdirs('src') | |
| 36 | 56 | |
| 37 | -# Doesn't work I need some help from the WAF project | |
| 38 | -# obj = bld.create_obj('subst') | |
| 39 | -# obj.source = 'modbus.pc.in' | |
| 40 | -# obj.target = 'modbus.pc' | |
| 41 | -# obj.dict = {'VERSION' : VERSION } | |
| 57 | + obj = bld.create_obj('subst') | |
| 58 | + obj.source = 'modbus.pc.in' | |
| 59 | + obj.target = 'modbus.pc' | |
| 60 | + | |
| 61 | + obj.dict = {'VERSION' : VERSION, | |
| 62 | + 'prefix': bld.env()['PREFIX'], | |
| 63 | + 'exec_prefix': bld.env()['PREFIX'], | |
| 64 | + 'libdir': bld.env()['PREFIX'] + '/lib', | |
| 65 | + 'includedir': bld.env()['PREFIX'] + '/include', | |
| 66 | + 'modbus_pkgdeps' : 'glib-2.0'} | |
| 42 | 67 | |
| 43 | 68 | def shutdown(): |
| 44 | 69 | import UnitTest | ... | ... |