mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-28 23:16:14 +01:00
Merge branch 'wip/lantw/meson-move-libdl_dep-to-the-top-level' into 'master'
meson: Move libdl_dep to the top level See merge request GNOME/glib!1071
This commit is contained in:
commit
9456cec53e
@ -140,17 +140,13 @@ if host_machine.system() != 'windows'
|
|||||||
}
|
}
|
||||||
|
|
||||||
if have_rtld_next
|
if have_rtld_next
|
||||||
# FIXME: This list will probably grow; see
|
|
||||||
# https://gitlab.gnome.org/GNOME/glib/issues/1739
|
|
||||||
no_libdl_systems = ['freebsd', 'netbsd', 'openbsd']
|
|
||||||
|
|
||||||
gio_tests += {
|
gio_tests += {
|
||||||
'gsocketclient-slow' : {
|
'gsocketclient-slow' : {
|
||||||
'depends' : [
|
'depends' : [
|
||||||
shared_library('slow-connect-preload',
|
shared_library('slow-connect-preload',
|
||||||
'slow-connect-preload.c',
|
'slow-connect-preload.c',
|
||||||
name_prefix : '',
|
name_prefix : '',
|
||||||
dependencies: cc.find_library('dl', required: not no_libdl_systems.contains(host_machine.system())),
|
dependencies: libdl_dep,
|
||||||
install_dir : installed_tests_execdir,
|
install_dir : installed_tests_execdir,
|
||||||
install: installed_tests_enabled,
|
install: installed_tests_enabled,
|
||||||
)
|
)
|
||||||
|
@ -4,23 +4,8 @@ g_module_need_uscore = 0
|
|||||||
g_module_broken_rtld_global = 0
|
g_module_broken_rtld_global = 0
|
||||||
g_module_have_dlerror = 0
|
g_module_have_dlerror = 0
|
||||||
|
|
||||||
libdl_dep = [ ]
|
|
||||||
g_module_lib_args = [ ]
|
|
||||||
g_module_impl = ''
|
g_module_impl = ''
|
||||||
|
|
||||||
dlopen_dlsym_test_code = '''
|
|
||||||
#include <dlfcn.h>
|
|
||||||
int glib_underscore_test (void) { return 42; }
|
|
||||||
int main (int argc, char ** argv) {
|
|
||||||
void *f1 = (void*)0, *f2 = (void*)0, *handle;
|
|
||||||
handle = dlopen ((void*)0, 0);
|
|
||||||
if (handle) {
|
|
||||||
f1 = dlsym (handle, "glib_underscore_test");
|
|
||||||
f2 = dlsym (handle, "_glib_underscore_test");
|
|
||||||
}
|
|
||||||
return (!f2 || f1);
|
|
||||||
}'''
|
|
||||||
|
|
||||||
# On Windows force native WIN32 shared lib loader
|
# On Windows force native WIN32 shared lib loader
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
g_module_impl = 'G_MODULE_IMPL_WIN32'
|
g_module_impl = 'G_MODULE_IMPL_WIN32'
|
||||||
@ -28,16 +13,12 @@ if host_system == 'windows'
|
|||||||
# dlopen() filepath must be of the form /path/libname.a(libname.so)
|
# dlopen() filepath must be of the form /path/libname.a(libname.so)
|
||||||
elif host_system == 'aix'
|
elif host_system == 'aix'
|
||||||
g_module_impl = 'G_MODULE_IMPL_AR'
|
g_module_impl = 'G_MODULE_IMPL_AR'
|
||||||
elif cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries')
|
|
||||||
g_module_impl = 'G_MODULE_IMPL_DL'
|
|
||||||
# NSLinkModule (dyld) in system libraries (Darwin)
|
# NSLinkModule (dyld) in system libraries (Darwin)
|
||||||
elif cc.has_function('NSLinkModule')
|
elif cc.has_function('NSLinkModule')
|
||||||
g_module_impl = 'G_MODULE_IMPL_DYLD'
|
g_module_impl = 'G_MODULE_IMPL_DYLD'
|
||||||
g_module_need_uscore = 1
|
g_module_need_uscore = 1
|
||||||
elif cc.links(dlopen_dlsym_test_code, args : '-ldl', name : 'dlopen() and dlsym() in libdl')
|
elif have_dlopen_dlsym
|
||||||
g_module_impl = 'G_MODULE_IMPL_DL'
|
g_module_impl = 'G_MODULE_IMPL_DL'
|
||||||
libdl_dep = cc.find_library('dl')
|
|
||||||
g_module_lib_args = '-ldl'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# additional checks for G_MODULE_IMPL_DL
|
# additional checks for G_MODULE_IMPL_DL
|
||||||
@ -51,7 +32,7 @@ if g_module_impl == 'G_MODULE_IMPL_DL'
|
|||||||
elif meson.has_exe_wrapper()
|
elif meson.has_exe_wrapper()
|
||||||
# FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red
|
# FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red
|
||||||
rres = cc.run(dlopen_dlsym_test_code,
|
rres = cc.run(dlopen_dlsym_test_code,
|
||||||
args : g_module_lib_args,
|
dependencies : libdl_dep,
|
||||||
name : 'dlsym() preceding underscores')
|
name : 'dlsym() preceding underscores')
|
||||||
if host_system == 'windows' or rres.returncode() == 0
|
if host_system == 'windows' or rres.returncode() == 0
|
||||||
g_module_need_uscore = 1
|
g_module_need_uscore = 1
|
||||||
@ -61,7 +42,7 @@ if g_module_impl == 'G_MODULE_IMPL_DL'
|
|||||||
g_module_need_uscore = 0
|
g_module_need_uscore = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cc.has_function('dlerror', args : g_module_lib_args)
|
if cc.has_function('dlerror', dependencies : libdl_dep)
|
||||||
g_module_have_dlerror = 1
|
g_module_have_dlerror = 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
22
meson.build
22
meson.build
@ -721,6 +721,28 @@ elif cc.links(clock_gettime_test_code, args : '-lrt', name : 'clock_gettime in l
|
|||||||
librt = cc.find_library('rt')
|
librt = cc.find_library('rt')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
dlopen_dlsym_test_code = '''
|
||||||
|
#include <dlfcn.h>
|
||||||
|
int glib_underscore_test (void) { return 42; }
|
||||||
|
int main (int argc, char ** argv) {
|
||||||
|
void *f1 = (void*)0, *f2 = (void*)0, *handle;
|
||||||
|
handle = dlopen ((void*)0, 0);
|
||||||
|
if (handle) {
|
||||||
|
f1 = dlsym (handle, "glib_underscore_test");
|
||||||
|
f2 = dlsym (handle, "_glib_underscore_test");
|
||||||
|
}
|
||||||
|
return (!f2 || f1);
|
||||||
|
}'''
|
||||||
|
libdl_dep = []
|
||||||
|
if cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries')
|
||||||
|
have_dlopen_dlsym = true
|
||||||
|
elif cc.links(dlopen_dlsym_test_code, args : '-ldl', name : 'dlopen() and dlsym() in libdl')
|
||||||
|
have_dlopen_dlsym = true
|
||||||
|
libdl_dep = cc.find_library('dl')
|
||||||
|
else
|
||||||
|
have_dlopen_dlsym = false
|
||||||
|
endif
|
||||||
|
|
||||||
# if statfs() takes 2 arguments (Posix) or 4 (Solaris)
|
# if statfs() takes 2 arguments (Posix) or 4 (Solaris)
|
||||||
if have_func_statfs
|
if have_func_statfs
|
||||||
if cc.compiles(glib_conf_prefix + '''
|
if cc.compiles(glib_conf_prefix + '''
|
||||||
|
Loading…
Reference in New Issue
Block a user