wscript 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. VERSION='1.9.0'
  4. APPNAME='libmodbus'
  5. # these variables are mandatory ('/' are converted automatically)
  6. srcdir = '.'
  7. blddir = 'build'
  8. def set_options(opt):
  9. # options provided by the modules
  10. opt.tool_options('compiler_cc')
  11. def configure(conf):
  12. conf.check_tool('compiler_cc')
  13. conf.check_tool('misc')
  14. headers = 'arpa/inet.h fcntl.h netinet/in.h stdlib.h \
  15. string.h sys/ioctl.h sys/socket.h sys/time.h \
  16. termio.h termios.h unistd.h'
  17. # check for headers and append found headers to headers_found for later use
  18. headers_found = []
  19. for header in headers.split():
  20. if conf.check_header(header):
  21. headers_found.append(header)
  22. functions_defines = (
  23. ('inet_ntoa', 'HAVE_INET_NTOA'),
  24. ('memset', 'HAVE_MEMSET'),
  25. ('select', 'HAVE_SELECT'),
  26. ('socket', 'HAVE_SOCKET'))
  27. for (function, define) in functions_defines:
  28. e = conf.create_function_enumerator()
  29. e.mandatory = True
  30. e.function = function
  31. e.headers = headers_found
  32. e.define = define
  33. e.run()
  34. conf.define('VERSION', VERSION)
  35. conf.define('PACKAGE', 'libmodbus')
  36. conf.write_config_header()
  37. def build(bld):
  38. import misc
  39. bld.add_subdirs('modbus tests')
  40. obj = bld.create_obj('subst')
  41. obj.source = 'modbus.pc.in'
  42. obj.target = 'modbus.pc'
  43. obj.dict = {'VERSION' : VERSION,
  44. 'prefix': bld.env()['PREFIX'],
  45. 'exec_prefix': bld.env()['PREFIX'],
  46. 'libdir': bld.env()['PREFIX'] + 'lib',
  47. 'includedir': bld.env()['PREFIX'] + 'include'}
  48. install_files('PREFIX', 'lib/pkgconfig', 'modbus.pc')
  49. def shutdown():
  50. import UnitTest
  51. unittest = UnitTest.unit_test()
  52. unittest.run()
  53. unittest.print_results()