Build "random.c" module introduced in 2.7.3

See http://bugs.python.org/issue13703
Merge pull request #1 from jcfr/support-273-adding-random-module

Build "random.c" module introduced in 2.7.3
Requires CMake 2.8.3 and remove now obsolete custom CMake module

CMakeParseArguments has been introduced in CMake 2.8.3 and can be used
as a replacement for ParseArguments custom module

Policy CMP0011 has been introduced in CMake 2.6.2 and is now set by default
to NEW. See http://www.cmake.org/cmake/help/v2.8.8/cmake.html#policy:CMP0011
Fix indent - Remove space between CMake command name and first parenthesis.
Allow python interpreter to be started from the build tree

The -S option has to be used so that the site package doesn't look for the
installed Makefile.
Add configure checks

Leveraging CMake macros allowing to introspect the system,
the file "pyconfig.h.in" is now almost fully configured.

Also introduced the following options:
  * WITH_TSC
  * ENABLE_IPV6
  * WITH_DOC_STRINGS
  * Py_USING_UNICODE
  * WITH_PYMALLOC
  * HAVE_LARGEFILE_SUPPORT
  * WITH_THREAD

The configure checks have been adapted from the work of Alexander Neundorf,
Pat Marion and David Demarle. See https://github.com/demarle/ParaViewAutoBuild/blob/anl-surveyor/add_cmake_files_to_python2-7-3.patch

Currently only Release build is supported. More work is required to set
the variable "Py_DEBUG" and the associated flags.

The value from pyconfig.h that still need to be set based on introspection
are listed at the end of the ConfigureChecks.cmake file.
Minimize confusion by setting libPython compile definitions per file and platform
Fix MacOSX build improving configure checks and using right linker flag

By comparing the "pyconfig.h" configured by CMake and the one generated
building python using Autoconf. It turns out that the hardcoded value
that were working for my Ubuntu 10.04 (gcc 4.4.3) were not sufficient
and more check were required.

The following checks are now performed so that "pyconfig.h.in" can
be configured adequately:

* Check for additional header files and set the following variables:
   HAVE_LINUX_TIPC_H
   HAVE_SYS_EPOLL_H
   HAVE_SYS_EVENT_H
   HAVE_UTIL_H

* Check for presence of "crypt" and "nsl" library and set the following
variables accordingly:
   HAVE_LIBCRYPT
   HAVE_LIBNSL

* Extend list "CFG_HEADERS" to check for presence of the following
symbols:
   epoll
   getresgid
   getresuid
   kqueue
   lchmod

* Check for availability of "struct tm" and set TM_IN_SYS_TIME

* Add compile and run test to set the following variables:
 POSIX_SEMAPHORES_NOT_ENABLED
 HAVE_BROKEN_SEM_GETVALUE

* Add compile test to set the variable: HAVE_OSX105_SDK

* HAVE_LARGEFILE_SUPPORT is now set conditionally using value of
SIZEOF_OFF_T, SIZEOF_LONG and SIZEOF_LONG_LONG.


Also review how _BSD_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED
and _POSIX_C_SOURCE were set. On MacOSX, these variable have to be set
conditionally.

Note that it is by comparing both "pyconfig.h" file (CMake generated
and Autoconf generated) and looking at "configure.in" file that these
changes were implemented.


Since extension are compiled before the python library itself, the linker
flag "-undefined,dynamic_lookup" has been associated with each extension
target.

TODO: Build of ctype has been simply disabled on MacOSX. Some work is needed
to figure out which files need to be compiled together.

HACK: Added "-undefined,dynamic_lookup" when building python library
because of undefined symbols "_setresgid" and "_setresuid". Comparing
both pyconfig.h, macro HAVE_SETRESGID and HAVE_SETRESUID are set differently.
This will have to be investigated.
Shut up compile warnings related deprecated/unused
Move python_platform macros and add support for REQUIRED vars.

Add CMake code allowing to consider the variables:
  CMAKE_REQUIRED_LIBRARIES
  CMAKE_REQUIRED_INCLUDES
  CMAKE_REQUIRED_DEFINITIONS
  CMAKE_REQUIRED_FLAGS

The corresponding code has been copied from existing
macros CHECK_C_SOURCE_COMPILES/RUNS provided by CMake itself.

By ensuring our macros consider these variables, more "configure test"
will be passing when expected.
Add configure test for HAVE_BROKEN_UNSETENV
Tweak test associated with HAVE_LIBIEEE and find library only if needed
Tweak HAVE_LIBRESOLV test and find the library only if needed
Fix style of HAVE_BROKEN_{POSIX_SEMAPHORES/PTHREAD_SIGMASK} cmakedefine

Also remove extra end-of-line space
Fix test associated with HAVE_EPOLL by checking for the correct function.
Fix POSIX_SEMAPHORES_NOT_ENABLED and HAVE_BROKEN_SEM_GETVALUE test

The double quote were not escaped and the check state was poped to early
which was preventing the threading library from being associated
with the test.
Tweak test associated with thread and set _REENTRANT when appropriate.
By default set WITH_NEXT_FRAMEWORK to 0

A CMake option named "WITH_NEXT_FRAMEWORK" could be added so that
a framework is generated. This would be equivalent to the "--enable-framework"
option.
Update configure check to emulate AC_HEADER_DIRENT

That way the variables HAVE_SYS_NDIR_H/HAVE_SYS_DIR_H/HAVE_NDIR_H
will set only if HAVE_DIRENT_H have not been set.

See http://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/Particular-Headers.html
Fix VisualStudio error by setting gcc specific flags on unix platform only

See http://www.cmake.org/cmake/help/v2.8.8/cmake.html#variable:UNIX