roentgen b75cab
# $Id: SConstruct,v 1.4 2007/02/24 15:03:47 dron Exp $
roentgen b75cab
roentgen b75cab
# Tag Image File Format (TIFF) Software
roentgen b75cab
#
roentgen b75cab
# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu></dron@ak4719.spb.edu>
roentgen b75cab
#
roentgen b75cab
# Permission to use, copy, modify, distribute, and sell this software and 
roentgen b75cab
# its documentation for any purpose is hereby granted without fee, provided
roentgen b75cab
# that (i) the above copyright notices and this permission notice appear in
roentgen b75cab
# all copies of the software and related documentation, and (ii) the names of
roentgen b75cab
# Sam Leffler and Silicon Graphics may not be used in any advertising or
roentgen b75cab
# publicity relating to the software without the specific, prior written
roentgen b75cab
# permission of Sam Leffler and Silicon Graphics.
roentgen b75cab
# 
roentgen b75cab
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
roentgen b75cab
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
roentgen b75cab
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
roentgen b75cab
# 
roentgen b75cab
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
roentgen b75cab
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
roentgen b75cab
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
roentgen b75cab
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
roentgen b75cab
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
roentgen b75cab
# OF THIS SOFTWARE.
roentgen b75cab
roentgen b75cab
# This file contains rules to build software with the SCons tool
roentgen b75cab
# (see the http://www.scons.org/ for details on SCons).
roentgen b75cab
roentgen b75cab
import os
roentgen b75cab
roentgen b75cab
env = Environment()
roentgen b75cab
roentgen b75cab
# Read the user supplied options
roentgen b75cab
opts = Options('libtiff.conf')
roentgen b75cab
opts.Add(PathOption('PREFIX', \
roentgen b75cab
    'install architecture-independent files in this directory', \
roentgen b75cab
    '/usr/local', PathOption.PathIsDirCreate))
roentgen b75cab
opts.Add(BoolOption('ccitt', \
roentgen b75cab
    'enable support for CCITT Group 3 & 4 algorithms', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('packbits', \
roentgen b75cab
    'enable support for Macintosh PackBits algorithm', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('lzw', \
roentgen b75cab
    'enable support for LZW algorithm', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('thunder', \
roentgen b75cab
    'enable support for ThunderScan 4-bit RLE algorithm', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('next', \
roentgen b75cab
    'enable support for NeXT 2-bit RLE algorithm', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('logluv', \
roentgen b75cab
    'enable support for LogLuv high dynamic range encoding', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('strip_chopping', \
roentgen b75cab
    'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('extrasample_as_alpha', \
roentgen b75cab
    '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', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Add(BoolOption('check_ycbcr_subsampling', \
roentgen b75cab
    'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
roentgen b75cab
    'yes'))
roentgen b75cab
opts.Update(env)
roentgen b75cab
opts.Save('libtiff.conf', env)
roentgen b75cab
Help(opts.GenerateHelpText(env))
roentgen b75cab
roentgen b75cab
# Here are our installation paths:
roentgen b75cab
idir_prefix = '$PREFIX'
roentgen b75cab
idir_lib = '$PREFIX/lib'
roentgen b75cab
idir_bin = '$PREFIX/bin'
roentgen b75cab
idir_inc = '$PREFIX/include'
roentgen b75cab
idir_doc = '$PREFIX/doc'
roentgen b75cab
Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
roentgen b75cab
roentgen b75cab
# Now proceed to system feature checks
roentgen b75cab
target_cpu, target_vendor, target_kernel, target_os = \
roentgen b75cab
    os.popen("./config/config.guess").readlines()[0].split("-")
roentgen b75cab
roentgen b75cab
def Define(context, key, have):
roentgen b75cab
    import SCons.Conftest
roentgen b75cab
    SCons.Conftest._Have(context, key, have)
roentgen b75cab
roentgen b75cab
def CheckCustomOption(context, name):
roentgen b75cab
    context.Message('Checking is the ' + name + ' option set... ')
roentgen b75cab
    ret = env[name]
roentgen b75cab
    Define(context, name + '_SUPPORT', ret)
roentgen b75cab
    context.Result(ret)
roentgen b75cab
    return ret
roentgen b75cab
roentgen b75cab
def CheckFillorderOption(context):
roentgen b75cab
    context.Message('Checking for the native cpu bit order... ')
roentgen b75cab
    if target_cpu[0] == 'i' and target_cpu[2:] == '86':
roentgen b75cab
	Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
roentgen b75cab
	context.Result('lsb2msb')
roentgen b75cab
    else:
roentgen b75cab
	Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
roentgen b75cab
	context.Result('msb2lsb')
roentgen b75cab
    return 1
roentgen b75cab
roentgen b75cab
def CheckIEEEFPOption(context):
roentgen b75cab
    context.Message('Checking for the IEEE floating point format... ')
roentgen b75cab
    Define(context, 'HAVE_IEEEFP', 1)
roentgen b75cab
    context.Result(1)
roentgen b75cab
    return 1
roentgen b75cab
roentgen b75cab
def CheckOtherOption(context, name):
roentgen b75cab
    context.Message('Checking is the ' + name + ' option set... ')
roentgen b75cab
    ret = env[name]
roentgen b75cab
    Define(context, 'HAVE_' + name, ret)
roentgen b75cab
    context.Result(ret)
roentgen b75cab
    return ret
roentgen b75cab
roentgen b75cab
custom_tests = { \
roentgen b75cab
    'CheckCustomOption' : CheckCustomOption, \
roentgen b75cab
    'CheckFillorderOption' : CheckFillorderOption, \
roentgen b75cab
    'CheckIEEEFPOption' : CheckIEEEFPOption, \
roentgen b75cab
    'CheckOtherOption' : CheckOtherOption \
roentgen b75cab
    }
roentgen b75cab
conf = Configure(env, custom_tests = custom_tests, \
roentgen b75cab
    config_h = 'libtiff/tif_config.h')
roentgen b75cab
roentgen b75cab
# Check for standard library
roentgen b75cab
conf.CheckLib('c')
roentgen b75cab
if target_os != 'cygwin' \
roentgen b75cab
    and target_os != 'mingw32' \
roentgen b75cab
    and target_os != 'beos' \
roentgen b75cab
    and target_os != 'darwin':
roentgen b75cab
    conf.CheckLib('m')
roentgen b75cab
roentgen b75cab
# Check for system headers
roentgen b75cab
conf.CheckCHeader('assert.h')
roentgen b75cab
conf.CheckCHeader('fcntl.h')
roentgen b75cab
conf.CheckCHeader('io.h')
roentgen b75cab
conf.CheckCHeader('limits.h')
roentgen b75cab
conf.CheckCHeader('malloc.h')
roentgen b75cab
conf.CheckCHeader('search.h')
roentgen b75cab
conf.CheckCHeader('sys/time.h')
roentgen b75cab
conf.CheckCHeader('unistd.h')
roentgen b75cab
roentgen b75cab
# Check for standard library functions
roentgen b75cab
conf.CheckFunc('floor')
roentgen b75cab
conf.CheckFunc('isascii')
roentgen b75cab
conf.CheckFunc('memmove')
roentgen b75cab
conf.CheckFunc('memset')
roentgen b75cab
conf.CheckFunc('mmap')
roentgen b75cab
conf.CheckFunc('pow')
roentgen b75cab
conf.CheckFunc('setmode')
roentgen b75cab
conf.CheckFunc('sqrt')
roentgen b75cab
conf.CheckFunc('strchr')
roentgen b75cab
conf.CheckFunc('strrchr')
roentgen b75cab
conf.CheckFunc('strstr')
roentgen b75cab
conf.CheckFunc('strtol')
roentgen b75cab
roentgen b75cab
conf.CheckFillorderOption()
roentgen b75cab
conf.CheckIEEEFPOption()
roentgen b75cab
conf.CheckCustomOption('ccitt')
roentgen b75cab
conf.CheckCustomOption('packbits')
roentgen b75cab
conf.CheckCustomOption('lzw')
roentgen b75cab
conf.CheckCustomOption('thunder')
roentgen b75cab
conf.CheckCustomOption('next')
roentgen b75cab
conf.CheckCustomOption('logluv')
roentgen b75cab
conf.CheckOtherOption('strip_chopping')
roentgen b75cab
conf.CheckOtherOption('extrasample_as_alpha')
roentgen b75cab
conf.CheckOtherOption('check_ycbcr_subsampling')
roentgen b75cab
roentgen b75cab
env = conf.Finish()
roentgen b75cab
roentgen b75cab
# Ok, now go to build files in the subdirectories
roentgen b75cab
SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')