Previous: Configure Options, Up: Installing GDB

### B.6 System-wide configuration and settings

gdb can be configured to have a system-wide init file; this file will be read and executed at startup (see What gdb does during startup).

Here is the corresponding configure option:

`--with-system-gdbinit=`file
  Specify that the default location of the system-wide init file is file.

If gdb has been configured with the option `--prefix=$prefix`, it may be subject to relocation. Two possible cases:

- If the default location of this init file contains `$prefix`, it will be subject to relocation. Suppose that the configure options are `--prefix=$prefix --with-system-gdbinit=$prefix/etc/gdbinit`; if gdb is moved from `$prefix` to `$install`, the system init file is looked for as `$install/etc/gdbinit` instead of `$prefix/etc/gdbinit`.
- By contrast, if the default location does not contain the prefix, it will not be relocated. E.g. if gdb has been configured with `--prefix=/usr/local --with-system-gdbinit=/usr/share/gdb/gdbinit`, then gdb will always look for `/usr/share/gdb/gdbinit`, wherever gdb is installed.