## 10 Host Definition

With the advent of Autoconf, it's rarely necessary to have host definition machinery anymore. The following information is provided, mainly, as an historical reference.

### 10.1 Adding a New Host

gdb's host configuration support normally happens via Autoconf. New host-specific definitions should not be needed. Older hosts gdb still use the host-specific definitions and files listed below, but these mostly exist for historical reasons, and will eventually disappear.

`gdb/config/arch/xyz.mh`
  This file is a Makefile fragment that once contained both host and native configuration information (see Native Debugging) for the machine xyz. The host configuration information is now handled by Autoconf.

  Host configuration information included definitions for `CC`, `SYSV_DEFINE`, `XM_CFLAGS`, `XM_ADD_FILES`, `XM_CLIBS`, `XM_CDEPS`, etc.; see `Makefile.in`.

  New host-only configurations do not need this file.

(Files named `gdb/config/arch/xm-xyz.h` were once used to define host-specific macros, but were no longer needed and have all been removed.)

#### Generic Host Support Files

There are some “generic” versions of routines that can be used by various systems.

`ser-unix.c`
  This contains serial line support for Unix systems. It is included by default on all Unix-like hosts.
`ser-pipe.c`
  This contains serial pipe support for Unix systems. It is included by default on all Unix-like hosts.
`ser-mingw.c`
  This contains serial line support for 32-bit programs running under Windows using MinGW.
`ser-go32.c`
  This contains serial line support for 32-bit programs running under DOS, using the DJGPP (a.k.a. GO32) execution environment.

`ser-tcp.c`
  This contains generic TCP support using sockets. It is included by default on all Unix-like hosts and with MinGW.

### 10.2 Host Conditionals

When gdb is configured and compiled, various macros are defined or left undefined, to control compilation based on the attributes of the host system. While formerly they could be set in host-specific header files, at present they can be changed only by setting `CFLAGS` when building, or by editing the source code.

These macros and their meanings (or if the meaning is not documented here, then one of the source files where they are used is indicated) are:

gdb `INIT_FILENAME`
  The default name of gdb's initialization file (normally `.gdbinit`).
`SIGWINCH_HANDLER`
  If your host defines `SIGWINCH`, you can define this to be the name of a function to be called if `SIGWINCH` is received.
`SIGWINCH_HANDLER_BODY`
  Define this to expand into code that will define the function named by the expansion of `SIGWINCH_HANDLER`.
`CRLF_SOURCE_FILES`
  Define this if host files use `\r\n` rather than `\n` as a line terminator. This will cause source file listings to omit `\r` characters when printing and it will allow `\r\n` line endings of files which are “sourced” by gdb. It must be possible to open files in binary mode using `O_BINARY` or, for fopen, `"rb"`.
`DEFAULT_PROMPT`
  The default value of the prompt string (normally `"(gdb) "`).
`DEV_TTY`
  The name of the generic TTY device, defaults to `"/dev/tty"`.
`ISATTY`
  Substitute for isatty, if not available.
`FOPEN_RB`
  Define this if binary files are opened the same way as text files.
`CC_HAS_LONG_LONG`
  Define this if the host C compiler supports `long long`. This is set by the `configure` script.
`PRINTF_HAS_LONG_LONG`
  Define this if the host can handle printing of long long integers via the printf format conversion specifier `ll`. This is set by the `configure` script.
`LSEEK_NOT_LINEAR`
  Define this if `lseek (n)` does not necessarily move to byte number `n` in the file. This is only used when reading source files. It is normally faster to define `CRLF_SOURCE_FILES` when possible.
`lint`
  Define this to help placate `lint` in some situations.
`volatile`
  Define this to override the defaults of `__volatile__` or `/**/`.