SConstruct 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # $Id: SConstruct,v 1.4 2007-02-24 15:03:47 dron Exp $
  2. # Tag Image File Format (TIFF) Software
  3. #
  4. # Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
  5. #
  6. # Permission to use, copy, modify, distribute, and sell this software and
  7. # its documentation for any purpose is hereby granted without fee, provided
  8. # that (i) the above copyright notices and this permission notice appear in
  9. # all copies of the software and related documentation, and (ii) the names of
  10. # Sam Leffler and Silicon Graphics may not be used in any advertising or
  11. # publicity relating to the software without the specific, prior written
  12. # permission of Sam Leffler and Silicon Graphics.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  15. # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  16. # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  17. #
  18. # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19. # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20. # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
  22. # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  23. # OF THIS SOFTWARE.
  24. # This file contains rules to build software with the SCons tool
  25. # (see the http://www.scons.org/ for details on SCons).
  26. import os
  27. env = Environment()
  28. # Read the user supplied options
  29. opts = Options('libtiff.conf')
  30. opts.Add(PathOption('PREFIX', \
  31. 'install architecture-independent files in this directory', \
  32. '/usr/local', PathOption.PathIsDirCreate))
  33. opts.Add(BoolOption('ccitt', \
  34. 'enable support for CCITT Group 3 & 4 algorithms', \
  35. 'yes'))
  36. opts.Add(BoolOption('packbits', \
  37. 'enable support for Macintosh PackBits algorithm', \
  38. 'yes'))
  39. opts.Add(BoolOption('lzw', \
  40. 'enable support for LZW algorithm', \
  41. 'yes'))
  42. opts.Add(BoolOption('thunder', \
  43. 'enable support for ThunderScan 4-bit RLE algorithm', \
  44. 'yes'))
  45. opts.Add(BoolOption('next', \
  46. 'enable support for NeXT 2-bit RLE algorithm', \
  47. 'yes'))
  48. opts.Add(BoolOption('logluv', \
  49. 'enable support for LogLuv high dynamic range encoding', \
  50. 'yes'))
  51. opts.Add(BoolOption('strip_chopping', \
  52. 'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
  53. 'yes'))
  54. opts.Add(BoolOption('extrasample_as_alpha', \
  55. 'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\'t mark the alpha properly', \
  56. 'yes'))
  57. opts.Add(BoolOption('check_ycbcr_subsampling', \
  58. 'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
  59. 'yes'))
  60. opts.Update(env)
  61. opts.Save('libtiff.conf', env)
  62. Help(opts.GenerateHelpText(env))
  63. # Here are our installation paths:
  64. idir_prefix = '$PREFIX'
  65. idir_lib = '$PREFIX/lib'
  66. idir_bin = '$PREFIX/bin'
  67. idir_inc = '$PREFIX/include'
  68. idir_doc = '$PREFIX/doc'
  69. Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
  70. # Now proceed to system feature checks
  71. target_cpu, target_vendor, target_kernel, target_os = \
  72. os.popen("./config/config.guess").readlines()[0].split("-")
  73. def Define(context, key, have):
  74. import SCons.Conftest
  75. SCons.Conftest._Have(context, key, have)
  76. def CheckCustomOption(context, name):
  77. context.Message('Checking is the ' + name + ' option set... ')
  78. ret = env[name]
  79. Define(context, name + '_SUPPORT', ret)
  80. context.Result(ret)
  81. return ret
  82. def CheckFillorderOption(context):
  83. context.Message('Checking for the native cpu bit order... ')
  84. if target_cpu[0] == 'i' and target_cpu[2:] == '86':
  85. Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
  86. context.Result('lsb2msb')
  87. else:
  88. Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
  89. context.Result('msb2lsb')
  90. return 1
  91. def CheckIEEEFPOption(context):
  92. context.Message('Checking for the IEEE floating point format... ')
  93. Define(context, 'HAVE_IEEEFP', 1)
  94. context.Result(1)
  95. return 1
  96. def CheckOtherOption(context, name):
  97. context.Message('Checking is the ' + name + ' option set... ')
  98. ret = env[name]
  99. Define(context, 'HAVE_' + name, ret)
  100. context.Result(ret)
  101. return ret
  102. custom_tests = { \
  103. 'CheckCustomOption' : CheckCustomOption, \
  104. 'CheckFillorderOption' : CheckFillorderOption, \
  105. 'CheckIEEEFPOption' : CheckIEEEFPOption, \
  106. 'CheckOtherOption' : CheckOtherOption \
  107. }
  108. conf = Configure(env, custom_tests = custom_tests, \
  109. config_h = 'libtiff/tif_config.h')
  110. # Check for standard library
  111. conf.CheckLib('c')
  112. if target_os != 'cygwin' \
  113. and target_os != 'mingw32' \
  114. and target_os != 'beos' \
  115. and target_os != 'darwin':
  116. conf.CheckLib('m')
  117. # Check for system headers
  118. conf.CheckCHeader('assert.h')
  119. conf.CheckCHeader('fcntl.h')
  120. conf.CheckCHeader('io.h')
  121. conf.CheckCHeader('limits.h')
  122. conf.CheckCHeader('malloc.h')
  123. conf.CheckCHeader('search.h')
  124. conf.CheckCHeader('sys/time.h')
  125. conf.CheckCHeader('unistd.h')
  126. # Check for standard library functions
  127. conf.CheckFunc('floor')
  128. conf.CheckFunc('isascii')
  129. conf.CheckFunc('memmove')
  130. conf.CheckFunc('memset')
  131. conf.CheckFunc('mmap')
  132. conf.CheckFunc('pow')
  133. conf.CheckFunc('setmode')
  134. conf.CheckFunc('sqrt')
  135. conf.CheckFunc('strchr')
  136. conf.CheckFunc('strrchr')
  137. conf.CheckFunc('strstr')
  138. conf.CheckFunc('strtol')
  139. conf.CheckFillorderOption()
  140. conf.CheckIEEEFPOption()
  141. conf.CheckCustomOption('ccitt')
  142. conf.CheckCustomOption('packbits')
  143. conf.CheckCustomOption('lzw')
  144. conf.CheckCustomOption('thunder')
  145. conf.CheckCustomOption('next')
  146. conf.CheckCustomOption('logluv')
  147. conf.CheckOtherOption('strip_chopping')
  148. conf.CheckOtherOption('extrasample_as_alpha')
  149. conf.CheckOtherOption('check_ycbcr_subsampling')
  150. env = conf.Finish()
  151. # Ok, now go to build files in the subdirectories
  152. SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')