Merge branch 'solaris' into 'main'

Build fixes for building on Solaris & illumos

See merge request GNOME/glib!4351
This commit is contained in:
Philip Withnall 2024-10-15 09:36:17 +00:00
commit b9a39848da
5 changed files with 24 additions and 5 deletions

View File

@ -969,6 +969,9 @@ else
have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', 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_function('elf_getshdrnum', dependencies : libelf)
have_libelf = have_libelf and cc.has_header('libelf.h') have_libelf = have_libelf and cc.has_header('libelf.h')
# This check is necessary for Solaris & illumos, where 32-bit libelf
# is incompatible with large-file mode, which meson forces to be enabled
have_libelf = have_libelf and cc.compiles('#include <libelf.h>', name: 'libelf.h')
endif endif
if have_libelf if have_libelf

View File

@ -2469,7 +2469,7 @@ test_copy_preserve_mode (void)
/* Reset the umask after querying it above. Theres no way to query it without /* Reset the umask after querying it above. Theres no way to query it without
* changing it. */ * changing it. */
umask (current_umask); umask (current_umask);
g_test_message ("Current umask: %u", current_umask); g_test_message ("Current umask: %u", (unsigned int) current_umask);
for (i = 0; i < G_N_ELEMENTS (vectors); i++) for (i = 0; i < G_N_ELEMENTS (vectors); i++)
{ {

View File

@ -699,6 +699,7 @@ safe_fdwalk (int (*cb)(void *data, int fd), void *data)
* fcntl(fd, F_PREVFD) * fcntl(fd, F_PREVFD)
* - return highest allocated file descriptor < fd. * - return highest allocated file descriptor < fd.
*/ */
gint open_max;
gint fd; gint fd;
gint res = 0; gint res = 0;

View File

@ -228,7 +228,7 @@ test_child_private (void)
spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD; spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD;
#endif #endif
g_snprintf (pid, sizeof(pid), "%d", getpid ()); g_snprintf (pid, sizeof (pid), "%d", (int) getpid ());
child_argv[0] = local_argv[0]; child_argv[0] = local_argv[0];
child_argv[1] = "mapchild"; child_argv[1] = "mapchild";
child_argv[2] = pid; child_argv[2] = pid;

View File

@ -237,6 +237,8 @@ add_project_arguments('-D_GNU_SOURCE', language: 'c')
if host_system == 'qnx' if host_system == 'qnx'
add_project_arguments('-D_QNX_SOURCE', language: 'c') add_project_arguments('-D_QNX_SOURCE', language: 'c')
elif host_system == 'sunos'
add_project_arguments('-D__EXTENSIONS__', language: 'c')
endif endif
# dummy/empty dependency() object to declare fallbacks and simpler dependencies # dummy/empty dependency() object to declare fallbacks and simpler dependencies
@ -2481,10 +2483,23 @@ have_pkg_config = find_program('pkg-config', required: false).found()
# Some installed tests require a custom environment # Some installed tests require a custom environment
env_program = find_program('env', required: installed_tests_enabled) env_program = find_program('env', required: installed_tests_enabled)
# FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578 # illumos & Solaris may need extra definitions to expose some SUS/POSIX
# interfaces in headers that conflict with previous Solaris headers.
# But if we define them to request an older version of the standards,
# we may hide things introduced in newer versions. We only check the
# versions that are supported on systems new enough that meson runs on them.
if host_system == 'sunos' if host_system == 'sunos'
glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1) xopen_test_code = '''#include <unistd.h>
glib_conf.set('_XOPEN_SOURCE', 2) #if _XOPEN_VERSION != _XOPEN_SOURCE
#error "XOPEN_SOURCE of _XOPEN_SOURCE not supported"
#endif'''
foreach std : ['800', '700', '600']
if cc.compiles(xopen_test_code, args: '-D_XOPEN_SOURCE=' + std, name: 'building with _XOPEN_SOURCE=' + std)
xopen_version = std
break
endif
endforeach
glib_conf.set('_XOPEN_SOURCE', xopen_version)
glib_conf.set('__EXTENSIONS__',1) glib_conf.set('__EXTENSIONS__',1)
endif endif