You can use the Gestalt function or the %Gestalt tied hash to obtain information about the operating environment. You specify what information you need by passing one of the selector codes recognized by Gestalt.

There is a huge list of codes. Many of them return a bitmask, so to find out whether e.g. the Code Fragment Manager is present, you write