wscript 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. VERSION='2.0.3'
  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 = 'string.h termios.h sys/time.h \
  15. unistd.h errno.h limits.h fcntl.h \
  16. sys/types.h sys/socket.h sys/ioctl.h \
  17. netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h'
  18. # check for headers and append found headers to headers_found for later use
  19. headers_found = []
  20. for header in headers.split():
  21. if conf.check_header(header):
  22. headers_found.append(header)
  23. functions_defines = (
  24. ('setsockopt', 'HAVE_SETSOCKOPT'),
  25. ('inet_ntoa', 'HAVE_INET_NTOA'),
  26. ('memset', 'HAVE_MEMSET'),
  27. ('select', 'HAVE_SELECT'),
  28. ('socket', 'HAVE_SOCKET'))
  29. for (function, define) in functions_defines:
  30. e = conf.create_function_enumerator()
  31. e.mandatory = True
  32. e.function = function
  33. e.headers = headers_found
  34. e.define = define
  35. e.run()
  36. conf.define('VERSION', VERSION)
  37. conf.define('PACKAGE', 'libmodbus')
  38. conf.write_config_header()
  39. def build(bld):
  40. import misc
  41. bld.add_subdirs('modbus tests')
  42. obj = bld.create_obj('subst')
  43. obj.source = 'modbus.pc.in'
  44. obj.target = 'modbus.pc'
  45. obj.dict = {'VERSION' : VERSION,
  46. 'prefix': bld.env()['PREFIX'],
  47. 'exec_prefix': bld.env()['PREFIX'],
  48. 'libdir': bld.env()['PREFIX'] + 'lib',
  49. 'includedir': bld.env()['PREFIX'] + 'include'}
  50. install_files('PREFIX', 'lib/pkgconfig', 'modbus.pc')
  51. def shutdown():
  52. import UnitTest
  53. unittest = UnitTest.unit_test()
  54. unittest.run()
  55. unittest.print_results()