WL#7895: Add systemd support to server

Affects: Parser-5.7   —   Status: Complete


 The major Linux distributions are moving from legacy SystemV init or
 upstart init to new, more powerful systemd init system[1].

 systemd has a lot of new features for daemons such as mysqld, among
 the most important are
  - handling of user and group running the daemon
  - resource control (max open files for example)
  - and automatic restarts in case of failure
 However, to let MySQL server be good citizen in this new enviroments
 some changes are required.

 This WL tries to list those requirements.


 [1]: http://www.freedesktop.org/wiki/Software/systemd/
 [2]: http://www.freedesktop.org/software/systemd/man/systemd.service.html 
 [3]: http://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html
 [4]: http://www.freedesktop.org/software/systemd/man/daemon.html

 MySQL gets a modern init system for Linux systems and native SysV daemon
 option on other supported platforms.

 Exit status, start status
 Package verification
 Failure/restart tests
 F1: Create systemd specific files
     a) mysqld.service[2]
        systemd service unit configuration, 
        with details about the mysqld service.
     b) mysqld.tmpfiles[3]
        file to support the tmpfiles feature
     c) mysql-systemd-start
        support script for the unit file
      Repo project can provide contents of files and locations.
 F2: Add cmake option.
     Add new -DWITH_SYSTEMD=on|off (off by default)
     Install F1 when enabled

 F3: Modification of initial startup of server.
     systemd expect server to do standard SysV daemon init, or
     init of "New-Style Daemons". We should implement standard
     SysV init as then we can reuse the feature outside systemd context
     and be the default way server starts on all platforms (except Windows).

     See [4] for detailed description of how this should be implemented.

     An option to use current non daemon mode should be present.

 F4: Clean up of exit codes.
     systemd is monitoring daemons started and restarts them if they stops
     with exit code > 0. mysqld must therefore return exit 0 on normal
     shutdown and basically return sane exit code everywhere. 

 F5: Clarify malloc libs status.
     To use alternative malloc libs mysqld_safe has an --malloc-lib
     option (implemented by a LD_PRELOAD hack). With systemd support
     and mysqld_safe out of the picture there is no way to inject
     other malloc libs.

     a) build with jemalloc/tcmalloc statically by default
     b) add LD_PRELOAD of malloc libs mechanism in systemd service file
     c) only use system malloc on systemd platforms

 F6: Disable mysqld_safe when running under systemd.
     When F4 and F5 are done, we can remove mysqld_safe and leave it to 
     systemd to restart server in case of failure.

 F7: Improve packages, enable systemd.