Adds tests for the index generation code.

Testing index generation in samtools is a bit pointless as most of the code
is here in htslib.  This adds some tests to exercise .bai and .csi index
generation.

test/test_index.c is a simple program to build indexes.

test/test_index.pl builds indexes for a couple of files, then tries to
extract parts of the original using the index.  It doesn't try anything
very sophisticated at the moment, it just attempts to get each sequence
line.

test/index_small_ref.sam and test/index_big_ref.sam are the test data.
index_big_ref.sam includes a huge reference which is too big for .bai
to index.
Fixes incorrect swappage when writing .csi loffset field on big-endian