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