MB-10248 Add quicksort implementation

The re-entrant version of quicksort (qsort_r) has different function
prototype across different platforms. Also, qsort_r is not present
in glibc version < 2.8. Added a copy of widely used FreeBSD qsort
implementation from standard library. It will be used if platform
specific qsort_r method is not available.

Change-Id: I372974b6a0be3c36ed3dc94a754321d52c72f2ac
Reviewed-on: http://review.couchbase.org/33734
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>