1# SPDX-License-Identifier: MIT 2# Copyright © 2023 Intel Corporation 3 4project( 5 'libXau', 6 'c', 7 version : '1.0.12', 8 license : 'MIT', 9 meson_version : '>= 0.60.0', 10) 11 12add_project_arguments( 13 '-D_GNU_SOURCE', 14 '-D__EXTENSIONS__', 15 language : 'c' 16) 17 18cc = meson.get_compiler('c') 19 20lib_args = [] 21 22foreach f : ['explicit_bzero', 'explicit_memset', 'pathconf'] 23 if cc.has_function(f) 24 lib_args += '-DHAVE_@0@'.format(f.to_upper()) 25 endif 26endforeach 27 28if cc.has_header('unistd.h') 29 lib_args += '-DHAVE_UNISTD_H' 30endif 31 32dep_xproto = dependency('xproto') 33 34if get_option('xthreads') 35 lib_args += '-DXTHREADS' 36 # This define is not in libXau specific code, but is part of the xproto header 37 # This may be only required by HP-UX. 38 if cc.has_function('gethostbyname_r') or \ 39 cc.has_function('gethostbyname_r', dependencies : cc.find_library('nls')) 40 lib_args += '-DXUSE_MTSAFE_API=1' 41 endif 42 if host_machine.system() == 'sunos' 43 lib_args += ['-D_REENETRANT', '-D_POSIX_PTHREAD_SEMANTICS'] 44 endif 45endif 46 47lib = library( 48 'Xau', 49 [ 50 'AuDispose.c', 51 'AuFileName.c', 52 'AuGetAddr.c', 53 'AuGetBest.c', 54 'AuLock.c', 55 'AuRead.c', 56 'AuUnlock.c', 57 'AuWrite.c', 58 ], 59 c_args : lib_args, 60 include_directories : 'include', 61 dependencies : dep_xproto, 62 version : '6.0.0', 63 install : true, 64) 65 66test( 67 'autest', 68 executable( 69 'autest', 70 'Autest.c', 71 link_with : lib, 72 include_directories : 'include', 73 dependencies : dep_xproto, 74 ) 75) 76 77libxau = declare_dependency( 78 link_with : lib, 79 include_directories : 'include', 80) 81 82meson.override_dependency('xau', libxau) 83 84install_headers( 85 'include/X11/Xauth.h', 86 subdir : 'X11', 87) 88 89pkg = import('pkgconfig') 90pkg.generate( 91 lib, 92 description : 'X authorization file management library', 93 filebase : 'xau', 94 requires : 'xproto', 95) 96 97subdir('man') 98