Q:

SCons - Headers/Libraries in a non-standard location

I'm trying to use SCons to compile a program that requires a set of dependencies which I've installed in a non-standard location.
I've installed the dependencies in /home/dja/ocr. Now I'm trying to compile the main program and can't figure out how to tell SCons where to look for the libraries and headers.
I've tried (amongst others):
scons prefix=/home/dja/ocr

scons includepath=/home/dja/ocr/include libpath=/home/dja/ocr/lib

env LIBPATH=/home/dja/ocr/lib INCLUDEPATH=/home/dja/ocr/include scons

...etc...

The results are always the same:
scons: Reading SConscript files ...  
Currently supported OS version: Ubuntu 10.04  
Checking for C++ library iulib... no  
AssertionError: :  
  File "/home/dja/ocr/src/ocropus/SConstruct", line 107:  
    assert conf.CheckLibWithHeader("iulib","iulib/iulib.h","C++");  

I haven't been able to find an answer on Google.
What is the correct SCons foo to get this to work?

A:

You need to create an environment and set appropriate variables:
env = Environment(
          CPPPATH=['/home/dja/ocr/include'],
          LIBPATH=['/home/dja/ocr/lib'],
          LIBS=['iulib'])
env.Program('my_executable', Glob('*.c'))

The CPPPATH points to a list of C Pre-Processor Paths (Note: 3 P's). LIBPATH points to where your libraries reside. Finally, LIBS is a list of libraries to link with your program.

A:

Unlike with make and its conventions for certain environment variables or the --with-X options to configure, the author of the SConstruct needs to provide a way for a user to specify overrides. By default, scons doesn't read build variables from the environment. 
There are various ways of handling user configuration (see Variables which I just learned about), but I'm not aware of widely honored conventions. And for the user in your position, you need to rely on the author writing build documentation or a decent scons --help description, or resort to reading the SConstruct yourself (which you sometimes have to resort to with badly written unconventional Makefiles).
BTW, I would be happy to be corrected on this if my knowledge of scons is out of date. 

