Add v8 version detection to configure.ac

Detect if v8 version > 3.19 and define macro `V8_POST_3_19_API`

Change-Id: I8af6c5f9b83f977f414397833f320240f0eeca33
Reviewed-on: http://review.couchbase.org/30028
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-on: http://review.couchbase.org/37506
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Sarath Lakshman <sarath@couchbase.com>
MB-9482 Add support for V8 versions post 3.19

v8 versions post v3.19 does not allow copyable persistent objects
and few APIs have changed. Based on macro def `V8_POST_3_19_API`,
newer API or older API can be conditionally used.

Change-Id: I2e41b7274745289ee6b4c94b5c3ae7ea94da4a76
Reviewed-on: http://review.couchbase.org/37507
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Sarath Lakshman <sarath@couchbase.com>
Reviewed-by: Sarath Lakshman <sarath@couchbase.com>
Add V8 include path to CPPFLAGS

Without this change the header check would succeed only if another v8.h
is located in a standard header location (/usr/include, etc) or if the
environment variable C_INCLUDE_PATH was defined and pointing to the custom
location (which used to be my case). This ensures we can build when the
only v8.h is located in a custom path supplied by --with-v8-include.

Change-Id: I35acfb34d37fd5aea2b8cb119a22edb9d9e98d87
Reviewed-on: http://review.couchbase.org/30134
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Release fds properly for views with reduce queries

View group file descriptors are reference counted by the number of callers
and interested callers acquire an fd and increments the refcount.
For reduce enabled views, fd reference count is not decremented correctly
after the application discards that fd. This causes fd leaks in case of
keep-alive connections used for queries.

Change-Id: I20a74202587198da46b81e2e722dcbf9821d7b08