wscript 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 init():
  9. print "A groovy libmodbus for Linux!"
  10. def set_options(opt):
  11. # options provided by the modules
  12. opt.tool_options('compiler_cc')
  13. def configure(conf):
  14. conf.check_tool('compiler_cc')
  15. conf.check_tool('misc')
  16. headers = 'arpa/inet.h fcntl.h netinet/in.h stdlib.h \
  17. string.h sys/ioctl.h sys/socket.h sys/time.h \
  18. termio.h termios.h unistd.h'
  19. # check for headers and append found headers to headers_found for later use
  20. headers_found = []
  21. for header in headers.split():
  22. if conf.check_header(header):
  23. headers_found.append(header)
  24. functions_defines = (
  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('src')
  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. def shutdown():
  51. import UnitTest
  52. unittest = UnitTest.unit_test()
  53. unittest.run()
  54. unittest.print_results()