mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 15:33:39 +02:00
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time
Calling `dlopen()` with `libutil.so` makes the installed tests depend on
having glibc's development files installed. To avoid this, we can work
out the runtime library name at build time and `dlopen` that instead.
This approach is [taken from libfprint][1], thanks to Marco Trevisan.
[1]: f401f399a8
This commit is contained in:
@@ -187,14 +187,15 @@ test_pollable_unix_pty (void)
|
||||
{
|
||||
int (*openpty_impl) (int *, int *, char *, void *, void *);
|
||||
int a, b, status;
|
||||
#ifdef __linux__
|
||||
#ifdef LIBUTIL_SONAME
|
||||
void *handle;
|
||||
#endif
|
||||
|
||||
g_test_summary ("Test that PTYs are considered pollable");
|
||||
|
||||
#ifdef __linux__
|
||||
handle = dlopen ("libutil.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
#ifdef LIBUTIL_SONAME
|
||||
handle = dlopen (LIBUTIL_SONAME, RTLD_GLOBAL | RTLD_LAZY);
|
||||
g_assert_nonnull (handle);
|
||||
#endif
|
||||
|
||||
openpty_impl = dlsym (RTLD_DEFAULT, "openpty");
|
||||
@@ -223,7 +224,7 @@ test_pollable_unix_pty (void)
|
||||
close (b);
|
||||
|
||||
close_libutil:
|
||||
#ifdef __linux__
|
||||
#ifdef LIBUTIL_SONAME
|
||||
dlclose (handle);
|
||||
#else
|
||||
return;
|
||||
|
Reference in New Issue
Block a user