Merge branch 'wip/lantw/freebsd-meson-builds' into 'master'

Fix meson build files for FreeBSD

See merge request GNOME/glib!73
This commit is contained in:
Philip Withnall 2018-06-11 10:53:10 +00:00
commit 262b153c41
6 changed files with 32 additions and 3 deletions

View File

@ -665,6 +665,8 @@ AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [],
AC_CHECK_FUNCS(sysctlbyname)
AC_HEADER_MAJOR
AS_IF([test "$ac_cv_header_sys_types_h_makedev" = "yes"],
[AC_DEFINE([MAJOR_IN_TYPES], [1], [Define to 1 if `major', `minor', and `makedev' are declared in <sys/types.h>.])])
AC_CHECK_HEADERS([xlocale.h])
# check for structure fields

View File

@ -32,6 +32,8 @@
#include <sys/mkdev.h>
#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
#elif MAJOR_IN_TYPES
#include <sys/types.h>
#else
#define MAJOR_MINOR_NOT_FOUND 1
#endif

View File

@ -108,7 +108,7 @@ _fallback_callback (GFileMonitor *unused,
* Returns: TRUE if the file should be excluded from the kqueue-powered
* monitoring, FALSE otherwise.
**/
gboolean
static gboolean
_ke_is_excluded (const char *full_path)
{
GFile *f = NULL;

View File

@ -844,9 +844,26 @@ else
endif
# Dependencies used by executables below
have_libelf = false
libelf = dependency('libelf', version : '>= 0.8.12', required : false)
if libelf.found()
have_libelf = true
else
# This fallback is necessary on *BSD. elfutils isn't the only libelf
# implementation, and *BSD usually includes their own libelf as a system
# library which doesn't have a corresponding .pc file.
libelf = cc.find_library('elf', required : false)
have_libelf = libelf.found()
have_libelf = have_libelf and cc.has_function('elf_begin', dependencies : libelf)
have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', dependencies : libelf)
have_libelf = have_libelf and cc.has_function('elf_getshdrnum', dependencies : libelf)
have_libelf = have_libelf and cc.has_header('libelf.h')
endif
if have_libelf
glib_conf.set('HAVE_LIBELF', 1)
else
libelf = []
endif
gconstructor_as_data_h = custom_target('gconstructor_as_data.h',

View File

@ -376,7 +376,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
resource_plugin_platform_link_args = []
endif
shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
link_args : ['-export-dynamic'] + resource_plugin_platform_link_args,
link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
dependencies : common_gio_tests_deps)
test_gresource = custom_target('test.gresource',

View File

@ -207,7 +207,6 @@ headers = [
'linux/magic.h',
'locale.h',
'mach/mach_time.h',
'malloc.h',
'memory.h',
'mntent.h',
'poll.h',
@ -254,6 +253,13 @@ foreach h : headers
endif
endforeach
# FIXME: Use cc.check_header from Meson 0.47.
# FreeBSD includes a malloc.h which always throw compilation error.
if cc.compiles('#include <malloc.h>', name : 'malloc.h')
glib_conf.set('HAVE_MALLOC_H', 1)
glib_conf_prefix = glib_conf_prefix + '#define HAVE_MALLOC_H 1\n'
endif
if cc.has_header('linux/netlink.h')
glib_conf.set('HAVE_NETLINK', 1)
endif
@ -524,6 +530,8 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
glib_conf.set('MAJOR_IN_SYSMACROS', 1)
elif cc.has_header_symbol('sys/mkdev.h', 'major')
glib_conf.set('MAJOR_IN_MKDEV', 1)
elif cc.has_header_symbol('sys/types.h', 'major')
glib_conf.set('MAJOR_IN_TYPES', 1)
endif
if cc.has_header_symbol('dlfcn.h', 'RTLD_LAZY')