Raise error if give @HD SO:coordinate to 'samtools fixmate'

The (minimal) documentation does tell you 'samtools fixmate' requires query name
sorted reads (in fact grouped by query name is enough), but doesn't actually raise
an error if given coordinate sorted reads (it just silently fails to fix them).

This change raises an explicit error is the @HD line contains SO:coordinate
Fix compilation with the Clang compiler.
Fix type mismatches between types in sizeof() in malloc/calloc/realloc calls. This generates a warning in the clang analyzer, designed to catch incorrectly sized memory allocations.

The allocation at bam_plcmd.c:208 is twice as big as it needs to be, and has been fixed.
Catch overflow in n_cigar and give an explicit error.

Due to the use of an unsigned 16bit integer, BAM
files can only hold reads with up to 65535 CIGAR
operators. SAM does not have this limit, but the
samtools implementation (reasonably) also has the
same 16bit limit.

Prior to this fix a very long CIGAR read would
give a confusing 'unmatched CIGAR operation'
warning and then abort with a core dump.
bcftools view: Output CLR,UGT,CGT tags in -m pair/trio calling. In this version, consistency with output genotypes is not being checked.
bcftools view: prevent segfault when running in plain mode, p1 then does not exist
bcftools view: previous fix in kt_fisher_exact (PV4 annotations, fet.c) was wrong. Will this one work better?
Include htslib in our build directory

Eventually perhaps we'll be able to install an htslib-dev package
during before_install instead.
Include htslib rules and add header dependencies

Use the rules and variables from htslib.mk to write out exact
dependencies on htslib headers and (for executables) library.
With this, samtools builds with "make" from here are correct
even when htslib source code is being modified.

(A little more infrastructure is needed to select between static
and shared libhts.)
Added BGZF indexing and reindexing capability to bgzip. Fixed -b seeking.
Added a test suite for samtools, currently faidx and bgzip are tested.
Added a test suite for samtools, currently faidx and bgzip are tested.
tview and bgzip: Check that the files are bgzipped, not gzipped.
constify input parameter to faidx_fetch_seq
Fix buglet: initialise the kstring_t

Also parse "" rather than NULL in the unlikely event of an empty .fai
file, and add a bam_import.o prerequisite that was omitted.
Merge pull request #62 from jts/develop

constify input parameter to faidx_fetch_seq
Warn and use correct bin when bin field is wrong

The abort introduced in pull request #43 (8e3b3f2 "Verify old BIN value
of reads during 'samtools index'") is too Draconian, as this field is
in practice used only during indexing -- so the BAM file is mostly fine.

If we're recalculating it here anyway, we might as well use the corrected
value to generate the index and just warn (in a rate-limited way) about
the anomalous records.
Fix bin calculation for unmapped reads

Unmapped reads should have a CIGAR of "*", but sometimes do not e.g. as
occasionally emitted by bwa.  Our bin calculation has been changed to
base the bin on a 1-base region for reads that are either unmapped or
have no cigar, and now agrees with Picard's for these reads.
bam_pileup: Improved read pair overlaps clipping. Disabled for now as more testing is needed.
Merge branch 'develop' of github.com:samtools/samtools into develop