mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 22:16:16 +01:00
Merge branch 'work-out-libutil-soname-at-build-time' into 'master'
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time See merge request GNOME/glib!1977
This commit is contained in:
commit
519bdf665b
@ -12,6 +12,21 @@ test_c_args = [
|
|||||||
'-UG_DISABLE_ASSERT',
|
'-UG_DISABLE_ASSERT',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# workaround for https://github.com/mesonbuild/meson/issues/6880
|
||||||
|
if build_machine.system() == 'linux'
|
||||||
|
libutil_name = 'libutil'
|
||||||
|
libutil = run_command('sh', '-c',
|
||||||
|
'''ldconfig -p | grep -o "[[:space:]]@0@\.so\(\.[0-9]\+\)\?\b"'''
|
||||||
|
.format(libutil_name)).stdout().strip().split('\n')
|
||||||
|
|
||||||
|
if libutil.length() > 0
|
||||||
|
message('Found libutil as @0@'.format(libutil[0]))
|
||||||
|
test_c_args += '-DLIBUTIL_SONAME="@0@"'.format(libutil[0])
|
||||||
|
else
|
||||||
|
warning('libutil not found')
|
||||||
|
endif # libutil.length() > 0
|
||||||
|
endif # build_machine.system() == 'linux'
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
|
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
|
||||||
endif
|
endif
|
||||||
|
@ -187,14 +187,15 @@ test_pollable_unix_pty (void)
|
|||||||
{
|
{
|
||||||
int (*openpty_impl) (int *, int *, char *, void *, void *);
|
int (*openpty_impl) (int *, int *, char *, void *, void *);
|
||||||
int a, b, status;
|
int a, b, status;
|
||||||
#ifdef __linux__
|
#ifdef LIBUTIL_SONAME
|
||||||
void *handle;
|
void *handle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_test_summary ("Test that PTYs are considered pollable");
|
g_test_summary ("Test that PTYs are considered pollable");
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef LIBUTIL_SONAME
|
||||||
handle = dlopen ("libutil.so", RTLD_GLOBAL | RTLD_LAZY);
|
handle = dlopen (LIBUTIL_SONAME, RTLD_GLOBAL | RTLD_LAZY);
|
||||||
|
g_assert_nonnull (handle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
openpty_impl = dlsym (RTLD_DEFAULT, "openpty");
|
openpty_impl = dlsym (RTLD_DEFAULT, "openpty");
|
||||||
@ -223,7 +224,7 @@ test_pollable_unix_pty (void)
|
|||||||
close (b);
|
close (b);
|
||||||
|
|
||||||
close_libutil:
|
close_libutil:
|
||||||
#ifdef __linux__
|
#ifdef LIBUTIL_SONAME
|
||||||
dlclose (handle);
|
dlclose (handle);
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user