Checking for the Availability of a typedef

SCons User Guide 0.98.0
Prev | Chapter 21. Multi-Platform Configuration (Autoconf Functionality) | Next

# 21.5. Checking for the Availability of a `typedef`

Check for the availability of a `typedef` by using the `CheckType` method:

        env = Environment()
        conf = Configure(env)
        if not conf.CheckType('off_t'):
            print 'Did not find off_t typedef, assuming int'
            conf.env.Append(CCFLAGS = '-Doff_t=int')
        env = conf.Finish()

You can also add a string that will be placed at the beginning of the test file that will be used to check for the `typedef`. This provide a way to specify files that must be included to find the `typedef`:

        env = Environment()
        conf = Configure(env)
        if not conf.CheckType('off_t', '#include <sys/types.h>\n'):
            print 'Did not find off_t typedef, assuming int'
            conf.env.Append(CCFLAGS = '-Doff_t=int')
        env = conf.Finish()

Prev | Home | Next
Checking for the Availability of a Library | Up | Adding Your Own Custom Checks