build-sys: meson: Add some missing checks

- Header and function checks from configure.ac
  (some libc, some libpthread, dladdr from libdl)
- Find iconv and check constness
parent 91fb54da
Pipeline #55487 passed with stage
in 12 minutes and 3 seconds
...@@ -171,10 +171,13 @@ endif ...@@ -171,10 +171,13 @@ endif
check_headers = [ check_headers = [
'arpa/inet.h', 'arpa/inet.h',
'byteswap.h',
'cpuid.h', 'cpuid.h',
'dlfcn.h',
'execinfo.h', 'execinfo.h',
'grp.h', 'grp.h',
'langinfo.h', 'langinfo.h',
'linux/sockios.h',
'locale.h', 'locale.h',
'netdb.h', 'netdb.h',
'netinet/in.h', 'netinet/in.h',
...@@ -187,16 +190,20 @@ check_headers = [ ...@@ -187,16 +190,20 @@ check_headers = [
'regex.h', 'regex.h',
'sched.h', 'sched.h',
'sys/capability.h', 'sys/capability.h',
'sys/dl.h',
'sys/eventfd.h', 'sys/eventfd.h',
'sys/ioctl.h',
'sys/filio.h', 'sys/filio.h',
'sys/ioctl.h',
'sys/mman.h', 'sys/mman.h',
'sys/prctl.h', 'sys/prctl.h',
'sys/resource.h', 'sys/resource.h',
'sys/select.h', 'sys/select.h',
'sys/socket.h', 'sys/socket.h',
'sys/syscall.h',
'sys/uio.h',
'sys/un.h', 'sys/un.h',
'sys/wait.h', 'sys/wait.h',
'syslog.h',
'valgrind/memcheck.h', 'valgrind/memcheck.h',
'xlocale.h', 'xlocale.h',
] ]
...@@ -218,35 +225,46 @@ endif ...@@ -218,35 +225,46 @@ endif
check_functions = [ check_functions = [
'accept4', 'accept4',
'clock_gettime', 'clock_gettime',
'ctime_r',
'fchmod', 'fchmod',
'fchown', 'fchown',
'fork', 'fork',
'fstat', 'fstat',
'getaddrinfo', 'getaddrinfo',
'getgrgid_r', 'getgrgid_r',
'getgrnam_r',
'getpwnam_r', 'getpwnam_r',
'getpwuid_r',
'gettimeofday', 'gettimeofday',
'getuid', 'getuid',
'lrintf',
'lstat', 'lstat',
'memfd_create', 'memfd_create',
'mkfifo', 'mkfifo',
'mlock', 'mlock',
'nanosleep', 'nanosleep',
'open64',
'paccept', 'paccept',
'pipe', 'pipe',
'pipe2', 'pipe2',
'posix_fadvise',
'posix_madvise', 'posix_madvise',
'posix_memalign',
'ppoll',
'readlink', 'readlink',
'setegid', 'setegid',
'seteuid', 'seteuid',
'setpgid',
'setregid', 'setregid',
'setreuid',
'setresgid', 'setresgid',
'setresuid', 'setresuid',
'setreuid',
'setsid', 'setsid',
'sig2str', 'sig2str',
'sigaction', 'sigaction',
'strerror_r',
'strtod_l', 'strtod_l',
'strtof',
'symlink', 'symlink',
'sysconf', 'sysconf',
'uname', 'uname',
...@@ -307,7 +325,19 @@ endif ...@@ -307,7 +325,19 @@ endif
# Core Dependencies # Core Dependencies
libm_dep = cc.find_library('m', required : true) libm_dep = cc.find_library('m', required : true)
thread_dep = dependency('threads') thread_dep = dependency('threads')
foreach f : [
'pthread_getname_np',
'pthread_setaffinity_np',
'pthread_setname_np',
]
if cc.has_function(f, dependencies : thread_dep)
define = 'HAVE_' + f.underscorify().to_upper()
cdata.set(define, 1)
endif
endforeach
cap_dep = cc.find_library('cap', required : false) cap_dep = cc.find_library('cap', required : false)
shm_dep = cc.find_library('rt', required : false) shm_dep = cc.find_library('rt', required : false)
...@@ -315,6 +345,30 @@ if shm_dep.found() ...@@ -315,6 +345,30 @@ if shm_dep.found()
cdata.set('HAVE_SHM_OPEN', 1) cdata.set('HAVE_SHM_OPEN', 1)
endif endif
dl_dep = cc.find_library('dl', required : false)
if dl_dep.found()
cdata.set('HAVE_DLADDR', 1)
endif
have_iconv = false
if cc.has_function('iconv_open')
iconv_dep = dependency('', required : false)
have_iconv = true
else
iconv_dep = cc.find_library('iconv', required : false)
have_iconv = iconv_dep.found()
endif
if have_iconv
cdata.set('HAVE_ICONV', 1)
iconvconsttest = '''#include <iconv.h>
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
'''
if cc.compiles(iconvconsttest, dependencies : iconv_dep)
cdata.set('ICONV_CONST', '')
else
cdata.set('ICONV_CONST', 'const')
endif
endif
atomictest = '''void func() { atomictest = '''void func() {
volatile int atomic = 2; volatile int atomic = 2;
......
...@@ -31,7 +31,7 @@ executable('pulseaudio', ...@@ -31,7 +31,7 @@ executable('pulseaudio',
include_directories : [configinc, topinc], include_directories : [configinc, topinc],
link_args : ['-ffast-math'], link_args : ['-ffast-math'],
link_with : [libpulsecore, libpulsecommon, libpulse], link_with : [libpulsecore, libpulsecommon, libpulse],
dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep], dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep, dl_dep],
c_args : pa_c_args, c_args : pa_c_args,
) )
......
...@@ -181,7 +181,10 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor, ...@@ -181,7 +181,10 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
link_args : [nodelete_link_args], link_args : [nodelete_link_args],
install : true, install : true,
install_dir : privlibdir, install_dir : privlibdir,
dependencies : [libm_dep, thread_dep, shm_dep, sndfile_dep, dbus_dep, x11_dep, libsystemd_dep, glib_dep, gtk_dep, asyncns_dep], dependencies : [
libm_dep, thread_dep, dl_dep, shm_dep, iconv_dep, sndfile_dep, dbus_dep,
x11_dep, libsystemd_dep, glib_dep, gtk_dep, asyncns_dep
],
implicit_include_directories : false) implicit_include_directories : false)
libpulsecommon_dep = declare_dependency(link_with: libpulsecommon) libpulsecommon_dep = declare_dependency(link_with: libpulsecommon)
......
...@@ -81,7 +81,7 @@ libpulse = shared_library('pulse', ...@@ -81,7 +81,7 @@ libpulse = shared_library('pulse',
link_args : [nodelete_link_args, versioning_link_args], link_args : [nodelete_link_args, versioning_link_args],
install : true, install : true,
install_rpath : privlibdir, install_rpath : privlibdir,
dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep], dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep],
implicit_include_directories : false) implicit_include_directories : false)
libpulse_dep = declare_dependency(link_with: libpulse) libpulse_dep = declare_dependency(link_with: libpulse)
......
...@@ -127,7 +127,7 @@ norun_tests = [ ...@@ -127,7 +127,7 @@ norun_tests = [
[ 'remix-test', 'remix-test.c', [ 'remix-test', 'remix-test.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'rtstutter', 'rtstutter.c', [ 'rtstutter', 'rtstutter.c',
[ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'sig2str-test', 'sig2str-test.c', [ 'sig2str-test', 'sig2str-test.c',
[ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
[ 'stripnul', 'stripnul.c', [ 'stripnul', 'stripnul.c',
......
...@@ -94,8 +94,8 @@ if cc.has_header('sys/soundcard.h') ...@@ -94,8 +94,8 @@ if cc.has_header('sys/soundcard.h')
install_rpath : privlibdir, install_rpath : privlibdir,
include_directories : [configinc, topinc], include_directories : [configinc, topinc],
link_with : [libpulsecommon, libpulse], link_with : [libpulsecommon, libpulse],
link_args : [nodelete_link_args, '-ldl'], link_args : [nodelete_link_args],
dependencies: [thread_dep], dependencies: [thread_dep, dl_dep],
c_args : [pa_c_args, '-Wno-nonnull-compare'] c_args : [pa_c_args, '-Wno-nonnull-compare']
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment