Bug 692977: Stop harmless thread debugging messages during cmapdump

If compiled with -DDEBUG, cmapdump throws a large number of warnings
regarding thread locking. These are harmless and can be ignored, but
are, nonetheless, not pretty. Fixed here.

Thanks to Bas Weelinck for the report.
Bug 692976: Fix spurious thread lock debug warnings on context clones

When cloning, ensure the locks are done on the new context, not the
old one; this makes no difference except to suppress some spurious
debugging messages.

Also ensure that DEBUG is predefined for Makefile based debug and memento
builds.

Thanks to Bas Weelinck.
Bug 692979: Fix race condition in thread debugging.

Bas Weelinck points out a potential problem with multiple threads
starting up at the same time, running into a race condition in
the thread debugging code. He suggests using an extra lock to
avoid this, and indeed, it would be a simple way.

I am reluctant to introduce an extra lock purely for this case
though, so I've instead reused the ALLOC lock. This has the advantage
of us not having to take the lock except in the 'first call with a
new context' case.
Fix use of uninitialised variable.

In my previous commit, I forgot to initialise the variable before
using it. Thanks to Bas Weelinck for spotting this.
Add fz_new_draw_device_with_bbox function

Restricts rendering to a sub rectangle of the supplied bbox.
Reduce the changes that mupdfclean makes to floats.

Most of the changes mupdfclean makes to a file are purely textual
(streams are decompressed etc), but some objects can undergo changes
due to being read in, and then written out. Notably in this class
are floats. For instance, the mediabox in Bug689189.pdf contains
2125.984, which when written out with the current code gives 2125.98.

This is enough of a difference to cause rendering changes.

By upping the precision (instead of %g use, %1.9g) we get better
results; we now output 2125.9839, which is much closer (and in fact
has the same float representation when read back in).

This drastically reduces the differences between a rendering of
Bug689189.pdf and the uncompressed version, but we still have
differences - in shadings, it seems.
Add Meta interface to fz_document.

Use this to reintroduce "Document Properties..." in mupdf viewer.
Add XCFLAGS option to makefile.
Add LOCAL_TRIG_FNS option.

If this is defined during building, we use our own sinf/cosf/atan2f
functions during shading. This is set automatically if CLUSTER is defined
too, so this should remove the cross-platform differences seen during
cluster rendering.
Note that the fz_meta interface is subject to change.

Comment changes only.
Bug 692990: Fix 'underjoin' of strokes.

See Bug 688655 for analysis of what we SHOULD be doing. The code changes
to do this are actually quite small.

Essentially, when we join we only draw the 'top' (or 'outer') join in a
join dependent way. The 'under' join was always joined as a bevel before
as this was easy. This produces bad effects when the lines have a
significant angle between them and a large linewidth.

The correct (i.e. matching Acrobat and others) way to work is to
join the bottom of the line via the centre point. The sole exception
to this is when drawing under beziers, as we don't want to make our
approximation-by-lines obvious.

All fixed in this patch.
Tweak manpages and add makefile rule to generate plain text versions.
Retry loading a hinted glyph without hinting if freetype returns an error.

Allows us to render files with broken font hinting programs when hinting
is enabled(whether by no-AA or DynaLab detection).

Fix bug 692949.
Bug 692847: Tiling problem fix.

The test in mupdf for 'is more than one tile needed' is wrong,
as it assumes that tile bboxes start at 0. Fix that, and
everything else should work OK.
Remove 256x256 variant from windows icon to support VS2005.
Bug 692924: Allow mupdfinfo to accept files that don't end in .pdf

The logic in mupdfinfo was to interpret any command line argument
that ended in .pdf or .PDF as a filename, and to treat all others
as page range specifiers.

Here we change it so that page range specifiers are (roughly) detected,
and all other entries are taken to be filenames.

This doesn't address the wider issues of spotting files by 'magic' -
this is a larger task and will be addressed post 1.0.
Change fz_document_open to assume PDF format by default.

Previously, we would only open files with the correct extension.
Until such time as we get file type detection by contents working
assume that any file that doesn't end in .xps or .cbz is a pdf
file.
Update usage string, and About box.

Add missing options to MuPDF usage string.

Ensure windows 'About MuPDF' box is large enough to fit the
whole of the usage string in.
Update pdf_version to 1.0
Add -ttt into usage string for mudraw.