[dia: 8/105] #19: Code cleanup: set HAVE_HEADER_H in config.h instead of asserting.
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia: 8/105] #19: Code cleanup: set HAVE_HEADER_H in config.h instead of asserting.
- Date: Mon, 28 Jan 2019 19:19:59 +0000 (UTC)
commit b20c9ee462518b2b4718656fbcb4fa4e86954921
Author: Eduard Nicodei <eddnicodei gmail com>
Date: Mon Dec 17 00:43:58 2018 +0000
#19: Code cleanup: set HAVE_HEADER_H in config.h instead of asserting.
- Also define -DHAVE_CONFIG_H to ensure certain .c files compile.
lib/meson.build | 6 ------
meson.build | 35 +++++++++++++++++------------------
2 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/lib/meson.build b/lib/meson.build
index 26096712..5730b439 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -96,12 +96,6 @@ libdia_sources = stdprop_sources + [
'diacellrendererproperty.c',
]
-libm_dep = cc.find_library(
- 'm', required : false)
-
-libzlib_dep = dependency('zlib')
-
-
glib_genmarshal = find_program('glib-genmarshal')
diamarshal_c = custom_target(
'diamarshal.c',
diff --git a/meson.build b/meson.build
index f9b0c702..90213545 100644
--- a/meson.build
+++ b/meson.build
@@ -11,11 +11,17 @@ i18n = import('i18n')
gettext_package = 'dia'
subdir('po')
+cc = meson.get_compiler('c')
+
#GTK_MODULES="gtk+-2.0 >= 2.16.0 glib-2.0 >= 2.20.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0 gmodule-2.0"
libgtk_dep = dependency('gtk+-2.0', version : '>= 2.16.0')
libglib_dep = dependency('glib-2.0', version : '>= 2.20.0')
libxml_dep = dependency('libxml-2.0')
gmodule_dep = dependency('gmodule-2.0')
+libm_dep = cc.find_library('m', required : false)
+
+libzlib_dep = dependency('zlib')
+
# Used in pixmap csource generation.
gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
@@ -24,25 +30,7 @@ gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
#AC_PROG_LN_S
#AC_PROG_MAKE_SET
#AC_ISC_POSIX
-cc = meson.get_compiler('c')
-
-#AC_HEADER_STDC
-#TODO: do w eneed to check for this?
-#AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
-check_headers = ['stddef.h', 'fcntl.h', 'unistd.h', 'utime.h']
-foreach h : check_headers
- #TODO: documentation we should use dependency instead of has_header.
- assert(cc.has_header(h), h + ' required')
-endforeach
-
-#TODO: do we need to check for this?
-#AC_C_CONST
-#AC_CHECK_FUNCS(select strcspn strdup strtol)
-check_funcs = ['select', 'strcspn', 'strdup', 'strtol']
-foreach f : check_funcs
- assert(cc.has_function(f), f + ' is required')
-endforeach
# Specify a header configuration file
conf = configuration_data()
@@ -55,9 +43,20 @@ conf.set_quoted('LIBDIR', get_option('libdir'))
conf.set_quoted('LOCALEDIR', get_option('localedir'))
conf.set('ENABLE_NLS', 1)
+foreach h : ['stddef.h', 'fcntl.h', 'unistd.h', 'utime.h']
+ conf.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
+endforeach
+
+foreach f : ['select', 'strcspn', 'strdup', 'strtol']
+ conf.set10('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
+endforeach
+
configure_file(output : 'config.h',
configuration : conf)
configuration_inc = include_directories('.')
+# FIXME: I don't think this should be defined.
+# To fix we should remove #ifdef HAVE_CONFIG_H checks from all source files.
+add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
subdir('lib')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]