ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/find_libs.py
Revision: 1.4
Committed: Tue Dec 23 15:03:59 2008 UTC (15 years, 11 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
Changes since 1.3: +28 -8 lines
Log Message:
SCons now uses installed libtiff, if a compatible one is available. Added platform/README to explain config files.

File Contents

# User Rev Content
1 schorsch 1.1 import os
2    
3     from SCons.SConf import SConf # aka Configure
4    
5     def find_x11(env):
6     # Search for libX11, remember the X11 library and include dirs
7     for d in ('/usr/X11R6', '/usr/X11', '/usr/openwin'):
8     if os.path.isdir (d):
9     incdir = os.path.join(d, 'include')
10     libdir = os.path.join(d, 'lib')
11 schorsch 1.4 env.Prepend(CPPPATH=[incdir]) # add temporarily
12     env.Prepend(LIBPATH=[libdir])
13 schorsch 1.1 conf = SConf(env)
14     if conf.CheckLibWithHeader('X11', 'X11/X.h', 'C', autoadd=0):
15     env.Replace(X11INCLUDE=incdir)
16     env.Replace(X11LIB=libdir)
17     env['CPPPATH'].remove(incdir) # not needed for now
18     env['LIBPATH'].remove(libdir)
19     if env['X11INCLUDE']:
20     # Check for SGI stereo extension
21     if conf.CheckCHeader('X11/extensions/SGIStereo.h'):
22     env['RAD_STEREO'] = '-DSTEREO'
23     else: env['RAD_STEREO'] = '-DNOSTEREO'
24     env = conf.Finish ()
25     break
26     env = conf.Finish ()
27    
28 schorsch 1.3
29 schorsch 1.1 def find_gl(env):
30     # Check for libGL, set flag
31 schorsch 1.3 dl = [(None,None)] # standard search path
32     if env.has_key('X11INCLUDE'): # sometimes found there (Darwin)
33     dl.append((env['X11INCLUDE'], env['X11LIB']))
34     for incdir, libdir in dl:
35 schorsch 1.4 if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily
36     if libdir: env.Prepend(LIBPATH=[libdir])
37 schorsch 1.3 conf = SConf(env)
38 schorsch 1.2 if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0):
39     env['OGL'] = 1
40     if incdir: env['CPPPATH'].remove(incdir) # not needed for now
41 schorsch 1.3 if libdir: env['LIBPATH'].remove(libdir)
42     if env.has_key('OGL'):
43     if incdir: env.Replace(OGLINCLUDE=[incdir])
44     #if libdir: env.Replace(OGLLIB=[libdir])
45     conf.Finish()
46     break
47     conf.Finish()
48 schorsch 1.1
49 schorsch 1.4
50     def find_libtiff(env):
51     # Check for libtiff, set flag and include/lib directories
52     dl = [ (None,None), ] # standard search path
53     cfgi = env.get('TIFFINCLUDE')
54     cfgl = env.get('TIFFLIB')
55     if cfgi or cfgl:
56     dl.insert(0,(cfgi, cfgl))
57     for incdir, libdir in dl:
58     if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily
59     if libdir: env.Prepend(LIBPATH=[libdir])
60     conf = SConf(env)
61     if conf.CheckLib('tiff', 'TIFFInitSGILog',
62     header='void TIFFInitSGILog(void);', autoadd=0):
63     env['TIFFLIB_INSTALLED'] = 1
64     if incdir: env['CPPPATH'].remove(incdir) # not needed for now
65     if libdir: env['LIBPATH'].remove(libdir)
66     if env.has_key('TIFFLIB_INSTALLED'):
67     if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir])
68     if libdir: env.Replace(RAD_TIFFLIB=[libdir])
69     conf.Finish()
70     break
71     conf.Finish()
72