AutoGen - The Automated Program Generator: 2.6 Pre-defined Names

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.6 Pre-defined Names

When AutoGen starts, it tries to determine several names from the operating environment and put them into environment variables for use in both `#ifdef` tests in the definitions files and in shell scripts with environment variable tests. `__autogen__` is always defined. For other names, AutoGen will first try to use the POSIX version of the `sysinfo(2)` system call. Failing that, it will try for the POSIX `uname(2)` call. If neither is available, then only "`__autogen__`" will be inserted into the environment. In all cases, the associated names are converted to lower case, surrounded by doubled underscores and non-symbol characters are replaced with underscores.

With Solaris on a sparc platform, `sysinfo(2)` is available. The following strings are used:

- `SI_SYSNAME` (e.g., "__sunos__")
- `SI_HOSTNAME` (e.g., "__ellen__")
- `SI_ARCHITECTURE` (e.g., "__sparc__")
- `SI_HW_PROVIDER` (e.g., "__sun_microsystems__")
- `SI_PLATFORM` (e.g., "__sun_ultra_5_10__")
- `SI_MACHINE` (e.g., "__sun4u__")

For Linux and other operating systems that only support the `uname(2)` call, AutoGen will use these values:

- `sysname` (e.g., "__linux__")
- `machine` (e.g., "__i586__")
- `nodename` (e.g., "__bach__")

By testing these pre-defines in my definitions, you can select pieces of the definitions without resorting to writing shell scripts that parse the output of `uname(1)`. You can also segregate real C code from autogen definitions by testing for "`__autogen__`".

    #ifdef __bach__
      location = home;
    #else
      location = work;
    #endif

This document was generated by Bruce Korb on October, 7 2007 using texi2html 1.76.