Move thread_mpi to src/external/

Now that thread-MPI headers are no longer installed, the whole thing can
be easily moved to src/external/, which better resembles its status
until it is decided what we really want to do with it.  There, it is
excluded from checks that are done for other parts of the source, as
well as from Doxygen, removing the need to treat it specially in all
these cases.

This also removes a large number of headers from legacyheaders/ with a
relatively simple change, advancing this effort.

Related to #1411.

Change-Id: I64d202eb61dc2c61668ad5858d551add6578cb97
Misc. Doxygen fixes

- Fix some issues in Doxygen-formatted comments that are currently
  ignored by Doxygen.  These were still causing warnings in XML
  extraction.
- Document pargs.h, and make one function from there static as it is no
  longer used outside the source file.
- Fix some other issues that the new Doxygen checker complains about.

Change-Id: I611ee3f9dbaf8a4406b4cba1f8b29aee5b5a4843