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
small cleanup
Do extra checking for choice rules so that they don't interfere with package splits
refactor a bit
make queue_insertn more flexible

Yes, it's an API change, but I'm pretty sure that nobody
other than the solver itself uses queue_insertn.
cleanup hash code, it makes no sense to have an extra type for the mask
small cleanups in pubkey handling
improve fileconflicts code
fix bugs in fileconflicts code and prepare for aliased dirs

Breaks API but that should not be a problem as noone seems to
use the function yet.
remove strange 5 year old TODO file

What does "xml metadata: prereq for store" even mean?
refactor solv demo a bit
refactor: split off openpkgdb()
Reimplement state handling in rpm_by functions

We now have rpm_state_create and rpm_state_free to create/free
the state. API change, but should be pretty internal.
use pgpDigGetParams() if available
remove dead code