21.5. Checking for the Availability of a `typedef`
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(CPPDEFINES=('off_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 provides 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(CPPDEFINES=('off_t','int'))
    env = conf.Finish()

Prev | Up | Next
21.4. Checking for the Availability of a Library | Home | 21.6. Checking the size of a datatype