diff options
| author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2026-07-04 14:19:33 -0700 |
|---|---|---|
| committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2026-07-04 14:19:33 -0700 |
| commit | fefff2bbeb274efd9c83daf55bb147d2507fb222 (patch) | |
| tree | a74dc6dfd572e3437da8dfffad46539477ea1306 | |
| parent | b1e74f5d3ad97837932feb2b7209f36950e4dade (diff) | |
Trying to workaround https://github.com/mesonbuild/meson/issues/3740
which causes meson to fail to detect missing functions in some cases.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/app/xdm/-/merge_requests/31>
| -rw-r--r-- | meson.build | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/meson.build b/meson.build index dece54a..6a4713a 100644 --- a/meson.build +++ b/meson.build @@ -73,6 +73,35 @@ greeter_deps = [dep_libxext, dep_libxt, dep_libxaw, dep_libxdmcp] dep_libbsd = dependency('libbsd-overlay', required: false) +func_prefix = [] + +headers_to_check = [ + 'sys/types.h', + 'string.h', # strlcpy + 'strings.h', # strcasecmp + 'stdio.h', # asprintf + 'stdlib.h', # setproctitle, arc4random, daemon, mkstemp + 'unistd.h', # vfork + 'sys/socket.h', # socket, getifaddrs + 'ifaddrs.h', # getifaddrs + 'netdb.h', # gethostbyname, getaddrinfo, getnameinfo + 'netinet/in.h', # inet_ntop + 'arpa/inet.h', # inet_ntop + 'crypt.h', # crypt + 'shadow.h', # getspnam + 'login_cap.h', # setusercontext + 'dlfcn.h', # dlopen + 'rpc/rpc.h', # authdes_*create + 'rpc/key_prot.h', # getsecretkey + 'signal.h', # sigaction + 'syslog.h', # openlog +] +foreach h: headers_to_check + if cc.has_header(h, prefix: func_prefix) + func_prefix += f'#include <@h@>' + endif +endforeach + libs = [] funcs_to_check_in_libs = { @@ -121,7 +150,8 @@ funcs_to_check_in_libs = { # Replacement for AC_SEARCH_LIBS foreach f, libs_to_check: funcs_to_check_in_libs - has_func = cc.has_function(f, args: system_extensions, dependencies: libs) + has_func = cc.has_function(f, args: system_extensions, prefix: func_prefix, + dependencies: libs) if not has_func foreach l: libs_to_check if l == 'bsd' @@ -131,6 +161,7 @@ foreach f, libs_to_check: funcs_to_check_in_libs endif if lib.found() has_func = cc.has_function(f, args: system_extensions, + prefix: func_prefix, dependencies: [libs, lib]) if has_func libs += lib @@ -240,7 +271,7 @@ endforeach conf.set( 'HAVE_DECL_KEY_SETNET', cc.has_header_symbol( - 'rpc/key_prot.h', 'key_setnet', + 'rpc/key_prot.h', 'key_setnet', args: system_extensions, prefix: '#include <rpc/rpc.h>', ), @@ -261,7 +292,8 @@ funcs_to_check = [ ] foreach f: funcs_to_check - has_func = cc.has_function(f, args: system_extensions, dependencies: libs) + has_func = cc.has_function(f, args: system_extensions, prefix: func_prefix, + dependencies: libs) have_f_name = 'HAVE_' + f.to_upper().underscorify() conf.set(have_f_name, has_func ? '1' : false, description: f'Define to 1 if you have the \'@f@\' function.') @@ -278,6 +310,7 @@ conf.set( # Check for pluggable authentication modules (PAM) support use_pam = false if get_option('pam').allowed() + pam_prefix = [] headers_to_check = ['security/pam_appl.h', 'pam/pam_appl.h'] found_pam_header = false foreach h: headers_to_check @@ -289,17 +322,18 @@ if get_option('pam').allowed() description: f'Define to 1 if you have the <@h@> header file.' ) if have_h == true + pam_prefix += f'#include <@h@>' found_pam_header = true break endif endforeach found_pam_func = cc.has_function('pam_open_session', args: system_extensions, - dependencies: libs) + prefix: pam_prefix, dependencies: libs) if not found_pam_func dep_libpam = cc.find_library('pam', required: false) if dep_libpam.found() found_pam_func = cc.has_function('pam_open_session', - args: system_extensions, dependencies: dep_libpam) + args: system_extensions, prefix: pam_prefix, dependencies: dep_libpam) libs = [dep_libpam, libs] endif endif @@ -322,6 +356,7 @@ if get_option('selinux').enabled() use_selinux = cc.has_function( 'is_selinux_enabled', args: system_extensions, + prefix: '#include <selinux/selinux.h>', dependencies: libs) if not use_selinux dep_selinux = cc.find_library('selinux', required: true) @@ -329,6 +364,7 @@ if get_option('selinux').enabled() use_selinux = cc.has_function( 'is_selinux_enabled', args: system_extensions, + prefix: '#include <selinux/selinux.h>', dependencies: dep_selinux, required: true ) @@ -489,6 +525,10 @@ conf.set_quoted('DEF_GREETER_LIB', greeterlib, xdm_deps += [dep_libxdmcp, dep_libxau] xdmauth = cc.has_function('XdmcpWrap', args: system_extensions, + prefix: [ + '#define HASXDMAUTH 1', + '#include <X11/Xdmcp.h>', + ], dependencies: dep_libxdmcp) xdmauth_enable = get_option('xdm-auth').enable_auto_if(xdmauth).require(xdmauth, error_message: 'XDM-AUTH support requested, but XdmcpWrap not found in libXdmcp') |
