[network-manager-applet/wip/inigomartinez/meson-improvements: 6/7] build(meson): Remove unused defines



commit d5cf7dd01493f155b1e67c9777044880ca034dfe
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sat Nov 11 19:40:59 2017 +0100

    build(meson): Remove unused defines
    
    meson generates the config.h file with multiple defines to be used
    as guards, in the same way as autotools does. However, some of them
    are not used.
    
    This patch removes those unused defines.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790178

 config.h.meson |   74 --------------------------------------------
 meson.build    |   94 +++++++++----------------------------------------------
 2 files changed, 16 insertions(+), 152 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index 2874b62..5befcc9 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -1,89 +1,15 @@
 /* Gettext package */
 #mesondefine GETTEXT_PACKAGE
 
-/* Define to 1 if you have the `bind_textdomain_codeset' function. */
-#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
-
-/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
-   CoreFoundation framework. */
-#mesondefine HAVE_CFLOCALECOPYCURRENT
-
-/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
-   the CoreFoundation framework. */
-#mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE
-
-/* Define to 1 if you have the `dcgettext' function. */
-#mesondefine HAVE_DCGETTEXT
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#mesondefine HAVE_DLFCN_H
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#mesondefine HAVE_GETTEXT
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#mesondefine HAVE_INTTYPES_H
-
-/* Define if your <locale.h> file defines LC_MESSAGES. */
-#mesondefine HAVE_LC_MESSAGES
-
 /* Define if you have libnotify 0.7 or later */
 #mesondefine HAVE_LIBNOTIFY_07
 
-/* Define to 1 if you have the <locale.h> header file. */
-#mesondefine HAVE_LOCALE_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#mesondefine HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#mesondefine HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#mesondefine HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#mesondefine HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#mesondefine HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#mesondefine HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#mesondefine HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#mesondefine HAVE_UNISTD_H
-
 /* ISO codes prefix */
 #mesondefine ISO_CODES_PREFIX
 
 /* Define if more asserts are enabled */
 #mesondefine NM_MORE_ASSERTS
 
-/* Name of package */
-#mesondefine PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#mesondefine PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#mesondefine PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#mesondefine PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#mesondefine PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#mesondefine PACKAGE_URL
-
-/* Define to the version of this package. */
-#mesondefine PACKAGE_VERSION
-
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # define _ALL_SOURCE 1
diff --git a/meson.build b/meson.build
index 94900ad..eb6e6c2 100644
--- a/meson.build
+++ b/meson.build
@@ -49,87 +49,16 @@ cc = meson.get_compiler('c')
 config_h = configuration_data()
 
 # defines
-set_defines = [
-  # package
-  ['PACKAGE', meson.project_name()],
-  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager'],
-  ['PACKAGE_NAME', nma_name],
-  ['PACKAGE_STRING', '@0@ @1@'.format(nma_name, nma_version)],
-  ['PACKAGE_TARNAME', meson.project_name()],
-  ['PACKAGE_URL', ''],
-  ['PACKAGE_VERSION', nma_version],
-  ['VERSION', nma_version],
-  # i18n
-  ['GETTEXT_PACKAGE', nma_name]
-]
-
-foreach define: set_defines
-  config_h.set_quoted(define[0], define[1])
-endforeach
-
-# headers
-check_headers = [
-  ['HAVE_DLFCN_H', 'dlfcn.h'],
-  ['HAVE_INTTYPES_H', 'inttypes.h'],
-  ['HAVE_LOCALE_H', 'locale.h'],
-  ['HAVE_MEMORY_H', 'memory.h'],
-  ['HAVE_STDINT_H', 'stdint.h'],
-  ['HAVE_STDLIB_H', 'stdlib.h'],
-  ['HAVE_STRINGS_H', 'strings.h'],
-  ['HAVE_STRING_H', 'string.h'],
-  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
-  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
-  ['HAVE_UNISTD_H', 'unistd.h']
-]
-
-foreach header: check_headers
-  config_h.set(header[0], cc.has_header(header[1]))
-endforeach
-
-# functions
-check_functions = [
-  # i18n
-  ['HAVE_DCGETTEXT', 'dcgettext'],
-  ['HAVE_GETTEXT', 'gettext'],
-  ['HAVE_ICONV', 'iconv']
-]
-
-if host_machine.system().contains('darwin')
-  check_functions += [
-    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
-    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
-  ]
-endif
-
-foreach func: check_functions
-  config_h.set(func[0], cc.has_function(func[1]))
-endforeach
-
-# symbols
-check_symbols = [
-  # i18n
-  ['HAVE_LC_MESSAGES', 'locale.h', 'LC_MESSAGES'],
-  ['HAVE_BIND_TEXTDOMAIN_CODESET', 'libintl.h', 'bind_textdomain_codeset']
-]
-
-foreach symbol: check_symbols
-  config_h.set(symbol[0], cc.has_header_symbol(symbol[1], symbol[2]))
-endforeach
+config_h.set_quoted('GETTEXT_PACKAGE', nma_name)
+config_h.set_quoted('VERSION', nma_version)
 
 # types
-check_types = [
-  # type, header, fallback type
-  ['pid_t', 'sys/types.h', 'int']
-]
-
-foreach type: check_types
-  if not cc.has_type(type[0], prefix: '#include<@0@>'.format(type[1]))
-    config_h.set(type[0], type[2])
-  endif
-endforeach
+if not cc.has_type('pid_t', prefix: '#include<sys/types.h>')
+  config_h.set('pid_t', 'int')
+endif
 
 # compiler flags
-common_flags = ['-DHAVE_CONFIG_H']
+common_flags = []
 common_ldflags = []
 
 enable_ld_gc = get_option('ld_gc')
@@ -491,12 +420,21 @@ if enable_gtk_doc
     'nma-resources.c'
   ]
 
+  ent_conf = configuration_data()
+  ent_conf.set_quoted('PACKAGE', meson.project_name())
+  ent_conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager')
+  ent_conf.set_quoted('PACKAGE_NAME', nma_name)
+  ent_conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(nma_name, nma_version))
+  ent_conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
+  ent_conf.set_quoted('PACKAGE_URL', '')
+  ent_conf.set_quoted('PACKAGE_VERSION', nma_version)
+
   ent = 'gtkdocentities.ent'
 
   configure_file(
     input: ent + '.in',
     output: ent,
-    configuration: config_h
+    configuration: ent_conf
   )
 
   doc_path = join_paths(nma_datadir, 'gtk-doc', 'html', mod_name)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]