]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - meson.build
Merge branch 'PR/libmount-stat.h'
[thirdparty/util-linux.git] / meson.build
index 931284152c416bed30242a43cbd99331081f0fb9..8e3d6bb1d93dfc42afc4e1514bbd5b2a9fdeb630 100644 (file)
@@ -1,8 +1,9 @@
 project('util-linux', 'c',
         version : run_command('tools/git-version-gen', check: true).stdout(),
-        meson_version: '>=0.53.0',
+        meson_version: '>=0.57.0',
         license : 'GPLv2+')
 
+fs = import('fs')
 pkgconfig = import('pkgconfig')
 
 libblkid_version = '1.1.0'
@@ -40,16 +41,13 @@ conf.set_quoted('PACKAGE_VERSION', meson.project_version())
 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
 conf.set_quoted('PACKAGE_STRING', package_string)
 
-codes = [''' {print $1}  ''',
-         ''' {sub("-.*","",$2); print $2} ''',
-         ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} ''']
 pc_version = []
-foreach code : codes
-  res = run_command('bash', '-c',
-                    '''echo '@0@' | awk -F. '@1@' '''.format(
-                      meson.project_version(), code), check: true)
-  pc_version += res.stdout().strip()
-endforeach
+pc_version = meson.project_version().split('-')[0].split('.')
+
+if pc_version.length() < 3
+    pc_version += '0'
+endif
+
 pc_version = '.'.join(pc_version)
 
 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
@@ -81,6 +79,9 @@ have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/moun
 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
 
+have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
+conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
+
 build_libmount = not get_option('build-libmount').disabled()
 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
@@ -167,11 +168,15 @@ headers = '''
         linux/compiler.h
         linux/falloc.h
         linux/fd.h
+        linux/fs.h
        linux/fiemap.h
        linux/gsmmux.h
+        linux/if_alg.h
+        linux/kcmp.h
         linux/net_namespace.h
         linux/nsfs.h
-        linux/stat.h
+        linux/mount.h
+        linux/pr.h
         linux/securebits.h
         linux/tiocl.h
         linux/version.h
@@ -200,6 +205,7 @@ headers = '''
         sys/socket.h
         sys/sockio.h
         sys/stat.h
+        sys/statfs.h
         sys/swap.h
         sys/syscall.h
         sys/sysmacros.h
@@ -209,6 +215,7 @@ headers = '''
         sys/types.h
         sys/ucred.h
         sys/un.h
+        sys/vfs.h
        sys/xattr.h
 '''.split()
 
@@ -310,6 +317,12 @@ lib_systemd = dependency(
   'libsystemd',
   required : get_option('systemd'))
 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
+conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
+
+have = cc.has_function(
+  'sd_session_get_username',
+  dependencies : lib_systemd)
+conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
 
 lib_udev = dependency(
   'libudev',
@@ -427,6 +440,9 @@ conf.set10('HAVE_STRSIGNAL_DECL', have)
 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
 
+have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
+conf.set('HAVE_LOFF_T', have ? 1 : false)
+
 have = cc.compiles('''
    #define _GNU_SOURCE 1
    #include <langinfo.h>
@@ -473,7 +489,20 @@ have = cc.compiles('''
   name : 'langinfo.h defines _NL_ABALTMON_x constants')
 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
 
+have = cc.compiles('''
+   #define _GNU_SOURCE 1
+   #include <langinfo.h>
+   int main(void) {
+        char *str;
+        str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
+        return 0;
+   }
+   ''',
+  name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
+conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
+
 funcs = '''
+        cachestat
         clearenv
         close_range
         __fpurge
@@ -485,7 +514,6 @@ funcs = '''
         err
         errx
         explicit_bzero
-        fmemopen
         fnmatch
         fseeko
         fsconfig
@@ -493,6 +521,7 @@ funcs = '''
         fsopen
         fspick
         fsync
+        getttynam
         utimensat
         getdomainname
         getdtablesize
@@ -609,6 +638,10 @@ have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
                      prefix : '#include <sys/stat.h>')
 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
 
+have = cc.has_member('struct statx', 'stx_mnt_id',
+                     prefix : '#include <sys/stat.h>')
+conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
+
 # replacement for AC_STRUCT_TIMEZONE
 have = cc.has_member('struct tm', 'tm_zone',
                      prefix : '#include <time.h>')
@@ -617,6 +650,12 @@ conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
 
+have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
+conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
+
+have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
+conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
+
 code = '''
 #include <time.h>
 #if !@0@
@@ -692,6 +731,9 @@ int main(void) {
 have = cc.compiles(code, name : 'using __progname')
 conf.set('HAVE___PROGNAME', have ? 1 : false)
 
+have = conf.get('HAVE_PTY_H') != false and conf.get('HAVE_SYS_SIGNALFD_H') != false
+conf.set('HAVE_PTY', have ? 1 : false)
+
 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
 
@@ -779,6 +821,8 @@ endif
 sysvinit = get_option('sysvinit').enabled()
 sysvinitrcdir = sysconfdir + '/init.d'
 
+program_tests = get_option('program-tests')
+
 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
 
@@ -879,6 +923,7 @@ exe = executable(
   link_with : [lib_common, logindefs_c],
   dependencies : chfn_chsh_deps,
   install_dir : usrbin_exec_dir,
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 
@@ -891,6 +936,7 @@ exe2 = executable(
   link_with : lib_common,
   dependencies : chfn_chsh_deps,
   install_dir : usrbin_exec_dir,
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 if opt and not is_disabler(exe)
@@ -903,7 +949,8 @@ exe = executable(
   'test_islocal',
   test_islocal_sources,
   include_directories : includes,
-  c_args : '-DTEST_PROGRAM')
+  c_args : '-DTEST_PROGRAM',
+  build_by_default : program_tests)
 exes += exe
 
 exe = executable(
@@ -911,7 +958,8 @@ exe = executable(
   test_consoles_sources,
   c_args : ['-DTEST_PROGRAM'],
   include_directories : includes,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default : program_tests)
 exes += exe
 
 opt = not get_option('build-last').disabled()
@@ -978,6 +1026,7 @@ exe = executable(
                   lib_pam_misc,
                   lib_util,
                   realtime_libs],
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 if opt and not is_disabler(exe)
@@ -993,11 +1042,13 @@ exe = executable(
   include_directories : includes,
   dependencies : [lib_crypt],
   install_dir : usrbin_exec_dir,
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 if opt and not is_disabler(exe)
   exes += exe
   manadocs += ['login-utils/newgrp.1.adoc']
+  bashcompletions += ['newgrp']
 endif
 
 opt = not get_option('build-lslogins').disabled()
@@ -1036,6 +1087,9 @@ if opt and not is_disabler(exe)
                            'vipw',
                            join_paths(usrbin_exec_dir, 'vigr'))
   manadocs += ['login-utils/vipw.8.adoc']
+  meson.add_install_script(meson_make_symlink,
+                           'vipw.8',
+                           join_paths(mandir, 'man8/vigr.8'))
 endif
 
 opt = not get_option('build-runuser').disabled()
@@ -1186,7 +1240,7 @@ exe2 = executable(
   dependencies : [lib_tinfo,
                   curses_libs,
                  lib_magic],
-  build_by_default : opt)
+  build_by_default : opt and program_tests)
 exes += exe
 if opt and not is_disabler(exe)
   exes += [exe, exe2]
@@ -1316,6 +1370,20 @@ if not is_disabler(exe)
   bashcompletions += ['renice']
 endif
 
+exe = executable(
+  'setpgid',
+  setpgid_sources,
+  include_directories: includes,
+  link_with : [lib_common,
+               lib_smartcols],
+  install_dir : usrbin_exec_dir,
+  install : true)
+if opt and not is_disabler(exe)
+  exes += exe
+  manadocs += ['sys-utils/setpgid.1.adoc']
+  bashcompletions += ['setpgid']
+endif
+
 exe = executable(
   'setsid',
   setsid_sources,
@@ -1392,7 +1460,8 @@ exe = executable(
   include_directories : dir_include,
   c_args : '-DTEST_DMESG',
   link_with : [lib_common,
-               lib_tcolors])
+               lib_tcolors],
+  build_by_default : program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -1605,6 +1674,7 @@ exe = executable(
                lib_smartcols,
                lib_mount],
   dependencies : lib_selinux,
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 exe2 = executable(
@@ -1613,6 +1683,7 @@ exe2 = executable(
   include_directories : includes,
   link_with : [lib_common,
                lib_mount],
+  install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
 if opt and not is_disabler(exe)
@@ -2036,7 +2107,7 @@ exe2 = executable(
   include_directories : includes,
   c_args : '-DTEST_SCRIPT',
   link_with : [lib_common],
-  build_by_default : opt)
+  build_by_default : opt and program_tests)
 exe3 = executable(
   'fsck.minix',
   fsck_minix_sources,
@@ -2281,7 +2352,8 @@ exe = executable(
   dependencies : [lib_util,
                   lib_utempter,
                   realtime_libs,
-                  math_libs])
+                  math_libs],
+  build_by_default : program_tests)
 exes += exe
 
 exe = executable(
@@ -2316,7 +2388,7 @@ exe = executable(
   agetty_sources,
   include_directories : includes,
   link_with : [lib_common, logindefs_c],
-  dependencies : BSD ? lib_util : [],
+  dependencies : [BSD ? lib_util : [], lib_systemd],
   install_dir : sbindir,
   install : opt,
   build_by_default : opt)
@@ -2362,7 +2434,9 @@ exe = executable(
   wall_sources,
   include_directories : includes,
   link_with : [lib_common],
+  dependencies : [lib_systemd],
   install_dir : usrbin_exec_dir,
+  install_mode : 'rwxr-sr-x',
   install : opt,
   build_by_default : opt)
 if opt
@@ -2380,12 +2454,15 @@ exe = executable(
   write_sources,
   include_directories : includes,
   link_with : [lib_common],
+  dependencies : [lib_systemd],
   install_dir : usrbin_exec_dir,
+  install_mode : 'rwxr-sr-x',
   install : opt,
   build_by_default : opt)
 if opt
   exes += exe
   manadocs += ['term-utils/write.1.adoc']
+  bashcompletions += ['write']
 endif
 
 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
@@ -2458,7 +2535,8 @@ exe = executable(
   include_directories : includes,
   c_args : '-DTEST_LOGGER',
   link_with : [lib_common],
-  dependencies : [lib_systemd])
+  dependencies : [lib_systemd],
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -2554,7 +2632,8 @@ exe = executable(
   'uuidgen',
   uuidgen_sources,
   include_directories : includes,
-  link_with : [lib_uuid],
+  link_with : [lib_common,
+               lib_uuid],
   install_dir : usrbin_exec_dir,
   install : true)
 if not is_disabler(exe)
@@ -2597,7 +2676,7 @@ exe2 = executable(
   link_with : [lib_common,
                lib_uuid],
   dependencies : thread_libs,
-  build_by_default : opt)
+  build_by_default : opt and program_tests)
 if not is_disabler(exe)
   exes += [exe, exe2]
   manadocs += ['misc-utils/uuidd.8.adoc']
@@ -2674,7 +2753,8 @@ exe = executable(
   'test_blkid_fuzz_sample',
   'libblkid/src/fuzz.c',
   include_directories: includes,
-  link_with: lib_blkid)
+  link_with: lib_blkid,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -2809,7 +2889,8 @@ exe = executable(
   c_args : '-DTEST_CAL',
   link_with : [lib_common,
                lib_tcolors],
-  dependencies : [curses_libs])
+  dependencies : [curses_libs],
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -2827,17 +2908,53 @@ if not is_disabler(exe)
   bashcompletions += ['fadvise']
 endif
 
+if LINUX and conf.get('HAVE_PIDFD_OPEN') != false
+  exe = executable(
+    'waitpid',
+    waitpid_sources,
+    include_directories : includes,
+    link_with : [lib_common],
+    install_dir : usrbin_exec_dir,
+    install : true)
+  if not is_disabler(exe)
+    exes += exe
+    manadocs += ['misc-utils/waitpid.1.adoc']
+    bashcompletions += ['waitpid']
+  endif
+endif
+
+syscalls_h = custom_target('syscalls.h',
+  input : 'tools/all_syscalls',
+  output : 'syscalls.h',
+  command : ['tools/all_syscalls', cc.cmd_array()] 
+)
+
+if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
+  exe = executable(
+    'enosys',
+    'misc-utils/enosys.c', syscalls_h,
+    include_directories : includes,
+    link_with : [lib_common],
+    install_dir : usrbin_exec_dir,
+    install : true)
+  if not is_disabler(exe)
+    exes += exe
+    manadocs += ['misc-utils/enosys.1.adoc']
+    bashcompletions += ['enosys']
+  endif
+endif
+
 exe = executable(
-  'waitpid',
-  waitpid_sources,
+  'lsclocks',
+  lsclocks_sources,
   include_directories : includes,
-  link_with : [lib_common],
+  link_with : [lib_common, lib_smartcols],
   install_dir : usrbin_exec_dir,
   install : true)
 if not is_disabler(exe)
   exes += exe
-  manadocs += ['misc-utils/waitpid.1.adoc']
-  bashcompletions += ['waitpid']
+  manadocs += ['misc-utils/lsclocks.1.adoc']
+  bashcompletions += ['lsclocks']
 endif
 
 ############################################################
@@ -2897,7 +3014,8 @@ exe = executable(
   'lib/ttyutils.c',
   c_args : ['-DTEST_PROGRAM_TTYUTILS'],
   include_directories : dir_include,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -2905,7 +3023,8 @@ exe = executable(
   'lib/blkdev.c',
   c_args : ['-DTEST_PROGRAM_BLKDEV'],
   include_directories : dir_include,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -2913,21 +3032,24 @@ exe = executable(
   'lib/ismounted.c',
   c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
   include_directories : dir_include,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_mangle',
   'lib/mangle.c',
   c_args : ['-DTEST_PROGRAM_MANGLE'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_strutils',
   'lib/strutils.c',
   c_args : ['-DTEST_PROGRAM_STRUTILS'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -2936,56 +3058,64 @@ exe = executable(
   'lib/color-names.c',
   c_args : ['-DTEST_PROGRAM_COLORS'],
   include_directories : dir_include,
-  link_with : [lib_common, lib_tcolors])
+  link_with : [lib_common, lib_tcolors],
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_randutils',
   'lib/randutils.c',
   c_args : ['-DTEST_PROGRAM_RANDUTILS'],
-  include_directories : dir_include)
-exes += exe
-
-# XXX: HAVE_OPENAT && HAVE_DIRFD
-exe = executable(
-  'test_procfs',
-  'lib/procfs.c',
-  c_args : ['-DTEST_PROGRAM_PROCFS'],
   include_directories : dir_include,
-  link_with : lib_common)
+  build_by_default: program_tests)
 exes += exe
 
-# XXX: HAVE_OPENAT && HAVE_DIRFD
-exe = executable(
-  'test_path',
-  'lib/path.c',
-  'lib/fileutils.c',
-  have_cpu_set_t ? 'lib/cpuset.c' : [],
-  c_args : ['-DTEST_PROGRAM_PATH'],
-  include_directories : dir_include,
-  link_with : lib_common)
-exes += exe
+if conf.get('HAVE_OPENAT') != false and conf.get('HAVE_DIRFD') != false
+  exe = executable(
+    'test_procfs',
+    'lib/procfs.c',
+    c_args : ['-DTEST_PROGRAM_PROCFS'],
+    include_directories : dir_include,
+    link_with : lib_common,
+    build_by_default: program_tests)
+  exes += exe
 
-# XXX: HAVE_PTY
-exe = executable(
-  'test_pty',
-  pty_session_c,
-  monotonic_c,
-  c_args : ['-DTEST_PROGRAM_PTY'],
-  include_directories : dir_include,
-  link_with : [lib_common],
-  dependencies : [lib_m,
-                  realtime_libs,
-                  lib_util])
-exes += exe
+  exe = executable(
+    'test_path',
+    'lib/path.c',
+    'lib/fileutils.c',
+    have_cpu_set_t ? 'lib/cpuset.c' : [],
+    c_args : ['-DTEST_PROGRAM_PATH'],
+    include_directories : dir_include,
+    link_with : lib_common,
+    build_by_default: program_tests)
+  exes += exe
+endif
 
-# XXX: LINUX
-exe = executable(
-  'test_cpuset',
-  'lib/cpuset.c',
-  c_args : ['-DTEST_PROGRAM_CPUSET'],
-  include_directories : dir_include)
-exes += exe
+if conf.get('HAVE_PTY') != false
+  exe = executable(
+    'test_pty',
+    pty_session_c,
+    monotonic_c,
+    c_args : ['-DTEST_PROGRAM_PTY'],
+    include_directories : dir_include,
+    link_with : [lib_common],
+    dependencies : [lib_m,
+                    realtime_libs,
+                    lib_util],
+    build_by_default: program_tests)
+  exes += exe
+endif
+
+if LINUX
+  exe = executable(
+    'test_cpuset',
+    'lib/cpuset.c',
+    c_args : ['-DTEST_PROGRAM_CPUSET'],
+    include_directories : dir_include,
+    build_by_default: program_tests)
+  exes += exe
+endif
 
 exe = executable(
   'test_sysfs',
@@ -2996,35 +3126,40 @@ exe = executable(
   'lib/fileutils.c',
   have_cpu_set_t ? 'lib/cpuset.c' : [],
   c_args : ['-DTEST_PROGRAM_SYSFS'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_pager',
   'lib/pager.c',
   c_args : ['-DTEST_PROGRAM_PAGER'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_linux_version',
   'lib/linux_version.c',
   c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_fileutils',
   'lib/fileutils.c',
   c_args : ['-DTEST_PROGRAM_FILEUTILS'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_canonicalize',
   'lib/canonicalize.c',
   c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -3032,7 +3167,8 @@ exe = executable(
   'lib/timeutils.c',
   'lib/strutils.c',
   c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
-  include_directories : dir_include)
+  include_directories : dir_include,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -3040,7 +3176,8 @@ exe = executable(
   'lib/pwdutils.c',
   c_args : ['-DTEST_PROGRAM'],
   include_directories : dir_include,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -3048,7 +3185,8 @@ exe = executable(
   'lib/logindefs.c',
   c_args : ['-DTEST_PROGRAM'],
   include_directories : dir_include,
-  link_with : [lib_common, logindefs_c])
+  link_with : [lib_common, logindefs_c],
+  build_by_default: program_tests)
 exes += exe
 
 
@@ -3059,7 +3197,8 @@ exe = executable(
   'libuuid/src/test_uuid.c',
   include_directories : [dir_include, dir_libuuid],
   link_with : lib_uuid,
-  dependencies : socket_libs)
+  dependencies : socket_libs,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3075,7 +3214,8 @@ exe = executable(
   'libfdisk/src/ask.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3085,7 +3225,8 @@ exe = executable(
   'libfdisk/src/gpt.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3095,7 +3236,8 @@ exe = executable(
   'libfdisk/src/utils.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3105,7 +3247,8 @@ exe = executable(
   'libfdisk/src/script.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3115,7 +3258,8 @@ exe = executable(
   'libfdisk/src/version.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3125,7 +3269,8 @@ exe = executable(
   'libfdisk/src/item.c',
   c_args : libfdisk_tests_cflags,
   include_directories : lib_fdisk_includes,
-  link_with : libfdisk_tests_ldadd)
+  link_with : libfdisk_tests_ldadd,
+  build_by_default: program_tests)
 if not is_disabler(exe)
   exes += exe
 endif
@@ -3159,58 +3304,67 @@ exe = executable(
   'test_mbsencode',
   'tests/helpers/test_mbsencode.c',
   include_directories : includes,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_byteswap',
   'tests/helpers/test_byteswap.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_md5',
   'tests/helpers/test_md5.c',
   md5_c,
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_sha1',
   'tests/helpers/test_sha1.c',
   sha1_c,
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_pathnames',
   'tests/helpers/test_pathnames.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_strerror',
   'tests/helpers/test_strerror.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_sysinfo',
   'tests/helpers/test_sysinfo.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_sigreceive',
   'tests/helpers/test_sigreceive.c',
   include_directories : includes,
-  link_with : lib_common)
+  link_with : lib_common,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
   'test_tiocsti',
   'tests/helpers/test_tiocsti.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 exe = executable(
@@ -3219,32 +3373,42 @@ exe = executable(
   predefined_c,
   unpack_c,
   unparse_c,
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
-# XXX: LINUX
-exe = executable(
-  'test_mkfds',
-  'tests/helpers/test_mkfds.c',
-  include_directories : includes)
-exes += exe
+mq_libs = []
+mq_libs += cc.find_library('rt', required : true)
+
+if LINUX
+  exe = executable(
+    'test_mkfds',
+    'tests/helpers/test_mkfds.c',
+    include_directories : includes,
+    dependencies : mq_libs,
+    build_by_default: program_tests)
+  exes += exe
+endif
 
 exe = executable(
   'test_enosys',
   'tests/helpers/test_enosys.c',
-  include_directories : includes)
+  include_directories : includes,
+  build_by_default: program_tests)
 exes += exe
 
 ############################################################
 
-# XXX: HAVE_OPENAT
-exe = executable(
-  'sample-scols-tree',
-  'libsmartcols/samples/tree.c',
-  include_directories : includes,
-  link_with : [lib_smartcols, lib_common])
-if not is_disabler(exe)
-  exes += exe
+if conf.get('HAVE_OPENAT') != false
+  exe = executable(
+    'sample-scols-tree',
+    'libsmartcols/samples/tree.c',
+    include_directories : includes,
+    link_with : [lib_smartcols, lib_common],
+    build_by_default: program_tests)
+  if not is_disabler(exe)
+    exes += exe
+  endif
 endif
 
 exe = executable(
@@ -3321,7 +3485,7 @@ configure_file(output : 'meson.conf',
                           '''asan=@0@
 PYTHON=@1@
 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
-           python.path())])
+           python.full_path())])
 
 run_sh = find_program('tests/run.sh')
 run_target(