WL#4877: Fix server header files

Affects: Server-9.x   —   Status: In-Design

We have currently a number of problems with the header files that makes it more
difficult to work with the server code, for example:

- We have (at least) one circular include dependency

- Several header files lack include file guards

- Not all header files are self-sufficient, which require anybody who
  want to use some function (say, a hash table) to know what other
  header files that need to be included and in what order.

- There is at least one "convenience include file" (see WL#4739), mysql_priv.h,
  that both contain basic definition needed by every component and include
  directives to include "various practical header files". This include file is
  the crux of the circular include problem.

- Because of interdependencies, creating new unit tests require linking
  libmysqld.a

- Since libmysqld.a is built after the server (and has to be), unit tests
  for components in the server have to be built after libmysqld.a, which
  because of the current directory structure require the unit tests to be
  placed in a separate directory that is built after the server and libmysqld.

In order to resolve this, we need to start by doing a number of changes to the
physical structure of the server. The actual design of this structure is
contained in WL#4739, and worklog contain the first steps of that work by
resolving some of the more critical issues:

- Adding include guards to all header files

- Ensuring that every header file is self-sufficient

- Splitting mysql_priv.h into sensible pieces

- Eliminating all circular includes

Optionally, this work also involves:

- Arranging so that it is possible to write unit tests without requiring
  libmysqld to be linked in.
This worklog will be deployed in an iterative manner by pushing well-defined
changes to the code before proceeding with the next item.  The following is a
tentative list of what will be done and in what order. For practical reasons,
each step will be implemented as a separate worklog.

1. Fix header file include guards (WL#5016)
   - Add header file include guards to all header files that require it.
   - Change any header file include guards that start with _, since that either
     violates the C/C++ standard or is dangerously close to that.
   - Introduce any other changes that are necessary for the system to build
     properly.
   - Other include file guards will be left alone.

2. Make header files self-sufficient (WL#5017)
   - This does not include ``mysql_priv.h``
   - A subset of the include files will be committed (and optionally pushed)
     at each time in order from "library files" (mysys, strings, etc.) to files
     using other include files.

3. Move all #include to beginning of files (if they are not there already) and
   order them to catch bad include file definitions, that is, put them at the
   beginning of the file in this order:

   - Component header file
   - Package header files
   - Project header files
   - Standard header files

4. Resolve the ABI files.  There is a number of files that consist of the ABI
   and changes to these files requires special care. For that reason, any files
   that will affect ABI files in step 2 and 3 will not be touched there, but
   fixed in this step instead.

5. Handle build of ``libmysql``. Building libmysql requires special setups to
   work correctly. Any files that will affect the build of ``libmysql`` in
   steps 2 and 3 will therefore not be touched but handled here instead.

6. Split mysql_priv.h (WL#5030)

   - Extract "basic" typedefs into a separate header file
   - Try to find out structure of file to extract into separate files. There is
     no easy way to do this, but the previous steps will hopefully clear some of
     the debris.