Define SYSTEM_LIBRARIES in main CMakeLists.txt

* There were identical SYSTEM_LIBRARIES definitions in several CMakeLists.txt
  files (well almost identical -- some still checked for DEBIAN instead of
  ENABLE_RPMDB). Now it's defined in the main CMakeLists.txt.
* Remove --as-needed from CMAKE_C_FLAGS and add it to SYSTEM_LIBRARIES. It
  isn't a compiler flag and older gcc's issue a warning when encountering it
  on a compile line.
Improve C89 compliance

Make sure variables are declared at the beginning of a block.
Use futimens() instead of futimes()

futimens() is POSIX, futimes() isn't.
solv_sort(): Fix build for non-glibc without qsort_r()
Make all public libsolv headers C++ safe

A few headers already included 'export "C"' blocks, also wrapping
other #include's. This patch cleanly wraps the contents of all public
headers instead.
Merge pull request #27 from weinhold/upstream

Various Portability Improvements