openssl: explicitly NULL initialize PKCS8_PRIV_KEY_INFO
[platform/upstream/glib-networking.git] / meson.build
index cf2241e..3612415 100644 (file)
@@ -1,9 +1,9 @@
 project(
   'glib-networking', 'c',
-  version: '2.60.1',
+  version: '2.72.alpha',
   license: 'LGPL2.1+',
-  meson_version: '>= 0.47.0',
-  default_options: ['c_std=c11']
+  meson_version: '>= 0.50.0',
+  default_options: ['c_std=gnu99']
 )
 
 prefix = get_option('prefix')
@@ -27,32 +27,48 @@ if get_option('default_ca_file') != ''
   config_h.set_quoted('TIZEN_DEFAULT_CA_FILE', get_option('default_ca_file'))
 endif
 
+# TIZEN extension
+if get_option('tizen_ext')
+  config_h.set('TIZEN_EXT', get_option('tizen_ext'))
+endif
+
 # compiler flags
 common_flags = [
   '-DHAVE_CONFIG_H',
   '-DG_LOG_DOMAIN="GLib-Net"',
+  '-DG_LOG_USE_STRUCTURED',
   '-DLOCALE_DIR="@0@"'.format(localedir),
   '-DG_DISABLE_DEPRECATED',
-  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46'
+  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70'
 ]
 
+# TIZEN dlog
+if get_option('tizen_debug')
+  debug_dep = dependency('dlog')
+  config_h.set('TIZEN_DEBUG', get_option('tizen_debug'))
+endif
+
 add_project_arguments(common_flags, language: 'c')
 
+cflags = cc.get_supported_arguments(['-Werror=declaration-after-statement',
+                                     '-Werror=implicit-function-declaration'])
+add_project_arguments(cflags, language: 'c')
+
 symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
 
 module_ldflags = []
 
-if host_system.contains('linux')
+if host_system.contains('linux') or host_system == 'android'
   test_ldflag = '-Wl,--version-script,' + symbol_map
   module_ldflags += cc.get_supported_link_arguments(test_ldflag)
 endif
 
 # *** Check GLib GIO        ***
-glib_dep = dependency('glib-2.0', version: '>= 2.46.0',
+glib_dep = dependency('glib-2.0', version: '>= 2.69.0',
   fallback: ['glib', 'libglib_dep'])
 gio_dep = dependency('gio-2.0',
   fallback: ['glib', 'libgio_dep'])
-gobject_dep = dependency('gio-2.0',
+gobject_dep = dependency('gobject-2.0',
   fallback: ['glib', 'libgobject_dep'])
 gmodule_dep = dependency('gmodule-2.0',
   fallback: ['glib', 'libgmodule_dep'])
@@ -65,7 +81,7 @@ else
                                                   define_variable: ['libdir', join_paths(prefix, libdir)])
 endif
 
-assert(gio_module_dir.startswith(prefix), 'GIO_MODULE_DIR is missing from gio-2.0.pc')
+assert(gio_module_dir != '', 'GIO_MODULE_DIR is missing from gio-2.0.pc')
 
 # *** Checks for LibProxy   ***
 libproxy_dep = dependency('libproxy-1.0', version: '>= 0.3.1', required: get_option('libproxy'))
@@ -75,8 +91,12 @@ gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas', required
 
 backends = []
 
+# *** Check for dl          ***
+have_rtld_noload = cc.has_header_symbol('dlfcn.h', 'RTLD_NOLOAD')
+config_h.set('HAVE_RTLD_NOLOAD', have_rtld_noload)
+
 # *** Checks for GnuTLS     ***
-gnutls_dep = dependency('gnutls', version: '>= 3.4.6', required: get_option('gnutls'))
+gnutls_dep = dependency('gnutls', version: '>= 3.6.5', required: get_option('gnutls'))
 
 if gnutls_dep.found()
   backends += ['gnutls']
@@ -88,44 +108,48 @@ if openssl_option.disabled()
   openssl_dep = []
 else
   # XXX: https://github.com/mesonbuild/meson/issues/2945
-  openssl_dep = dependency('openssl1.1', required: openssl_option.enabled() and cc.get_id() != 'msvc')
+
+  openssl_dep = dependency('openssl1.1', version: '>= 1.0.2', required: false)
   if openssl_dep.found()
     backends += ['openssl']
-  elif cc.get_id() == 'msvc' and not openssl_option.disabled()
+  else
     # MSVC builds of OpenSSL does not generate pkg-config files,
     # so we check for it manually here in this case, if we can't find those files
     # Based on the CMake check for OpenSSL in CURL's CMakeLists.txt,
     # on which headers we should check for
-    have_openssl = true
+
+    # OpenSSL's MSVC NMake Makefiles prepends the library filenames with 'lib',
+    # so we must prepend the libraries with 'lib' on MSVC, except for the pre-1.1.x
+    # ssleay32.lib
+    openssl_lib_prefix = ''
+    if cc.get_argument_syntax() == 'msvc'
+      openssl_lib_prefix = 'lib'
+    endif
+
+    openssl_headers = []
     foreach h : ['crypto.h', 'engine.h', 'err.h', 'pem.h',
                  'rsa.h', 'ssl.h', 'x509.h', 'rand.h', 'tls1.h']
-      header = 'openssl/' + h
-      if not cc.has_header(header)
-        have_openssl = false
-        if openssl_option.enabled()
-          error('openssl module is enabled and @0@ not found'.format(header))
-        endif
-      endif
+      openssl_headers += 'openssl/' + h
     endforeach
 
     # OpenSSL 1.1.x and 1.0.x (or earlier) have different .lib names,
     # so we need to look for the correct pair
 
     # Find either libcrypto.lib (1.1.x) or libeay32.lib (1.0.x or earlier) first
-    libcrypto_dep = cc.find_library('libcrypto', required: false)
+    libcrypto_dep = cc.find_library('@0@crypto'.format(openssl_lib_prefix), required: false)
     if libcrypto_dep.found()
-      libssl = 'libssl'
+      libssl = '@0@ssl'.format(openssl_lib_prefix)
     else
-      libcrypto_dep = cc.find_library('libeay32', required: openssl_option)
+      libcrypto_dep = cc.find_library('@0@eay32'.format(openssl_lib_prefix), required: openssl_option)
       libssl = 'ssleay32'
     endif
 
     if libcrypto_dep.found()
       # Find the corresponding SSL library depending on which crypto .lib we found
-      libssl_dep = cc.find_library(libssl, required: openssl_option)
+      libssl_dep = cc.find_library(libssl, required: openssl_option, has_headers: openssl_headers)
     endif
 
-    if libcrypto_dep.found() and have_openssl
+    if libcrypto_dep.found() and libssl_dep.found()
       openssl_dep = [libcrypto_dep, libssl_dep]
       backends += ['openssl']
     endif
@@ -183,10 +207,16 @@ if gnutls_dep.found()
 endif
 
 if backends.contains('openssl')
+  if ['darwin', 'ios'].contains(host_system)
+    security_dep = dependency('appleframeworks', modules : ['Security'])
+  elif ['windows'].contains(host_system)
+    crypt32_dep = cc.find_library('crypt32')
+  endif
+
   subdir('tls/openssl')
 endif
 
-subdir('tls/tests')
+#subdir('tls/tests')
 
 # Will automatically pick it up from the cross file if defined
 gio_querymodules = find_program('gio-querymodules', required : false)
@@ -200,4 +230,6 @@ output += '  openssl support:     ' + backends.contains('openssl').to_string() +
 output += '  libproxy support:    ' + libproxy_dep.found().to_string() + '\n'
 output += '  GNOME proxy support: ' + gsettings_desktop_schemas_dep.found().to_string() + '\n'
 output += '  TIZEN default CA file: ' + get_option('default_ca_file') + '\n'
+output += '  TIZEN extension:     ' + get_option('tizen_ext').to_string() + '\n'
+output += '  TIZEN debug:         ' + get_option('tizen_debug').to_string() + '\n'
 message(output)