Remove all transaction sharing code between cursor and regular updates.

Modifying the db structure makes the individual functions non-reentrant,
and can cause race conditions and data corruptions in multi threaded
programs, such as cf-serverd.
Merge pull request #1674 from vohi/mitigate_racecondition

Remove all transaction sharing code between cursor and regular updates.
Initialize the global transaction to null at initialization.

Otherwise, we have an uninitialized pointer in case of error.
Also abort the opening transaction in case of error.

No need to reset the pointer on the stack at end of function.
Disable irrelevant migration tests for LMDB builds.
Merge pull request #1675 from vohi/disable_migration_tests

Disable irrelevant migration tests for LMDB builds.
new autoconf option to make state directory configurable: --with-statedir=<directory>
make use of preprocessor macros for static known_dirs.c functions
rename MAX_WORKDIR_LENGTH macro to generic MAX_DIR_LENGTH
add GetStateDir() and supporting functions
use GetStateDir() and replace hardcoded state/ paths
libpromises/generic_agent.c: chmod and chown internal directories only when needed.

Avoids gratuitous chmod and chown calls on internal directories by examining
the populated stat struct after stat(). Important for devices backed by flash
in order to avoid wanton wearing of the storage medium.
new $(sys.statedir) special variable
move embedded databases exclusive to state/ directory
LogTotalCompliance(): prevent cf-agent from bailing with custom logdir
tests/load: use CFENGINE_TEST_OVERRIDE_WORKDIR in combination with GetStateDir()
tests/unit: use CFENGINE_TEST_OVERRIDE_WORKDIR in combination with GetStateDir()
known_dirs.c: Collapse GetInputDir(), GetMasterDir(), GetStateDir() with preprocessor
obliterate CFWORKDIR (GLOBAL_C) and its usage in the main codebase.

- CFWORKDIR globals remain in tests/{unit,load}/ but are unrelated
  to the main global that is being obliterated here.
examples/measure_log.cf: comment to account for potential compile-time statedir
RemoveDates(): move datetime string literal computation to compile-time

- comment on uncertainty of two-digit hh:mm:ss and time-zones shorter
  than three letters.

Pointed out by Edward Welbourne