build: Several updates of the build scripts

- Redesign the way default compile flags are determined.

  This includes a small semantical change with flag processing:
  * there are now "general" compiler and link flags. These are added (if
    supported) even if CXXFLAGS and/or LINKFLAGS environmental variables
    are set.
  * optimization/debug-mode flags that are applied only if CXXFLAGS
    and/or LINKFLAGS environmental variables are not set.

- Fix define constant for sqlite3.

  When pkg-config detection used, it requires `global_define` flag.
  Otherwise define is applied only when the module is included in the
  build target using 'use' statement.

- Remove openssl dependency

  This dependency was redundant for a long time

Change-Id: Icf66fb5300954893cc2d07e022b8a0998ec894e5
Refs: #2209
diff --git a/.waf-tools/sqlite3.py b/.waf-tools/sqlite3.py
index c47ae6f..3d4e46e 100644
--- a/.waf-tools/sqlite3.py
+++ b/.waf-tools/sqlite3.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # encoding: utf-8
 
-from waflib import Options
+from waflib import Options, Logs
 from waflib.Configure import conf
 
 def options(opt):
@@ -26,6 +26,8 @@
         try:
             self.check_cfg(package='sqlite3',
                            args=['--cflags', '--libs'],
+                           global_define=True,
+                           define_name='HAVE_%s' % var,
                            uselib_store='SQLITE3',
                            mandatory=True)
         except: