Experimental support for Cross-Origin Resource Sharing (CORS).

Closes COUCHDB-431

Patch by:

 - Dale Harvey
 - Benoit Chesneau
 - Jan Lehnardt
 - Robert Newson

See `etc/couchdb/default.ini.tpl.in` for configuration examples.
fix whitespace
Require Erlang R13B04 or later
Close view files cleanly on DB create/delete

The shutdown_sync was actually interfering with a clean shutdown
initiated by the index processes themselves when they received a 'DOWN'
message from their monitoring of the DB process.  The explicit 'delete'
cast message in this patch is very probably redundant, but it makes the
intent clear.  The important bit is to let the index process terminate
*and* get confirmation of the termination before attempting to nuke the
directory.

COUCHDB-1364
import Couchbase docs

git clone git://github.com/janl/couchdb-docs.git
cd couchdb-docs
rm -rf DocKit Makefile Makefile.bootstrap README.md common couchdb-manual-1.1 couchdb-release-1.1 metadocs
git checkout 9fc95b422060d020ba25f559e893fc7fb98c9a15 -- 'couchdb-manual-1.1/*.xml' 'couchdb-release-1.1/*.xml'
tar cvzf couchdb-docs.tar.gz couchdb-manual-1.1 couchdb-release-1.1
Transmogrify Couchbase XML to .rst and support Sphinx

Authors:
Alexander Shorin <kxepal@gmail.com>
Dave Cottlehuber <dch@apache.org>
Dirkjan Ochtman <dirkjan@ochtman.nl>
Robert Newson <rnewson@apache.org>
Tady Walsh for the spiffy logo

Robert Newson:
- hear no eval, see no eval, speak no eval
- fix minor niggles

Dave Cottlehuber:
- Remove vestiges of svn URLs in comments
- Add browser EventSource protocol support for changes feed
- Add all UUID algorithms including new utc+suffix-based UUID scheme
- refactor 1.1.x features and other into 1.2.0 docs
- remove manual.rst & release.rst files, only used during migration
- prepare conf.py to be run from share/Makefile similar to:
    sphinx-build -a -E -W -n \
    -D version='$ver' \
    -D release='$ver-git-sha' \
    -D project='Apache CouchDB' \
    -D copyright='$year, Apache Software Foundation' \
    -c `pwd` \
    -d /tmp/ \
    rst/ \
     <output_dir>
- set sphinx config:
- update copyright & project
- set default syntax highlighting to JSON
- output docs to share/docs/manual
- move into share/docs/rst
- move old 1.1 .rst updates into main area
- add release.rst for future release notes
- swap specific versions and releases for sphinx variables
Transmogrify XML to rst using pandoc 1.9.4.2:
    pandoc --smart --preserve-tabs --normalize --reference-links --chapters \
      --number-sections --standalone --from docbook --to rst --output
    rst/manual.rst couchdb-manual-1.1/*.xml
    pandoc --smart --preserve-tabs --normalize --reference-links --chapters \
      --number-sections --standalone --from docbook --to rst --output
    rst/release.rst couchdb-release-1.1/*.xml
    rm -rf share/docs

Alexander Shorin:
- Convert CHANGES file to rst, update information about 1.3.0 release.
- Actual till #fb670f5712 commit at 2012-12-02.
- Enable extlink extension. Setup extlink to CouchDB JIRA and Apache Git commits.
- Enable sections enumeration. Looks nicer for further referencing.
- Fix copy-paste typo, remove changes history for request object
- Add article about queryservers: JavaScript and Erlang one
- Complete article about how to write design documents
- Shift filter functions from changes and point to ddocs
- Add response object and view head info structure
- Add query server and CommonJS
- Fix markup of errors section
- Fix caution blocks
- Add back JSON structure reference
- Clarify what kind of contents should go in views
- Add back configuration option reference
- Add TODO.txt for future reference
- Add tables to start of API reference sections (except for design docs)
- Fix indentation
- Add syntax highlighting
- Add to-do statements
- Fix weird `_` escaping
- Wrap statements
- Add method descriptions
- Clean up tables
- Add missed `PUT /db/_revs_limit` description

Dirkjan Ochtman:
- Move .rst files into Sphinx Layout
- Move rst files and copy images into a Sphinx project
- Split manual & release docs into smaller pieces
- Update version numbers
- Move API docs into separate directory
Integrate Sphinx into autotools

Integrate Sphinx into autotools
- Remove M4 macros and require as external dependencies instead
- Skip help2man generation if help2man is not installed
- ensure THANKS file is only updated during make distcheck
- Add TexInfo, PDF, HTML doc targets via Sphinx
- Add licenses and header compliance checking
- support optional builds of PDF, HTML, texinfo via Sphinx and pdflatex
- support skipping docs or compiler tests for happy developers

Travis: clean up package dependencies
- include sphinx via aptitude
- use spidermonkey 1.8.5 instead of default libmozjs
- include latex components for building PDFs
Add Sphinx-related build changes into READMEs
Add docs and search links into Futon
Added support for `make -j` and `make -n`
Use non-compressed Content-Type in attachments test suites

MD5-Digests of attachments are calculated on the compressed data if the
attachment MIME type is compressible, as defined in default.ini
[attachments] compressible_types

Windows uses a different gzip implementation, and therefore generates
different MD5-Digests than other platforms. Using binary Content-Type
resolves this.
link to embedded HTML documentation must have a trailing / to work
Docs: add notes on CORS functionality
Remove extraneous ETag warning during compilation
Improve script url validation
Include a comment before jsonp output
Ignore multipart epilogue

COUCHDB-1632
improve parsing of mochiweb relative paths

Patch adapted from http://www.couchbase.com/issues/browse/MB-7390
Fix unused variable warnings
Export handle_file_req