[PATCH 5/5] lib: Prefer WITH_* prefix for #if conditionals

Michal Privoznik mprivozn at redhat.com
Tue Sep 1 14:00:14 UTC 2020


Currently, we are mixing: #if HAVE_BLAH with #if WITH_BLAH.
Things got way better with Pavel's work on meson, but apparently,
mixing these two lead to confusing and easy to miss bugs (see
31fb929eca for instance). While we were forced to use HAVE_
prefix with autotools, we are free to chose our own prefix with
meson and since WITH_ prefix appears to be more popular let's use
it everywhere.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 build-aux/syntax-check.mk           | 10 +--
 docs/coding-style.rst               |  2 +-
 meson.build                         | 60 +++++++++---------
 src/admin/libvirt-admin.c           |  4 +-
 src/conf/nwfilter_conf.c            |  2 +-
 src/cpu/cpu_arm.c                   |  8 +--
 src/internal.h                      |  8 +--
 src/libvirt.c                       |  4 +-
 src/libxl/libxl_capabilities.c      |  2 +-
 src/libxl/libxl_conf.c              |  4 +-
 src/libxl/xen_xl.c                  |  2 +-
 src/locking/lock_driver_sanlock.c   |  2 +-
 src/locking/lock_manager.c          | 14 ++---
 src/network/bridge_driver.c         |  4 +-
 src/nwfilter/nwfilter_dhcpsnoop.c   |  8 +--
 src/nwfilter/nwfilter_learnipaddr.c | 10 +--
 src/qemu/qemu_namespace.c           |  4 +-
 src/qemu/qemu_process.c             |  6 +-
 src/rpc/virnetsocket.c              |  8 +--
 src/storage/storage_backend_rbd.c   |  6 +-
 src/storage/storage_driver.c        |  2 +-
 src/storage/storage_util.c          |  6 +-
 src/util/iohelper.c                 |  2 +-
 src/util/virbpf.c                   |  6 +-
 src/util/virbpf.h                   |  6 +-
 src/util/vircgroupv2devices.c       | 10 +--
 src/util/virdbus.c                  |  2 +-
 src/util/virdbuspriv.h              |  2 +-
 src/util/virfile.c                  | 86 +++++++++++++-------------
 src/util/virgettext.c               |  6 +-
 src/util/virhostcpu.c               | 14 ++---
 src/util/virhostmem.c               |  4 +-
 src/util/virhostuptime.c            | 12 ++--
 src/util/virlog.c                   | 24 ++++----
 src/util/virmodule.c                |  6 +-
 src/util/virnetdev.c                | 94 ++++++++++++++---------------
 src/util/virnetdev.h                |  4 +-
 src/util/virnetdevbridge.c          | 46 +++++++-------
 src/util/virnetdevip.c              | 16 ++---
 src/util/virnetdevmacvlan.c         |  2 +-
 src/util/virnetdevtap.c             |  6 +-
 src/util/virnetlink.c               |  2 +-
 src/util/virnetlink.h               |  2 +-
 src/util/virnuma.c                  | 12 ++--
 src/util/virperf.c                  |  4 +-
 src/util/virprocess.c               | 60 +++++++++---------
 src/util/virstring.c                |  8 +--
 src/util/virthread.c                |  4 +-
 src/util/virutil.c                  | 24 ++++----
 src/util/virutil.h                  |  8 +--
 src/util/virvsock.c                 |  6 +-
 tests/eventtest.c                   |  2 +-
 tests/libxlxml2domconfigtest.c      |  2 +-
 tests/meson.build                   |  2 +-
 tests/securityselinuxhelper.c       |  2 +-
 tests/virfilemock.c                 |  2 +-
 tests/virfiletest.c                 | 14 ++---
 tests/virmock.h                     |  2 +-
 tests/virmockstathelpers.c          | 16 ++---
 tests/virnetsockettest.c            |  8 +--
 tests/virnettlscontexttest.c        |  2 +-
 tests/virnettlshelpers.c            |  2 +-
 tests/virnettlshelpers.h            |  2 +-
 tests/virnettlssessiontest.c        |  2 +-
 tests/virportallocatormock.c        |  2 +-
 tests/virportallocatortest.c        |  2 +-
 tests/virstoragetest.c              |  4 +-
 tests/vshtabletest.c                |  2 +-
 tools/nss/libvirt_nss.c             |  4 +-
 tools/nss/libvirt_nss.h             |  4 +-
 tools/virt-host-validate.c          |  4 +-
 71 files changed, 367 insertions(+), 367 deletions(-)

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 16c70750e8..af3af54de4 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -1397,8 +1397,8 @@ sc_require_config_h_first:
 	else :;								\
 	fi
 
-sc_prohibit_HAVE_MBRTOWC:
-	@prohibit='\bHAVE_MBRTOWC\b'					\
+sc_prohibit_WITH_MBRTOWC:
+	@prohibit='\bWITH_MBRTOWC\b'					\
 	halt="do not use $$prohibit; it is always defined"		\
 	  $(_sc_search_regexp)
 
@@ -1617,8 +1617,8 @@ sc_unmarked_diagnostics:
 
 
 sc_prohibit_defined_have_decl_tests:
-	@prohibit='(#[	 ]*ifn?def|\<defined)\>[	 (]+HAVE_DECL_'	\
-	halt='HAVE_DECL macros are always defined'			\
+	@prohibit='(#[	 ]*ifn?def|\<defined)\>[	 (]+WITH_DECL_'	\
+	halt='WITH_DECL macros are always defined'			\
 	  $(_sc_search_regexp)
 
 # ==================================================================
@@ -1801,7 +1801,7 @@ sc_po_check:
 	  rm -f $@-1 $@-2;						\
 	fi
 
-# #if HAVE_... will evaluate to false for any non numeric string.
+# #if WITH_... will evaluate to false for any non numeric string.
 # That would be flagged by using -Wundef, however gnulib currently
 # tests many undefined macros, and so we can't enable that option.
 # So at least preclude common boolean strings as macro values.
diff --git a/docs/coding-style.rst b/docs/coding-style.rst
index 9212a42a77..deaa72041e 100644
--- a/docs/coding-style.rst
+++ b/docs/coding-style.rst
@@ -474,7 +474,7 @@ indentation to track nesting:
 
 ::
 
-  #if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
+  #if defined(WITH_POSIX_FALLOCATE) && !defined(WITH_FALLOCATE)
   # define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
   #endif
 
diff --git a/meson.build b/meson.build
index cdf33436f3..c0d15da736 100644
--- a/meson.build
+++ b/meson.build
@@ -583,7 +583,7 @@ supported_cc_flags = cc.get_supported_arguments(cc_flags)
 add_project_arguments(supported_cc_flags, language: 'c')
 
 if cc.has_argument('-Wsuggest-attribute=format')
-  conf.set('HAVE_SUGGEST_ATTRIBUTE_FORMAT', 1)
+  conf.set('WITH_SUGGEST_ATTRIBUTE_FORMAT', 1)
 endif
 
 # used in tests
@@ -676,7 +676,7 @@ functions = [
 
 foreach function : functions
   if cc.has_function(function)
-    conf.set('HAVE_ at 0@'.format(function.to_upper()), 1)
+    conf.set('WITH_ at 0@'.format(function.to_upper()), 1)
   endif
 endforeach
 
@@ -715,7 +715,7 @@ endif
 
 foreach name : headers
   if cc.has_header(name)
-    conf.set('HAVE_ at 0@'.format(name.underscorify().to_upper()), 1)
+    conf.set('WITH_ at 0@'.format(name.underscorify().to_upper()), 1)
   endif
 endforeach
 
@@ -799,7 +799,7 @@ endif
 
 foreach symbol : symbols
   if cc.has_header_symbol(symbol[0], symbol[1], args: '-D_GNU_SOURCE', prefix: symbol.get(2, ''))
-    conf.set('HAVE_DECL_ at 0@'.format(symbol[1].to_upper()), 1)
+    conf.set('WITH_DECL_ at 0@'.format(symbol[1].to_upper()), 1)
   endif
 endforeach
 
@@ -810,19 +810,19 @@ brd_required_headers = '''#include <stdint.h>
 if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD', prefix: brd_required_headers) and
     cc.has_header_symbol('net/if_bridgevar.h', 'BRDGADD', prefix: brd_required_headers) and
     cc.has_header_symbol('net/if_bridgevar.h', 'BRDGDEL', prefix: brd_required_headers))
-  conf.set('HAVE_BSD_BRIDGE_MGMT', 1)
+  conf.set('WITH_BSD_BRIDGE_MGMT', 1)
 endif
 
 # Check for BSD CPU affinity availability
 if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity')
-  conf.set('HAVE_BSD_CPU_AFFINITY', 1)
+  conf.set('WITH_BSD_CPU_AFFINITY', 1)
 endif
 
 # whether Mach clock routines are available
 if (cc.has_header_symbol('mach/clock.h', 'clock_serv_t') and
     cc.has_header_symbol('mach/clock.h', 'host_get_clock_service') and
     cc.has_header_symbol('mach/clock.h', 'clock_get_time'))
-  conf.set('HAVE_MACH_CLOCK_ROUTINES', 1)
+  conf.set('WITH_MACH_CLOCK_ROUTINES', 1)
 endif
 
 
@@ -836,7 +836,7 @@ types = [
 foreach type : types
   if cc.has_type(type[0], prefix: type[1])
     name = type[0].underscorify().to_upper()
-    conf.set('HAVE_ at 0@'.format(name), 1)
+    conf.set('WITH_ at 0@'.format(name), 1)
   endif
 endforeach
 
@@ -867,7 +867,7 @@ foreach member : members
   if cc.has_member(member[0], member[1], prefix: member[2])
     type = member[0].underscorify().to_upper()
     member = member[1].underscorify().to_upper()
-    conf.set('HAVE_ at 0@_ at 1@'.format(type, member), 1)
+    conf.set('WITH_ at 0@_ at 1@'.format(type, member), 1)
   endif
 endforeach
 
@@ -966,7 +966,7 @@ endforeach
 
 if host_machine.system() == 'linux' and cc.has_header('sys/acl.h')
   acl_dep = cc.find_library('acl', required: false)
-  conf.set('HAVE_SYS_ACL_H', 1)
+  conf.set('WITH_SYS_ACL_H', 1)
 else
   acl_dep = dependency('', required: false)
 endif
@@ -983,7 +983,7 @@ endif
 
 attr_dep = cc.find_library('attr', required: get_option('attr'))
 if attr_dep.found()
-  conf.set('HAVE_LIBATTR', 1)
+  conf.set('WITH_LIBATTR', 1)
 endif
 
 audit_dep = cc.find_library('audit', required: get_option('audit'))
@@ -1028,12 +1028,12 @@ if dbus_dep.found()
 
   function = 'dbus_watch_get_unix_fd'
   if cc.has_function(function, dependencies: dbus_dep)
-    conf.set('HAVE_ at 0@'.format(function.to_upper()), 1)
+    conf.set('WITH_ at 0@'.format(function.to_upper()), 1)
   endif
 
   type = 'DBusBasicValue'
   if cc.has_type(type, dependencies: dbus_dep, prefix: '#include <dbus/dbus.h>')
-    conf.set('HAVE_ at 0@'.format(type.to_upper()), 1)
+    conf.set('WITH_ at 0@'.format(type.to_upper()), 1)
   endif
 endif
 
@@ -1056,7 +1056,7 @@ if dlopen_dep.found()
   if not cc.has_header('dlfcn.h')
     error('Unable to find dlfcn.h')
   endif
-  conf.set('HAVE_DLFCN_H', 1)
+  conf.set('WITH_DLFCN_H', 1)
 endif
 
 fuse_version = '2.8.6'
@@ -1103,7 +1103,7 @@ if host_machine.system() == 'linux'
     libnl_dep = declare_dependency(
       dependencies: [ libnl_dep, libnl_route_dep ],
     )
-    conf.set('HAVE_LIBNL', 1)
+    conf.set('WITH_LIBNL', 1)
   endif
 else
   libnl_dep = dependency('', required: false)
@@ -1134,7 +1134,7 @@ if not libpcap_dep.found()
   endif
 endif
 if libpcap_dep.found()
-  conf.set('HAVE_LIBPCAP', 1)
+  conf.set('WITH_LIBPCAP', 1)
 endif
 
 libssh_version = '0.7'
@@ -1188,7 +1188,7 @@ if use_macvtap
   conf.set('WITH_MACVTAP', 1)
 
   if cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_PASSTHRU')
-    conf.set('HAVE_DECL_MACVLAN_MODE_PASSTHRU', 1)
+    conf.set('WITH_DECL_MACVLAN_MODE_PASSTHRU', 1)
   endif
 endif
 
@@ -1213,7 +1213,7 @@ if not get_option('nls').disabled()
   endif
 
   if cc.has_header('libintl.h')
-    conf.set('HAVE_LIBINTL_H', 1)
+    conf.set('WITH_LIBINTL_H', 1)
   elif get_option('nls').enabled()
     error('libintl.h is required to build libvirt')
   endif
@@ -1241,7 +1241,7 @@ if numactl_dep.found()
   conf.set('WITH_NUMACTL', 1)
 
   if cc.has_function('numa_bitmask_isbitset', dependencies: [ numactl_dep ])
-    conf.set('HAVE_NUMA_BITMASK_ISBITSET', 1)
+    conf.set('WITH_NUMA_BITMASK_ISBITSET', 1)
   endif
 endif
 
@@ -1267,7 +1267,7 @@ if rbd_dep.found() and not cc.has_function('rbd_get_features', dependencies: rbd
 endif
 if rbd_dep.found() and rados_dep.found()
   if cc.has_function('rbd_list2', dependencies: rbd_dep)
-    conf.set('HAVE_RBD_LIST2', 1)
+    conf.set('WITH_RBD_LIST2', 1)
   endif
 
   rbd_dep = declare_dependency(dependencies: [ rbd_dep, rados_dep ])
@@ -1347,7 +1347,7 @@ if not get_option('sanlock').disabled()
     conf.set('WITH_SANLOCK', 1)
     # check for sanlock_strerror introduced in sanlock-3.5.0
     if cc.has_function('sanlock_strerror', dependencies: sanlock_dep)
-      conf.set('HAVE_SANLOCK_STRERROR', 1)
+      conf.set('WITH_SANLOCK_STRERROR', 1)
     endif
   endif
 endif
@@ -1548,7 +1548,7 @@ elif get_option('firewalld_zone').enabled()
   error('You must have firewalld support enabled to enable firewalld_zone')
 endif
 
-if conf.has('WITH_MACVTAP') and not conf.has('HAVE_LIBNL')
+if conf.has('WITH_MACVTAP') and not conf.has('WITH_LIBNL')
   error('libnl3-devel is required for macvtap support')
 endif
 
@@ -1651,7 +1651,7 @@ if not get_option('driver_libxl').disabled() and conf.has('WITH_LIBVIRTD')
 
     # If building with libxl, use the libxl utility header and lib too
     if cc.has_header('libxlutil.h')
-      conf.set('HAVE_LIBXLUTIL_H', 1)
+      conf.set('WITH_LIBXLUTIL_H', 1)
     endif
     xl_util_dep = cc.find_library('xlutil')
 
@@ -1677,7 +1677,7 @@ if not get_option('driver_libxl').disabled() and conf.has('WITH_LIBVIRTD')
 
     # Check if Xen has support for PVH
     if cc.has_header_symbol('libxl.h', 'LIBXL_DOMAIN_TYPE_PVH')
-      conf.set('HAVE_XEN_PVH', 1)
+      conf.set('WITH_XEN_PVH', 1)
     endif
 
     conf.set('WITH_LIBXL', 1)
@@ -1698,7 +1698,7 @@ void main(void) {
   '''
   if cc.compiles(lxc_support_code, name: 'lxc support', args: '-D_GNU_SOURCE')
     conf.set('WITH_LXC', 1)
-    conf.set('HAVE_DECL_LO_FLAGS_AUTOCLEAR', 1)
+    conf.set('WITH_DECL_LO_FLAGS_AUTOCLEAR', 1)
   elif get_option('driver_lxc').enabled()
     error('Required kernel features for LXC were not found')
   endif
@@ -1713,7 +1713,7 @@ void main(void) {
 }
   '''
   if cc.compiles(lxc_get_free_code)
-    conf.set('HAVE_DECL_LOOP_CTL_GET_FREE', 1)
+    conf.set('WITH_DECL_LOOP_CTL_GET_FREE', 1)
   endif
 elif get_option('driver_lxc').enabled()
   error('linux and remote_driver are required for LXC')
@@ -2091,7 +2091,7 @@ endif
 
 driver_modules_flags = []
 if conf.has('WITH_LIBVIRTD')
-  if not conf.has('HAVE_DLFCN_H') or not dlopen_dep.found()
+  if not conf.has('WITH_DLFCN_H') or not dlopen_dep.found()
     error('You must have dlfcn.h / dlopen() support to build driver modules')
   endif
   driver_modules_flags = libvirt_export_dynamic
@@ -2168,7 +2168,7 @@ if not get_option('nss').disabled()
     conf.set('WITH_NSS', 1)
 
     if cc.has_type('struct gaih_addrtuple', prefix: '#include <nss.h>')
-      conf.set('HAVE_STRUCT_GAIH_ADDRTUPLE', 1)
+      conf.set('WITH_STRUCT_GAIH_ADDRTUPLE', 1)
     endif
 
     if (cc.has_type('ns_mtab', prefix: '#include <nsswitch.h>') and
@@ -2181,7 +2181,7 @@ endif
 if not get_option('numad').disabled() and numactl_dep.found()
   numad_prog = find_program('numad', required: get_option('numad'), dirs: libvirt_sbin_path)
   if numad_prog.found()
-    conf.set('HAVE_NUMAD', 1)
+    conf.set('WITH_NUMAD', 1)
     conf.set_quoted('NUMAD', numad_prog.path())
   endif
 elif get_option('numad').enabled()
@@ -2472,7 +2472,7 @@ misc_summary = {
   'Use -Werror': cc_flags.contains('-Werror'),
   'Warning Flags': supported_cc_flags,
   'DTrace': conf.has('WITH_DTRACE_PROBES'),
-  'numad': conf.has('HAVE_NUMAD'),
+  'numad': conf.has('WITH_NUMAD'),
   'Init script': init_script,
   'Char device locks': chrdev_lock_files,
   'Loader/NVRAM': loader_res,
diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c
index b7f21275cb..ad70d4f108 100644
--- a/src/admin/libvirt-admin.c
+++ b/src/admin/libvirt-admin.c
@@ -57,10 +57,10 @@ virAdmGlobalInit(void)
 
     virLogSetFromEnv();
 
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
     if (!bindtextdomain(PACKAGE, LOCALEDIR))
         goto error;
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
 
     if (!VIR_CLASS_NEW(remoteAdminPriv, virClassForObjectLockable()))
         goto error;
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 779da3dddb..53794e8f6d 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#if HAVE_NET_ETHERNET_H
+#if WITH_NET_ETHERNET_H
 # include <net/ethernet.h>
 #endif
 #include <unistd.h>
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 374a4d6f6c..939a3b8390 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -22,7 +22,7 @@
 
 #include <config.h>
 #if defined(__aarch64__)
-# if defined(HAVE_ASM_HWCAP_H)
+# if defined(WITH_ASM_HWCAP_H)
 #  include <asm/hwcap.h>
 # endif
 # include <sys/auxv.h>
@@ -520,7 +520,7 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
     int cpu_feature_index = 0;
     size_t i;
 
-# if defined(HAVE_GETAUXVAL)
+# if defined(WITH_GETAUXVAL)
     if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("CPUID registers unavailable"));
@@ -537,9 +537,9 @@ virCPUarmCpuDataFromRegs(virCPUarmData *data)
     /* parse the corresponding vendor_id bits */
     data->vendor_id = (cpuid >> 24) & 0xff;
 
-# if defined(HAVE_GETAUXVAL)
+# if defined(WITH_GETAUXVAL)
     hwcaps = getauxval(AT_HWCAP);
-# elif defined(HAVE_ELF_AUX_INFO)
+# elif defined(WITH_ELF_AUX_INFO)
     elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
 # else
 #  error No routines to retrieve a value from the auxiliary vector
diff --git a/src/internal.h b/src/internal.h
index d95db330b3..7a510e1368 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -49,13 +49,13 @@
 /* The library itself needs to know enum sizes.  */
 #define VIR_ENUM_SENTINELS
 
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
 # define DEFAULT_TEXT_DOMAIN PACKAGE
 # include <libintl.h>
 # define _(str) dgettext(PACKAGE, str)
-#else /* HAVE_LIBINTL_H */
+#else /* WITH_LIBINTL_H */
 # define _(str) str
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
 #define N_(str) str
 
 #include "libvirt/libvirt.h"
@@ -165,7 +165,7 @@
     _Pragma ("GCC diagnostic push") \
     _Pragma ("GCC diagnostic ignored \"-Wpointer-sign\"")
 
-#if HAVE_SUGGEST_ATTRIBUTE_FORMAT
+#if WITH_SUGGEST_ATTRIBUTE_FORMAT
 # define VIR_WARNINGS_NO_PRINTF \
     _Pragma ("GCC diagnostic push") \
     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
diff --git a/src/libvirt.c b/src/libvirt.c
index b2d0ba3d23..39e465dd1c 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -242,10 +242,10 @@ virGlobalInit(void)
 
     g_networking_init();
 
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
     if (!bindtextdomain(PACKAGE, LOCALEDIR))
         goto error;
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
 
     /*
      * Note that the order is important: the first ones have a higher
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index beac8c8cfc..8284ea3d53 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -497,7 +497,7 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
              * HVM guest type. Add a PVH guest type for each new HVM
              * guest type.
              */
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
             if (hvm && i == nr_guest_archs-1) {
                 /* Ensure we have not exhausted the guest_archs array */
                 if (nr_guest_archs >= G_N_ELEMENTS(guest_archs))
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e7c7022b69..585f43b183 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -130,7 +130,7 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
 
     if (def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
         def->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
         c_info->type = def->os.type == VIR_DOMAIN_OSTYPE_HVM ?
             LIBXL_DOMAIN_TYPE_HVM : LIBXL_DOMAIN_TYPE_PVH;
 #else
@@ -300,7 +300,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
     if (hvm) {
         libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_HVM);
     } else if (pvh) {
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
         libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH);
 #else
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 258aca5c73..30a8125f5f 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -46,7 +46,7 @@ VIR_LOG_INIT("xen.xen_xl");
  * corresponding header file wasn't.  Use the header file if detected during
  * configure, otherwise provide extern declarations for any functions used.
  */
-#ifdef HAVE_LIBXLUTIL_H
+#ifdef WITH_LIBXLUTIL_H
 # include <libxlutil.h>
 #else
 typedef struct XLU_Config XLU_Config;
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index d4816030cf..640033eb97 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -100,7 +100,7 @@ virLockManagerSanlockError(int err,
                            char **message)
 {
     if (err <= -200) {
-#if HAVE_SANLOCK_STRERROR
+#if WITH_SANLOCK_STRERROR
         *message = g_strdup(sanlock_strerror(err));
 #else
         *message = g_strdup_printf(_("sanlock error %d"), err);
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index ada950e03e..07034b1799 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -30,7 +30,7 @@
 #include "viruuid.h"
 #include "virstring.h"
 
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 # include <dlfcn.h>
 #endif
 #include <unistd.h>
@@ -116,7 +116,7 @@ static void virLockManagerLogParams(size_t nparams,
  *
  * Returns a plugin object, or NULL if loading failed.
  */
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
                                                 const char *driverName,
                                                 const char *configDir,
@@ -191,7 +191,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
         dlclose(handle);
     return NULL;
 }
-#else /* !HAVE_DLFCN_H */
+#else /* !WITH_DLFCN_H */
 virLockManagerPluginPtr
 virLockManagerPluginNew(const char *name G_GNUC_UNUSED,
                         const char *driverName G_GNUC_UNUSED,
@@ -202,7 +202,7 @@ virLockManagerPluginNew(const char *name G_GNUC_UNUSED,
                    _("this platform is missing dlopen"));
     return NULL;
 }
-#endif /* !HAVE_DLFCN_H */
+#endif /* !WITH_DLFCN_H */
 
 
 /**
@@ -227,7 +227,7 @@ void virLockManagerPluginRef(virLockManagerPluginPtr plugin)
  * result in an unsafe scenario.
  *
  */
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 void virLockManagerPluginUnref(virLockManagerPluginPtr plugin)
 {
     if (!plugin)
@@ -249,11 +249,11 @@ void virLockManagerPluginUnref(virLockManagerPluginPtr plugin)
     VIR_FREE(plugin->name);
     VIR_FREE(plugin);
 }
-#else /* !HAVE_DLFCN_H */
+#else /* !WITH_DLFCN_H */
 void virLockManagerPluginUnref(virLockManagerPluginPtr plugin G_GNUC_UNUSED)
 {
 }
-#endif /* !HAVE_DLFCN_H */
+#endif /* !WITH_DLFCN_H */
 
 
 const char *virLockManagerPluginGetName(virLockManagerPluginPtr plugin)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 54cedd7325..b016d86b9f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -32,7 +32,7 @@
 #include <pwd.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
-#ifdef HAVE_SYSCTLBYNAME
+#ifdef WITH_SYSCTLBYNAME
 # include <sys/sysctl.h>
 #endif
 
@@ -2140,7 +2140,7 @@ networkEnableIPForwarding(bool enableIPv4,
                           bool enableIPv6)
 {
     int ret = 0;
-#ifdef HAVE_SYSCTLBYNAME
+#ifdef WITH_SYSCTLBYNAME
     int enabled = 1;
     if (enableIPv4)
         ret = sysctlbyname("net.inet.ip.forwarding", NULL, 0,
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 649c4441ab..d0992b782c 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -36,7 +36,7 @@
  */
 #include <config.h>
 
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
 # include <pcap.h>
 #endif
 
@@ -65,7 +65,7 @@
 
 VIR_LOG_INIT("nwfilter.nwfilter_dhcpsnoop");
 
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
 
 # define LEASEFILE_DIR RUNSTATEDIR "/libvirt/network/"
 # define LEASEFILE LEASEFILE_DIR "nwfilter.leases"
@@ -2118,7 +2118,7 @@ virNWFilterDHCPSnoopShutdown(void)
     virNWFilterSnoopActiveUnlock();
 }
 
-#else /* HAVE_LIBPCAP */
+#else /* WITH_LIBPCAP */
 
 int
 virNWFilterDHCPSnoopInit(void)
@@ -2150,4 +2150,4 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver G_GNUC_UNUSED,
                      "='dhcp'\" requires it."));
     return -1;
 }
-#endif /* HAVE_LIBPCAP */
+#endif /* WITH_LIBPCAP */
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index c28b12f2f0..faf66ac84a 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
 # include <pcap.h>
 #endif
 
@@ -225,7 +225,7 @@ virNWFilterIPAddrLearnReqFree(virNWFilterIPAddrLearnReqPtr req)
 }
 
 
-#if HAVE_LIBPCAP
+#if WITH_LIBPCAP
 
 static int
 virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReqPtr req)
@@ -306,7 +306,7 @@ freeLearnReqEntry(void *payload)
 }
 
 
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
 
 static virNWFilterIPAddrLearnReqPtr
 virNWFilterDeregisterLearnReq(int ifindex)
@@ -325,7 +325,7 @@ virNWFilterDeregisterLearnReq(int ifindex)
 
 #endif
 
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
 
 static void
 procDHCPOpts(struct dhcp *dhcp, int dhcp_opts_len,
@@ -761,7 +761,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver G_GNUC_UNUSED,
                      "support"));
     return -1;
 }
-#endif /* HAVE_LIBPCAP */
+#endif /* WITH_LIBPCAP */
 
 
 /**
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index b6724a095f..454d6a7b4d 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -24,7 +24,7 @@
 #ifdef __linux__
 # include <sys/sysmacros.h>
 #endif
-#if defined(HAVE_SYS_MOUNT_H)
+#if defined(WITH_SYS_MOUNT_H)
 # include <sys/mount.h>
 #endif
 #ifdef WITH_SELINUX
@@ -850,7 +850,7 @@ qemuDomainNamespaceAvailable(qemuDomainNamespace ns G_GNUC_UNUSED)
 
     switch (ns) {
     case QEMU_DOMAIN_NS_MOUNT:
-# if !defined(HAVE_SYS_ACL_H) || !defined(WITH_SELINUX)
+# if !defined(WITH_SYS_ACL_H) || !defined(WITH_SELINUX)
         /* We can't create the exact copy of paths if either of
          * these is not available. */
         return false;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ad461d8f34..44f978e771 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2524,7 +2524,7 @@ qemuProcessGetAllCpuAffinity(virBitmapPtr *cpumapRet)
 /*
  * To be run between fork/exec of QEMU only
  */
-#if defined(HAVE_SCHED_GETAFFINITY) || defined(HAVE_BSD_CPU_AFFINITY)
+#if defined(WITH_SCHED_GETAFFINITY) || defined(WITH_BSD_CPU_AFFINITY)
 static int
 qemuProcessInitCpuAffinity(virDomainObjPtr vm)
 {
@@ -2577,13 +2577,13 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
 
     return 0;
 }
-#else /* !defined(HAVE_SCHED_GETAFFINITY) && !defined(HAVE_BSD_CPU_AFFINITY) */
+#else /* !defined(WITH_SCHED_GETAFFINITY) && !defined(WITH_BSD_CPU_AFFINITY) */
 static int
 qemuProcessInitCpuAffinity(virDomainObjPtr vm G_GNUC_UNUSED)
 {
     return 0;
 }
-#endif /* !defined(HAVE_SCHED_GETAFFINITY) && !defined(HAVE_BSD_CPU_AFFINITY) */
+#endif /* !defined(WITH_SCHED_GETAFFINITY) && !defined(WITH_BSD_CPU_AFFINITY) */
 
 /* set link states to down on interfaces at qemu start */
 static int
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index f3aba01fd5..90e0f7c475 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -25,11 +25,11 @@
 #include <unistd.h>
 #include <signal.h>
 #include <fcntl.h>
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
 # include <ifaddrs.h>
 #endif
 
-#ifdef HAVE_SYS_UCRED_H
+#ifdef WITH_SYS_UCRED_H
 # include <sys/ucred.h>
 #endif
 
@@ -182,7 +182,7 @@ virNetSocketCheckProtocolByLookup(const char *address,
 int virNetSocketCheckProtocols(bool *hasIPv4,
                                bool *hasIPv6)
 {
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
     struct ifaddrs *ifaddr = NULL, *ifa;
 
     *hasIPv4 = *hasIPv6 = false;
@@ -1480,7 +1480,7 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
                                 pid_t *pid,
                                 unsigned long long *timestamp)
 {
-# if defined(HAVE_STRUCT_SOCKPEERCRED)
+# if defined(WITH_STRUCT_SOCKPEERCRED)
     struct sockpeercred cr;
 # else
     struct ucred cr;
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index cb298419e6..09928fdc3c 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -580,7 +580,7 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
 }
 
 
-#ifdef HAVE_RBD_LIST2
+#ifdef WITH_RBD_LIST2
 static char **
 virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
 {
@@ -620,7 +620,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
     return NULL;
 }
 
-#else /* ! HAVE_RBD_LIST2 */
+#else /* ! WITH_RBD_LIST2 */
 
 static char **
 virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
@@ -669,7 +669,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
     virStringListFreeCount(names, nnames);
     return NULL;
 }
-#endif /* ! HAVE_RBD_LIST2 */
+#endif /* ! WITH_RBD_LIST2 */
 
 
 static int
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 7e82c09be5..9e79dbe1e4 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -27,7 +27,7 @@
 #include <sys/param.h>
 #include <fcntl.h>
 
-#if HAVE_PWD_H
+#if WITH_PWD_H
 # include <pwd.h>
 #endif
 
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 629f6fd1ee..843282091f 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -45,10 +45,10 @@
 
 #ifdef FICLONE
 # define REFLINK_IOC_CLONE FICLONE
-#elif HAVE_LINUX_BTRFS_H
+#elif WITH_LINUX_BTRFS_H
 # include <linux/btrfs.h>
 # define REFLINK_IOC_CLONE BTRFS_IOC_CLONE
-#elif HAVE_XFS_XFS_H
+#elif WITH_XFS_XFS_H
 # include <xfs/xfs.h>
 # define REFLINK_IOC_CLONE XFS_IOC_CLONE
 #endif
@@ -337,7 +337,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
     }
 
 /* Avoid issues with older kernel's <linux/fs.h> namespace pollution. */
-#if HAVE_FALLOCATE - 0
+#if WITH_FALLOCATE - 0
     /* Try to preallocate all requested disk space, but fall back to
      * other methods if this fails with ENOSYS or EOPNOTSUPP. If allocation
      * is 0 (or less than 0), then fallocate will fail with EINVAL.
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 342bae229b..c3eb6f8c54 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -56,7 +56,7 @@ runIO(const char *path, int fd, int oflags)
     bool direct = O_DIRECT && ((oflags & O_DIRECT) != 0);
     off_t end = 0;
 
-#if HAVE_POSIX_MEMALIGN
+#if WITH_POSIX_MEMALIGN
     if (posix_memalign(&base, alignMask + 1, buflen)) {
         virReportOOMError();
         goto cleanup;
diff --git a/src/util/virbpf.c b/src/util/virbpf.c
index 987fc34ef4..df4f333614 100644
--- a/src/util/virbpf.c
+++ b/src/util/virbpf.c
@@ -25,7 +25,7 @@ VIR_LOG_INIT("util.bpf");
 
 #define VIR_FROM_THIS VIR_FROM_BPF
 
-#if HAVE_SYS_SYSCALL_H && HAVE_DECL_BPF_PROG_QUERY
+#if WITH_SYS_SYSCALL_H && WITH_DECL_BPF_PROG_QUERY
 # include <sys/syscall.h>
 # include <unistd.h>
 
@@ -293,7 +293,7 @@ virBPFDeleteElem(int mapfd,
 }
 
 
-#else /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
+#else /* !WITH_SYS_SYSCALL_H || !WITH_DECL_BPF_PROG_QUERY */
 
 
 int
@@ -421,4 +421,4 @@ virBPFDeleteElem(int mapfd G_GNUC_UNUSED,
     errno = ENOSYS;
     return -1;
 }
-#endif /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
+#endif /* !WITH_SYS_SYSCALL_H || !WITH_DECL_BPF_PROG_QUERY */
diff --git a/src/util/virbpf.h b/src/util/virbpf.h
index 1f38a683b9..1eafce86c0 100644
--- a/src/util/virbpf.h
+++ b/src/util/virbpf.h
@@ -18,7 +18,7 @@
 
 #pragma once
 
-#if HAVE_DECL_BPF_PROG_QUERY
+#if WITH_DECL_BPF_PROG_QUERY
 
 # include <linux/bpf.h>
 
@@ -171,7 +171,7 @@
      .imm = 0, \
      })
 
-#else /* HAVE_DECL_BPF_PROG_QUERY */
+#else /* WITH_DECL_BPF_PROG_QUERY */
 
 struct bpf_prog_info;
 struct bpf_map_info;
@@ -191,7 +191,7 @@ struct bpf_insn;
 # define VIR_BPF_CALL_INSN(func)
 # define VIR_BPF_EXIT_INSN()
 
-#endif /* HAVE_DECL_BPF_PROG_QUERY */
+#endif /* WITH_DECL_BPF_PROG_QUERY */
 
 int
 virBPFCreateMap(unsigned int mapType,
diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
index 234e0f2278..f31244f3c1 100644
--- a/src/util/vircgroupv2devices.c
+++ b/src/util/vircgroupv2devices.c
@@ -17,13 +17,13 @@
  */
 #include <config.h>
 
-#if HAVE_DECL_BPF_CGROUP_DEVICE
+#if WITH_DECL_BPF_CGROUP_DEVICE
 # include <fcntl.h>
 # include <linux/bpf.h>
 # include <sys/stat.h>
 # include <sys/syscall.h>
 # include <sys/types.h>
-#endif /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#endif /* !WITH_DECL_BPF_CGROUP_DEVICE */
 
 #include "internal.h"
 
@@ -41,7 +41,7 @@ VIR_LOG_INIT("util.cgroup");
 
 #define VIR_FROM_THIS VIR_FROM_CGROUP
 
-#if HAVE_DECL_BPF_CGROUP_DEVICE
+#if WITH_DECL_BPF_CGROUP_DEVICE
 bool
 virCgroupV2DevicesAvailable(virCgroupPtr group)
 {
@@ -581,7 +581,7 @@ virCgroupV2DevicesGetPerms(int perms,
 
     return ret;
 }
-#else /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#else /* !WITH_DECL_BPF_CGROUP_DEVICE */
 bool
 virCgroupV2DevicesAvailable(virCgroupPtr group G_GNUC_UNUSED)
 {
@@ -632,7 +632,7 @@ virCgroupV2DevicesGetPerms(int perms G_GNUC_UNUSED,
 {
     return 0;
 }
-#endif /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#endif /* !WITH_DECL_BPF_CGROUP_DEVICE */
 
 
 uint64_t
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index fbfc09c949..459b57abc6 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -242,7 +242,7 @@ static dbus_bool_t virDBusAddWatch(DBusWatch *watch,
     if (dbus_watch_get_enabled(watch))
         flags = virDBusTranslateWatchFlags(dbus_watch_get_flags(watch));
 
-# if HAVE_DBUS_WATCH_GET_UNIX_FD
+# if WITH_DBUS_WATCH_GET_UNIX_FD
     fd = dbus_watch_get_unix_fd(watch);
 # else
     fd = dbus_watch_get_fd(watch);
diff --git a/src/util/virdbuspriv.h b/src/util/virdbuspriv.h
index f96f393ff5..5b4fe217f9 100644
--- a/src/util/virdbuspriv.h
+++ b/src/util/virdbuspriv.h
@@ -27,7 +27,7 @@
 
 #include "virdbus.h"
 
-#if defined(WITH_DBUS) && !HAVE_DBUSBASICVALUE
+#if defined(WITH_DBUS) && !WITH_DBUSBASICVALUE
 /* Copied (and simplified) from dbus 1.6.12, for use with older dbus headers */
 typedef union
 {
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 716bf62593..90156845df 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -29,44 +29,44 @@
 #ifndef WIN32
 # include <termios.h>
 #endif
-#ifdef HAVE_PTY_H
+#ifdef WITH_PTY_H
 /* Linux openpty */
 # include <pty.h>
 #endif
-#ifdef HAVE_UTIL_H
+#ifdef WITH_UTIL_H
 /* macOS openpty */
 # include <util.h>
 #endif
-#ifdef HAVE_LIBUTIL_H
+#ifdef WITH_LIBUTIL_H
 /* FreeBSD openpty */
 # include <libutil.h>
 #endif
 #include <sys/stat.h>
-#if defined(HAVE_SYS_MOUNT_H)
+#if defined(WITH_SYS_MOUNT_H)
 # include <sys/mount.h>
 #endif
 #include <unistd.h>
 #include <dirent.h>
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
 # include <mntent.h>
 #endif
-#if HAVE_MMAP
+#if WITH_MMAP
 # include <sys/mman.h>
 #endif
-#if HAVE_SYS_SYSCALL_H
+#if WITH_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
-#if HAVE_SYS_ACL_H
+#if WITH_SYS_ACL_H
 # include <sys/acl.h>
 #endif
 #include <sys/file.h>
 
 #ifdef __linux__
-# if HAVE_LINUX_MAGIC_H
+# if WITH_LINUX_MAGIC_H
 #  include <linux/magic.h>
 # endif
 # include <sys/statfs.h>
-# if HAVE_DECL_LO_FLAGS_AUTOCLEAR
+# if WITH_DECL_LO_FLAGS_AUTOCLEAR
 #  include <linux/loop.h>
 # endif
 # include <sys/ioctl.h>
@@ -74,7 +74,7 @@
 # include <linux/fs.h>
 #endif
 
-#if HAVE_LIBATTR
+#if WITH_LIBATTR
 # include <sys/xattr.h>
 #endif
 
@@ -618,9 +618,9 @@ int virFileUpdatePerm(const char *path,
 }
 
 
-#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
+#if defined(__linux__) && WITH_DECL_LO_FLAGS_AUTOCLEAR
 
-# if HAVE_DECL_LOOP_CTL_GET_FREE
+# if WITH_DECL_LOOP_CTL_GET_FREE
 
 /* virFileLoopDeviceOpenLoopCtl() returns -1 when a real failure has occurred
  * while in the process of allocating or opening the loop device.  On success
@@ -665,7 +665,7 @@ static int virFileLoopDeviceOpenLoopCtl(char **dev_name, int *fd)
     *dev_name = looppath;
     return 0;
 }
-# endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
 
 static int virFileLoopDeviceOpenSearch(char **dev_name)
 {
@@ -735,7 +735,7 @@ static int virFileLoopDeviceOpen(char **dev_name)
 {
     int loop_fd = -1;
 
-# if HAVE_DECL_LOOP_CTL_GET_FREE
+# if WITH_DECL_LOOP_CTL_GET_FREE
     if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0)
         return -1;
 
@@ -743,7 +743,7 @@ static int virFileLoopDeviceOpen(char **dev_name)
 
     if (loop_fd >= 0)
         return loop_fd;
-# endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
 
     /* Without the loop control device we just use the old technique. */
     loop_fd = virFileLoopDeviceOpenSearch(dev_name);
@@ -1082,7 +1082,7 @@ safewrite(int fd, const void *buf, size_t count)
     return nwritten;
 }
 
-#ifdef HAVE_POSIX_FALLOCATE
+#ifdef WITH_POSIX_FALLOCATE
 static int
 safezero_posix_fallocate(int fd, off_t offset, off_t len)
 {
@@ -1092,7 +1092,7 @@ safezero_posix_fallocate(int fd, off_t offset, off_t len)
     errno = ret;
     return -1;
 }
-#else /* !HAVE_POSIX_FALLOCATE */
+#else /* !WITH_POSIX_FALLOCATE */
 static int
 safezero_posix_fallocate(int fd G_GNUC_UNUSED,
                          off_t offset G_GNUC_UNUSED,
@@ -1100,9 +1100,9 @@ safezero_posix_fallocate(int fd G_GNUC_UNUSED,
 {
     return -2;
 }
-#endif /* !HAVE_POSIX_FALLOCATE */
+#endif /* !WITH_POSIX_FALLOCATE */
 
-#if HAVE_SYS_SYSCALL_H && defined(SYS_fallocate)
+#if WITH_SYS_SYSCALL_H && defined(SYS_fallocate)
 static int
 safezero_sys_fallocate(int fd,
                        off_t offset,
@@ -1110,7 +1110,7 @@ safezero_sys_fallocate(int fd,
 {
     return syscall(SYS_fallocate, fd, 0, offset, len);
 }
-#else /* !HAVE_SYS_SYSCALL_H || !defined(SYS_fallocate) */
+#else /* !WITH_SYS_SYSCALL_H || !defined(SYS_fallocate) */
 static int
 safezero_sys_fallocate(int fd G_GNUC_UNUSED,
                        off_t offset G_GNUC_UNUSED,
@@ -1118,9 +1118,9 @@ safezero_sys_fallocate(int fd G_GNUC_UNUSED,
 {
     return -2;
 }
-#endif /* !HAVE_SYS_SYSCALL_H || !defined(SYS_fallocate) */
+#endif /* !WITH_SYS_SYSCALL_H || !defined(SYS_fallocate) */
 
-#ifdef HAVE_MMAP
+#ifdef WITH_MMAP
 static int
 safezero_mmap(int fd, off_t offset, off_t len)
 {
@@ -1154,7 +1154,7 @@ safezero_mmap(int fd, off_t offset, off_t len)
      * example because of virtual memory limits) */
     return -2;
 }
-#else /* !HAVE_MMAP */
+#else /* !WITH_MMAP */
 static int
 safezero_mmap(int fd G_GNUC_UNUSED,
               off_t offset G_GNUC_UNUSED,
@@ -1162,7 +1162,7 @@ safezero_mmap(int fd G_GNUC_UNUSED,
 {
     return -2;
 }
-#endif /* !HAVE_MMAP */
+#endif /* !WITH_MMAP */
 
 static int
 safezero_slow(int fd, off_t offset, off_t len)
@@ -1226,7 +1226,7 @@ int virFileAllocate(int fd, off_t offset, off_t len)
     return safezero_sys_fallocate(fd, offset, len);
 }
 
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
 /* search /proc/mounts for mount point of *type; return pointer to
  * malloc'ed string of the path if found, otherwise return NULL
  * with errno set to an appropriate value.
@@ -1259,7 +1259,7 @@ virFileFindMountPoint(const char *type)
     return ret;
 }
 
-#else /* defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#else /* defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 
 char *
 virFileFindMountPoint(const char *type G_GNUC_UNUSED)
@@ -1269,7 +1269,7 @@ virFileFindMountPoint(const char *type G_GNUC_UNUSED)
     return NULL;
 }
 
-#endif /* defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 
 int
 virBuildPathInternal(char **path, ...)
@@ -1969,7 +1969,7 @@ virFileIsCDROM(const char *path)
 #endif /* defined(__linux__) */
 
 
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
 static int
 virFileGetMountSubtreeImpl(const char *mtabpath,
                            const char *prefix,
@@ -2020,7 +2020,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath,
     endmntent(procmnt);
     return ret;
 }
-#else /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#else /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 static int
 virFileGetMountSubtreeImpl(const char *mtabpath G_GNUC_UNUSED,
                            const char *prefix G_GNUC_UNUSED,
@@ -2032,7 +2032,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath G_GNUC_UNUSED,
                          _("Unable to determine mount table on this platform"));
     return -1;
 }
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 
 /**
  * virFileGetMountSubtree:
@@ -3691,7 +3691,7 @@ int virFileIsSharedFS(const char *path)
 }
 
 
-#if defined(__linux__) && defined(HAVE_SYS_MOUNT_H)
+#if defined(__linux__) && defined(WITH_SYS_MOUNT_H)
 int
 virFileSetupDev(const char *path,
                 const char *mount_options)
@@ -3761,7 +3761,7 @@ virFileMoveMount(const char *src,
 }
 
 
-#else /* !defined(__linux__) || !defined(HAVE_SYS_MOUNT_H) */
+#else /* !defined(__linux__) || !defined(WITH_SYS_MOUNT_H) */
 
 int
 virFileSetupDev(const char *path G_GNUC_UNUSED,
@@ -3791,10 +3791,10 @@ virFileMoveMount(const char *src G_GNUC_UNUSED,
                          _("mount move is not supported on this platform."));
     return -1;
 }
-#endif /* !defined(__linux__) || !defined(HAVE_SYS_MOUNT_H) */
+#endif /* !defined(__linux__) || !defined(WITH_SYS_MOUNT_H) */
 
 
-#if defined(HAVE_SYS_ACL_H)
+#if defined(WITH_SYS_ACL_H)
 int
 virFileGetACLs(const char *file,
                void **acl)
@@ -3824,7 +3824,7 @@ virFileFreeACLs(void **acl)
     *acl = NULL;
 }
 
-#else /* !defined(HAVE_SYS_ACL_H) */
+#else /* !defined(WITH_SYS_ACL_H) */
 
 int
 virFileGetACLs(const char *file G_GNUC_UNUSED,
@@ -3850,7 +3850,7 @@ virFileFreeACLs(void **acl)
     *acl = NULL;
 }
 
-#endif /* !defined(HAVE_SYS_ACL_H) */
+#endif /* !defined(WITH_SYS_ACL_H) */
 
 int
 virFileCopyACLs(const char *src,
@@ -3909,7 +3909,7 @@ virFileComparePaths(const char *p1, const char *p2)
 }
 
 
-#if HAVE_DECL_SEEK_HOLE
+#if WITH_DECL_SEEK_HOLE
 /**
  * virFileInData:
  * @fd: file to check
@@ -4027,7 +4027,7 @@ virFileInData(int fd,
     return ret;
 }
 
-#else /* !HAVE_DECL_SEEK_HOLE */
+#else /* !WITH_DECL_SEEK_HOLE */
 
 int
 virFileInData(int fd G_GNUC_UNUSED,
@@ -4040,7 +4040,7 @@ virFileInData(int fd G_GNUC_UNUSED,
     return -1;
 }
 
-#endif /* !HAVE_DECL_SEEK_HOLE */
+#endif /* !WITH_DECL_SEEK_HOLE */
 
 
 /**
@@ -4309,7 +4309,7 @@ virFileWaitForExists(const char *path,
 }
 
 
-#if HAVE_LIBATTR
+#if WITH_LIBATTR
 /**
  * virFileGetXAttrQuiet;
  * @path: a filename
@@ -4409,7 +4409,7 @@ virFileRemoveXAttr(const char *path,
     return 0;
 }
 
-#else /* !HAVE_LIBATTR */
+#else /* !WITH_LIBATTR */
 
 int
 virFileGetXAttrQuiet(const char *path G_GNUC_UNUSED,
@@ -4443,7 +4443,7 @@ virFileRemoveXAttr(const char *path,
     return -1;
 }
 
-#endif /* HAVE_LIBATTR */
+#endif /* WITH_LIBATTR */
 
 /**
  * virFileGetXAttr;
diff --git a/src/util/virgettext.c b/src/util/virgettext.c
index 8de8edb239..35dfba07fc 100644
--- a/src/util/virgettext.c
+++ b/src/util/virgettext.c
@@ -21,7 +21,7 @@
 #include <config.h>
 
 #include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
 # include <xlocale.h>
 #endif
 
@@ -39,7 +39,7 @@
 int
 virGettextInitialize(void)
 {
-#if HAVE_LIBINTL_H
+#if WITH_LIBINTL_H
     if (!setlocale(LC_ALL, "")) {
         perror("setlocale");
         /* failure to setup locale is not fatal */
@@ -54,6 +54,6 @@ virGettextInitialize(void)
         perror("textdomain");
         return -1;
     }
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
     return 0;
 }
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index ebb91ebb54..f7e92cd924 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -28,7 +28,7 @@
 #endif
 #include <unistd.h>
 
-#if HAVE_LINUX_KVM_H
+#if WITH_LINUX_KVM_H
 # include <linux/kvm.h>
 #endif
 
@@ -1129,7 +1129,7 @@ virHostCPUGetAvailableCPUsBitmap(void)
 }
 
 
-#if HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
+#if WITH_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
 
 /* Get the number of threads per subcore.
  *
@@ -1188,9 +1188,9 @@ virHostCPUGetThreadsPerSubcore(virArch arch G_GNUC_UNUSED)
     return 0;
 }
 
-#endif /* HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
+#endif /* WITH_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
 
-#if HAVE_LINUX_KVM_H
+#if WITH_LINUX_KVM_H
 int
 virHostCPUGetKVMMaxVCPUs(void)
 {
@@ -1229,7 +1229,7 @@ virHostCPUGetKVMMaxVCPUs(void)
                          _("KVM is not supported on this platform"));
     return -1;
 }
-#endif /* HAVE_LINUX_KVM_H */
+#endif /* WITH_LINUX_KVM_H */
 
 
 #ifdef __linux__
@@ -1279,7 +1279,7 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED)
 #endif /* __linux__ */
 
 
-#if HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
+#if WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
     (defined(__i386__) || defined(__x86_64__)) && \
     (defined(__linux__) || defined(__FreeBSD__))
 static int
@@ -1427,7 +1427,7 @@ virHostCPUGetTscInfo(void)
     return NULL;
 }
 
-#endif /* HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
+#endif /* WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
           (defined(__i386__) || defined(__x86_64__)) && \
           (defined(__linux__) || defined(__FreeBSD__)) */
 
diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c
index 27f192dc24..ae42978ed2 100644
--- a/src/util/virhostmem.c
+++ b/src/util/virhostmem.c
@@ -615,7 +615,7 @@ typedef WINBOOL(WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
 static unsigned long long
 virHostMemGetTotal(void)
 {
-#if defined HAVE_SYSCTLBYNAME
+#if defined WITH_SYSCTLBYNAME
     /* This works on freebsd & macOS. */
     unsigned long long physmem = 0;
     size_t len = sizeof(physmem);
@@ -676,7 +676,7 @@ virHostMemGetTotal(void)
 static unsigned long long
 virHostMemGetAvailable(void)
 {
-#if defined HAVE_SYSCTLBYNAME
+#if defined WITH_SYSCTLBYNAME
     /* This works on freebsd and macOS */
     unsigned long long usermem = 0;
     size_t len = sizeof(usermem);
diff --git a/src/util/virhostuptime.c b/src/util/virhostuptime.c
index 661ed588cd..696a38fbb5 100644
--- a/src/util/virhostuptime.c
+++ b/src/util/virhostuptime.c
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#ifdef HAVE_GETUTXID
+#ifdef WITH_GETUTXID
 # include <utmpx.h>
 #endif
 
@@ -82,11 +82,11 @@ virHostGetBootTimeProcfs(unsigned long long *btime)
 }
 #endif /* defined(__linux__) */
 
-#if defined(HAVE_GETUTXID) || defined(__linux__)
+#if defined(WITH_GETUTXID) || defined(__linux__)
 static void
 virHostGetBootTimeOnceInit(void)
 {
-# ifdef HAVE_GETUTXID
+# ifdef WITH_GETUTXID
     struct utmpx id = {.ut_type = BOOT_TIME};
     struct utmpx *res = NULL;
 
@@ -97,7 +97,7 @@ virHostGetBootTimeOnceInit(void)
     }
 
     endutxent();
-# endif /* HAVE_GETUTXID */
+# endif /* WITH_GETUTXID */
 
 # ifdef __linux__
     if (bootTimeErrno != 0 || bootTime == 0)
@@ -105,14 +105,14 @@ virHostGetBootTimeOnceInit(void)
 # endif /* __linux__ */
 }
 
-#else /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
+#else /* !defined(WITH_GETUTXID) && !defined(__linux__) */
 
 static void
 virHostGetBootTimeOnceInit(void)
 {
     bootTimeErrno = ENOSYS;
 }
-#endif /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
+#endif /* !defined(WITH_GETUTXID) && !defined(__linux__) */
 
 /**
  * virHostGetBootTime:
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 3217e5eb73..f6d0c6c050 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -27,7 +27,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
 # include <syslog.h>
 #endif
 
@@ -45,7 +45,7 @@
 
 /* Journald output is only supported on Linux new enough to expose
  * htole64.  */
-#if HAVE_SYSLOG_H && defined(__linux__) && HAVE_DECL_HTOLE64
+#if WITH_SYSLOG_H && defined(__linux__) && WITH_DECL_HTOLE64
 # define USE_JOURNALD 1
 # include <sys/uio.h>
 #endif
@@ -705,7 +705,7 @@ virLogNewOutputToFile(virLogPriority priority,
 }
 
 
-#if HAVE_SYSLOG_H || USE_JOURNALD
+#if WITH_SYSLOG_H || USE_JOURNALD
 
 /* Compat in case we build with journald, but no syslog */
 # ifndef LOG_DEBUG
@@ -737,10 +737,10 @@ virLogPrioritySyslog(virLogPriority priority)
         return LOG_ERR;
     }
 }
-#endif /* HAVE_SYSLOG_H || USE_JOURNALD */
+#endif /* WITH_SYSLOG_H || USE_JOURNALD */
 
 
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
 static void
 virLogOutputToSyslog(virLogSourcePtr source G_GNUC_UNUSED,
                      virLogPriority priority,
@@ -1042,12 +1042,12 @@ int virLogPriorityFromSyslog(int priority)
     return VIR_LOG_ERROR;
 }
 
-#else /* HAVE_SYSLOG_H */
+#else /* WITH_SYSLOG_H */
 int virLogPriorityFromSyslog(int priority G_GNUC_UNUSED)
 {
     return VIR_LOG_ERROR;
 }
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
 
 
 /**
@@ -1383,10 +1383,10 @@ virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
 int
 virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
 {
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
     int id;
     char *tmp = NULL;
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
 
     if (virLogInitialize() < 0)
         return -1;
@@ -1394,7 +1394,7 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
     virLogLock();
     virLogResetOutputs();
 
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
     /* syslog needs to be special-cased, since it keeps the fd in private */
     if ((id = virLogFindOutput(outputs, noutputs, VIR_LOG_TO_SYSLOG,
                                current_ident)) != -1) {
@@ -1407,7 +1407,7 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
         current_ident = tmp;
         openlog(current_ident, 0, 0);
     }
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
 
     virLogOutputs = outputs;
     virLogNbOutputs = noutputs;
@@ -1519,7 +1519,7 @@ virLogParseOutput(const char *src)
         ret = virLogNewOutputToStderr(prio);
         break;
     case VIR_LOG_TO_SYSLOG:
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
         ret = virLogNewOutputToSyslog(prio, tokens[2]);
 #endif
         break;
diff --git a/src/util/virmodule.c b/src/util/virmodule.c
index bc05fc6f4d..36cf77ac46 100644
--- a/src/util/virmodule.c
+++ b/src/util/virmodule.c
@@ -32,7 +32,7 @@
 
 VIR_LOG_INIT("util.module");
 
-#ifdef HAVE_DLFCN_H
+#ifdef WITH_DLFCN_H
 # include <dlfcn.h>
 
 static void *
@@ -141,7 +141,7 @@ virModuleLoad(const char *path,
     return ret;
 }
 
-#else /* ! HAVE_DLFCN_H */
+#else /* ! WITH_DLFCN_H */
 int
 virModuleLoad(const char *path,
               const char *regfunc G_GNUC_UNUSED,
@@ -160,4 +160,4 @@ virModuleLoad(const char *path,
         return 1;
     }
 }
-#endif /* ! HAVE_DLFCN_H */
+#endif /* ! WITH_DLFCN_H */
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b42fa86672..3040f129d1 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -40,23 +40,23 @@
 # include <linux/sockios.h>
 # include <linux/if_vlan.h>
 # define VIR_NETDEV_FAMILY AF_UNIX
-#elif defined(HAVE_STRUCT_IFREQ) && defined(AF_LOCAL)
+#elif defined(WITH_STRUCT_IFREQ) && defined(AF_LOCAL)
 # define VIR_NETDEV_FAMILY AF_LOCAL
 #else
-# undef HAVE_STRUCT_IFREQ
+# undef WITH_STRUCT_IFREQ
 #endif
 
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(WITH_STRUCT_IFREQ)
 # include <linux/types.h>
 # include <linux/ethtool.h>
 #endif
 
-#if HAVE_DECL_LINK_ADDR
+#if WITH_DECL_LINK_ADDR
 # include <sys/sockio.h>
 # include <net/if_dl.h>
 #endif
 
-#if HAVE_LINUX_DEVLINK_H
+#if WITH_LINUX_DEVLINK_H
 # include <linux/devlink.h>
 #endif
 
@@ -73,7 +73,7 @@ VIR_LOG_INIT("util.netdev");
 #define VIR_MCAST_NAME_LEN (IFNAMSIZ + 1)
 #define VIR_MCAST_TOKEN_DELIMS " \n"
 
-#if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFFLAGS) && defined(WITH_STRUCT_IFREQ)
 # define VIR_IFF_UP IFF_UP
 # define VIR_IFF_PROMISC IFF_PROMISC
 # define VIR_IFF_MULTICAST IFF_MULTICAST
@@ -86,7 +86,7 @@ VIR_LOG_INIT("util.netdev");
 #endif
 
 #define RESOURCE_FILE_LEN 4096
-#if HAVE_DECL_ETHTOOL_GFEATURES
+#if WITH_DECL_ETHTOOL_GFEATURES
 # define TX_UDP_TNL 25
 # define GFEATURES_SIZE 2
 # define FEATURE_WORD(blocks, index, field)  ((blocks)[(index) / 32U].field)
@@ -130,7 +130,7 @@ struct _virNetDevMcastList {
     virNetDevMcastEntryPtr *entries;
 };
 
-#if defined(HAVE_STRUCT_IFREQ)
+#if defined(WITH_STRUCT_IFREQ)
 static int virNetDevSetupControlFull(const char *ifname,
                                      struct ifreq *ifr,
                                      int domain,
@@ -172,7 +172,7 @@ virNetDevSetupControl(const char *ifname,
 {
     return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM);
 }
-#else /* !HAVE_STRUCT_IFREQ */
+#else /* !WITH_STRUCT_IFREQ */
 int
 virNetDevSetupControl(const char *ifname G_GNUC_UNUSED,
                       void *ifr G_GNUC_UNUSED)
@@ -182,10 +182,10 @@ virNetDevSetupControl(const char *ifname G_GNUC_UNUSED,
                            "on this platform"));
     return -1;
 }
-#endif /* HAVE_STRUCT_IFREQ */
+#endif /* WITH_STRUCT_IFREQ */
 
 
-#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFFLAGS) && defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevExists:
  * @ifname
@@ -224,7 +224,7 @@ int virNetDevExists(const char *ifname)
 
 
 #if defined(SIOCGIFHWADDR) && defined(SIOCSIFHWADDR) && \
-    defined(HAVE_STRUCT_IFREQ)
+    defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevSetMACInternal:
  * @ifname: interface name to set MTU for
@@ -282,8 +282,8 @@ virNetDevSetMACInternal(const char *ifname,
 }
 
 
-#elif defined(SIOCSIFLLADDR) && defined(HAVE_STRUCT_IFREQ) && \
-    HAVE_DECL_LINK_ADDR
+#elif defined(SIOCSIFLLADDR) && defined(WITH_STRUCT_IFREQ) && \
+    WITH_DECL_LINK_ADDR
 
 
 static int
@@ -350,7 +350,7 @@ virNetDevSetMAC(const char *ifname,
 }
 
 
-#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFHWADDR) && defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevGetMAC:
  * @ifname: interface name to set MTU for
@@ -392,7 +392,7 @@ int virNetDevGetMAC(const char *ifname,
 #endif
 
 
-#if defined(SIOCGIFMTU) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFMTU) && defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevGetMTU:
  * @ifname: interface name get MTU for
@@ -429,7 +429,7 @@ int virNetDevGetMTU(const char *ifname)
 #endif
 
 
-#if defined(SIOCSIFMTU) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFMTU) && defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevSetMTU:
  * @ifname: interface name to set MTU for
@@ -534,7 +534,7 @@ int virNetDevSetNamespace(const char *ifname, pid_t pidInNs)
     return 0;
 }
 
-#if defined(SIOCSIFNAME) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFNAME) && defined(WITH_STRUCT_IFREQ)
 /**
  * virNetDevSetName:
  * @ifname: name of device
@@ -552,7 +552,7 @@ int virNetDevSetName(const char* ifname, const char *newifname)
     if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
         return -1;
 
-# ifdef HAVE_STRUCT_IFREQ_IFR_NEWNAME
+# ifdef WITH_STRUCT_IFREQ_IFR_NEWNAME
     if (virStrcpyStatic(ifr.ifr_newname, newifname) < 0) {
         virReportSystemError(ERANGE,
                              _("Network interface name '%s' is too long"),
@@ -583,7 +583,7 @@ int virNetDevSetName(const char* ifname, const char *newifname)
 #endif
 
 
-#if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFFLAGS) && defined(WITH_STRUCT_IFREQ)
 static int
 virNetDevSetIFFlag(const char *ifname, int flag, bool val)
 {
@@ -704,7 +704,7 @@ virNetDevSetRcvAllMulti(const char *ifname,
 }
 
 
-#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFFLAGS) && defined(WITH_STRUCT_IFREQ)
 static int
 virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
 {
@@ -805,7 +805,7 @@ virNetDevGetRcvAllMulti(const char *ifname,
     return virNetDevGetIFFlag(ifname, VIR_IFF_ALLMULTI, receive);
 }
 
-#if defined(HAVE_IF_INDEXTONAME)
+#if defined(WITH_IF_INDEXTONAME)
 char *virNetDevGetName(int ifindex)
 {
     char name[IFNAMSIZ];
@@ -840,7 +840,7 @@ char *virNetDevGetName(int ifindex)
  *
  * Returns 0 on success, -1 on failure
  */
-#if defined(SIOCGIFINDEX) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFINDEX) && defined(WITH_STRUCT_IFREQ)
 int virNetDevGetIndex(const char *ifname, int *ifindex)
 {
     struct ifreq ifreq;
@@ -867,7 +867,7 @@ int virNetDevGetIndex(const char *ifname, int *ifindex)
         return -1;
     }
 
-# ifdef HAVE_STRUCT_IFREQ_IFR_INDEX
+# ifdef WITH_STRUCT_IFREQ_IFR_INDEX
     *ifindex = ifreq.ifr_index;
 # else
     *ifindex = ifreq.ifr_ifindex;
@@ -885,7 +885,7 @@ int virNetDevGetIndex(const char *ifname G_GNUC_UNUSED,
 #endif /* ! SIOCGIFINDEX */
 
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 /**
  * virNetDevGetMaster:
  * @ifname: name of interface we're interested in
@@ -929,10 +929,10 @@ virNetDevGetMaster(const char *ifname G_GNUC_UNUSED,
 }
 
 
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) */
 
 
-#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && HAVE_DECL_GET_VLAN_VID_CMD
+#if defined(SIOCGIFVLAN) && defined(WITH_STRUCT_IFREQ) && WITH_DECL_GET_VLAN_VID_CMD
 int virNetDevGetVLanID(const char *ifname, int *vlanid)
 {
     struct vlan_ioctl_args vlanargs = {
@@ -985,7 +985,7 @@ int virNetDevGetVLanID(const char *ifname G_GNUC_UNUSED,
  *
  * Returns 1 if the config matches, 0 if the config does not match, or interface does not exist, -1 on error
  */
-#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFHWADDR) && defined(WITH_STRUCT_IFREQ)
 int virNetDevValidateConfig(const char *ifname,
                             const virMacAddr *macaddr, int ifindex)
 {
@@ -1473,7 +1473,7 @@ virNetDevSysfsFile(char **pf_sysfs_device_link G_GNUC_UNUSED,
 
 
 #endif /* !__linux__ */
-#if defined(__linux__) && defined(HAVE_LIBNL) && defined(IFLA_VF_MAX)
+#if defined(__linux__) && defined(WITH_LIBNL) && defined(IFLA_VF_MAX)
 
 
 static virMacAddr zeroMAC = { .addr = { 0, 0, 0, 0, 0, 0 } };
@@ -2266,7 +2266,7 @@ virNetDevSetNetConfig(const char *linkdev, int vf,
 }
 
 
-#else /* defined(__linux__) && defined(HAVE_LIBNL)  && defined(IFLA_VF_MAX) */
+#else /* defined(__linux__) && defined(WITH_LIBNL)  && defined(IFLA_VF_MAX) */
 
 
 int
@@ -2309,7 +2309,7 @@ virNetDevSetNetConfig(const char *linkdev G_GNUC_UNUSED,
 }
 
 
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) && defined(IFLA_VF_MAX) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) && defined(IFLA_VF_MAX) */
 
 VIR_ENUM_IMPL(virNetDevIfState,
               VIR_NETDEV_IF_STATE_LAST,
@@ -2442,8 +2442,8 @@ virNetDevGetLinkInfo(const char *ifname,
 #endif /* defined(__linux__) */
 
 
-#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) && \
-    defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
+#if defined(SIOCADDMULTI) && defined(WITH_STRUCT_IFREQ) && \
+    defined(WITH_STRUCT_IFREQ_IFR_HWADDR)
 /**
  * virNetDevAddMulti:
  * @ifname: interface name to which to add multicast MAC address
@@ -2487,8 +2487,8 @@ int virNetDevAddMulti(const char *ifname G_GNUC_UNUSED,
 }
 #endif
 
-#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) && \
-    defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
+#if defined(SIOCDELMULTI) && defined(WITH_STRUCT_IFREQ) && \
+    defined(WITH_STRUCT_IFREQ_IFR_HWADDR)
 /**
  * virNetDevDelMulti:
  * @ifname: interface name from which to delete the multicast MAC address
@@ -2780,7 +2780,7 @@ int virNetDevGetRxFilter(const char *ifname,
     return ret;
 }
 
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(WITH_STRUCT_IFREQ)
 
 /**
  * virNetDevRDMAFeature
@@ -2912,28 +2912,28 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
         {ETHTOOL_GTXCSUM, VIR_NET_DEV_FEAT_GTXCSUM},
         {ETHTOOL_GSG, VIR_NET_DEV_FEAT_GSG},
         {ETHTOOL_GTSO, VIR_NET_DEV_FEAT_GTSO},
-# if HAVE_DECL_ETHTOOL_GGSO
+# if WITH_DECL_ETHTOOL_GGSO
         {ETHTOOL_GGSO, VIR_NET_DEV_FEAT_GGSO},
 # endif
-# if HAVE_DECL_ETHTOOL_GGRO
+# if WITH_DECL_ETHTOOL_GGRO
         {ETHTOOL_GGRO, VIR_NET_DEV_FEAT_GGRO},
 # endif
     };
 
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# if WITH_DECL_ETHTOOL_GFLAGS
     /* ethtool masks */
     struct virNetDevEthtoolFeatureCmd flags[] = {
-#  if HAVE_DECL_ETH_FLAG_LRO
+#  if WITH_DECL_ETH_FLAG_LRO
         {ETH_FLAG_LRO, VIR_NET_DEV_FEAT_LRO},
 #  endif
-#  if HAVE_DECL_ETH_FLAG_TXVLAN
+#  if WITH_DECL_ETH_FLAG_TXVLAN
         {ETH_FLAG_RXVLAN, VIR_NET_DEV_FEAT_RXVLAN},
         {ETH_FLAG_TXVLAN, VIR_NET_DEV_FEAT_TXVLAN},
 #  endif
-#  if HAVE_DECL_ETH_FLAG_NTUBLE
+#  if WITH_DECL_ETH_FLAG_NTUBLE
         {ETH_FLAG_NTUPLE, VIR_NET_DEV_FEAT_NTUPLE},
 #  endif
-#  if HAVE_DECL_ETH_FLAG_RXHASH
+#  if WITH_DECL_ETH_FLAG_RXHASH
         {ETH_FLAG_RXHASH, VIR_NET_DEV_FEAT_RXHASH},
 #  endif
     };
@@ -2945,7 +2945,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
             ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
     }
 
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# if WITH_DECL_ETHTOOL_GFLAGS
     cmd.cmd = ETHTOOL_GFLAGS;
     if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
         for (i = 0; i < G_N_ELEMENTS(flags); i++) {
@@ -2957,7 +2957,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
 }
 
 
-# if HAVE_DECL_DEVLINK_CMD_ESWITCH_GET
+# if WITH_DECL_DEVLINK_CMD_ESWITCH_GET
 
 /**
  * virNetDevGetFamilyId:
@@ -3121,7 +3121,7 @@ virNetDevSwitchdevFeature(const char *ifname G_GNUC_UNUSED,
 # endif
 
 
-# if HAVE_DECL_ETHTOOL_GFEATURES
+# if WITH_DECL_ETHTOOL_GFEATURES
 /**
  * virNetDevGFeatureAvailable
  * This function checks for the availability of a network device gfeature
@@ -3172,7 +3172,7 @@ virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap G_GNUC_UNUSED,
 # endif
 
 
-# if HAVE_DECL_ETHTOOL_SCOALESCE && HAVE_DECL_ETHTOOL_GCOALESCE
+# if WITH_DECL_ETHTOOL_SCOALESCE && WITH_DECL_ETHTOOL_GCOALESCE
 /**
  * virNetDevSetCoalesce:
  * @ifname: interface name to modify
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 55e3948afd..5f581323ed 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -25,11 +25,11 @@
 #include "virnetdevvlan.h"
 #include "virenum.h"
 
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
 # include <net/if.h>
 #endif
 
-#ifdef HAVE_STRUCT_IFREQ
+#ifdef WITH_STRUCT_IFREQ
 typedef struct ifreq virIfreq;
 #else
 typedef void virIfreq;
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index ccac97e8d0..9fec770fb6 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -27,12 +27,12 @@
 #include "virstring.h"
 #include "virsocket.h"
 
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
 # include <net/if.h>
 #endif
 
 #ifdef __linux__
-# if defined(HAVE_LIBNL)
+# if defined(WITH_LIBNL)
 #  include "virnetlink.h"
 # endif
 # include <linux/sockios.h>
@@ -62,7 +62,7 @@
 # define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
 #endif
 
-#if defined(HAVE_BSD_BRIDGE_MGMT)
+#if defined(WITH_BSD_BRIDGE_MGMT)
 # include <net/ethernet.h>
 # include <net/if_bridgevar.h>
 #endif
@@ -71,7 +71,7 @@
 
 VIR_LOG_INIT("util.netdevbridge");
 
-#if defined(HAVE_BSD_BRIDGE_MGMT)
+#if defined(WITH_BSD_BRIDGE_MGMT)
 static int virNetDevBridgeCmd(const char *brname,
                               u_long op,
                               void *arg,
@@ -103,7 +103,7 @@ static int virNetDevBridgeCmd(const char *brname,
 }
 #endif
 
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
 /*
  * Bridge parameters can be set via sysfs on newish kernels,
  * or by  ioctl on older kernels. Perhaps we could just use
@@ -412,7 +412,7 @@ virNetDevBridgePortSetIsolated(const char *brname G_GNUC_UNUSED,
  *
  * Returns 0 in case of success or -1 on failure
  */
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
 static int
 virNetDevBridgeCreateWithIoctl(const char *brname,
                                const virMacAddr *mac)
@@ -441,7 +441,7 @@ virNetDevBridgeCreateWithIoctl(const char *brname,
 }
 #endif
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 int
 virNetDevBridgeCreate(const char *brname,
                       const virMacAddr *mac)
@@ -454,7 +454,7 @@ virNetDevBridgeCreate(const char *brname,
 
 
     if (virNetlinkNewLink(brname, "bridge", &data, &error) < 0) {
-# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+# if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
         if (error == -EOPNOTSUPP) {
             /* fallback to ioctl if netlink doesn't support creating bridges */
             return virNetDevBridgeCreateWithIoctl(brname, mac);
@@ -471,7 +471,7 @@ virNetDevBridgeCreate(const char *brname,
 }
 
 
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
 int
 virNetDevBridgeCreate(const char *brname,
                       const virMacAddr *mac)
@@ -480,7 +480,7 @@ virNetDevBridgeCreate(const char *brname,
 }
 
 
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCIFCREATE2)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCIFCREATE2)
 int
 virNetDevBridgeCreate(const char *brname,
                       const virMacAddr *mac)
@@ -530,7 +530,7 @@ virNetDevBridgeCreate(const char *brname,
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
 static int
 virNetDevBridgeDeleteWithIoctl(const char *brname)
 {
@@ -552,7 +552,7 @@ virNetDevBridgeDeleteWithIoctl(const char *brname)
 #endif
 
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 int
 virNetDevBridgeDelete(const char *brname)
 {
@@ -560,7 +560,7 @@ virNetDevBridgeDelete(const char *brname)
      * deleting a bridge even if it is currently IFF_UP. fallback to
      * using ioctl(SIOCBRDELBR) if netlink fails with EOPNOTSUPP.
      */
-# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+# if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
     return virNetlinkDelLink(brname, virNetDevBridgeDeleteWithIoctl);
 # else
     return virNetlinkDelLink(brname, NULL);
@@ -568,7 +568,7 @@ virNetDevBridgeDelete(const char *brname)
 }
 
 
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
 int
 virNetDevBridgeDelete(const char *brname)
 {
@@ -576,7 +576,7 @@ virNetDevBridgeDelete(const char *brname)
 }
 
 
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCIFDESTROY)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCIFDESTROY)
 int
 virNetDevBridgeDelete(const char *brname)
 {
@@ -613,7 +613,7 @@ int virNetDevBridgeDelete(const char *brname G_GNUC_UNUSED)
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDIF)
 int virNetDevBridgeAddPort(const char *brname,
                            const char *ifname)
 {
@@ -637,7 +637,7 @@ int virNetDevBridgeAddPort(const char *brname,
 
     return 0;
 }
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
 int virNetDevBridgeAddPort(const char *brname,
                            const char *ifname)
 {
@@ -678,7 +678,7 @@ int virNetDevBridgeAddPort(const char *brname,
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELIF)
 int virNetDevBridgeRemovePort(const char *brname,
                               const char *ifname)
 {
@@ -703,7 +703,7 @@ int virNetDevBridgeRemovePort(const char *brname,
 
     return 0;
 }
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
 int virNetDevBridgeRemovePort(const char *brname,
                               const char *ifname)
 {
@@ -736,7 +736,7 @@ int virNetDevBridgeRemovePort(const char *brname,
 #endif
 
 
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
 /**
  * virNetDevBridgeSetSTPDelay:
  * @brname: the bridge name
@@ -830,7 +830,7 @@ int virNetDevBridgeGetSTP(const char *brname,
 
     return ret;
 }
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
 int virNetDevBridgeSetSTPDelay(const char *brname,
                                int delay)
 {
@@ -911,7 +911,7 @@ int virNetDevBridgeGetSTP(const char *brname,
 }
 #endif
 
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
 /**
  * virNetDevBridgeGetVlanFiltering:
  * @brname: the bridge device name
@@ -976,7 +976,7 @@ virNetDevBridgeSetVlanFiltering(const char *brname G_GNUC_UNUSED,
 #endif
 
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 
 # ifndef NTF_SELF
 #  define NTF_SELF 0x02
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index 8c66baa884..1e7e64f8f3 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -28,14 +28,14 @@
 #include "vircommand.h"
 #include "viralloc.h"
 
-#if HAVE_GETIFADDRS
+#if WITH_GETIFADDRS
 # include <ifaddrs.h>
 #endif
 
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
 # include <net/if.h>
 #endif
 #include <fcntl.h>
@@ -51,7 +51,7 @@
 
 VIR_LOG_INIT("util.netdevip");
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 
 static int
 virNetDevGetIPAddressBinary(virSocketAddr *addr, void **data, size_t *len)
@@ -676,7 +676,7 @@ virNetDevIPCheckIPv6Forwarding(void)
     return valid;
 }
 
-#else /* defined(__linux__) && defined(HAVE_LIBNL) */
+#else /* defined(__linux__) && defined(WITH_LIBNL) */
 
 
 int
@@ -815,7 +815,7 @@ virNetDevIPCheckIPv6Forwarding(void)
     return true;
 }
 
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) */
 
 
 /**
@@ -828,7 +828,7 @@ virNetDevIPCheckIPv6Forwarding(void)
  *
  * Returns 0 on success, -errno on failure.
  */
-#if defined(SIOCGIFADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFADDR) && defined(WITH_STRUCT_IFREQ)
 static int
 virNetDevGetIPv4AddressIoctl(const char *ifname,
                              virSocketAddrPtr addr)
@@ -878,7 +878,7 @@ virNetDevGetIPv4AddressIoctl(const char *ifname G_GNUC_UNUSED,
  *
  * Returns 0 on success, -1 on failure, -2 on unsupported.
  */
-#if HAVE_GETIFADDRS
+#if WITH_GETIFADDRS
 static int
 virNetDevGetifaddrsAddress(const char *ifname,
                            virSocketAddrPtr addr)
@@ -925,7 +925,7 @@ virNetDevGetifaddrsAddress(const char *ifname,
     return ret;
 }
 
-#else  /* ! HAVE_GETIFADDRS */
+#else  /* ! WITH_GETIFADDRS */
 
 static int
 virNetDevGetifaddrsAddress(const char *ifname G_GNUC_UNUSED,
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index dcea93a5fe..47c4f5120c 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -47,7 +47,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode,
 # include <linux/if_tun.h>
 
 /* Older kernels lacked this enum value.  */
-# if !HAVE_DECL_MACVLAN_MODE_PASSTHRU
+# if !WITH_DECL_MACVLAN_MODE_PASSTHRU
 #  define MACVLAN_MODE_PASSTHRU 8
 # endif
 
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 931be9e36d..7dd7599747 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -36,7 +36,7 @@
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
 # include <net/if.h>
 #endif
 #include <fcntl.h>
@@ -46,7 +46,7 @@
 # include <net/if_mib.h>
 # include <sys/sysctl.h>
 #endif
-#if defined(HAVE_GETIFADDRS) && defined(AF_LINK)
+#if defined(WITH_GETIFADDRS) && defined(AF_LINK)
 # include <ifaddrs.h>
 #endif
 
@@ -831,7 +831,7 @@ virNetDevTapInterfaceStats(const char *ifname,
                    _("/proc/net/dev: Interface not found"));
     return -1;
 }
-#elif defined(HAVE_GETIFADDRS) && defined(AF_LINK)
+#elif defined(WITH_GETIFADDRS) && defined(AF_LINK)
 int
 virNetDevTapInterfaceStats(const char *ifname,
                            virDomainInterfaceStatsPtr stats,
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 652ed2c1c6..be444baa56 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -40,7 +40,7 @@ VIR_LOG_INIT("util.netlink");
 
 #define NETLINK_ACK_TIMEOUT_S  (2*1000)
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 /* State for a single netlink event handle */
 struct virNetlinkEventHandle {
     int watch;
diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h
index e888857601..40f27524f6 100644
--- a/src/util/virnetlink.h
+++ b/src/util/virnetlink.h
@@ -22,7 +22,7 @@
 #include "internal.h"
 #include "virmacaddr.h"
 
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
 
 # include <netlink/msg.h>
 
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 75d5628cff..ba1e4363d6 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -53,7 +53,7 @@
 VIR_LOG_INIT("util.numa");
 
 
-#if HAVE_NUMAD
+#if WITH_NUMAD
 char *
 virNumaGetAutoPlacementAdvice(unsigned short vcpus,
                               unsigned long long balloon)
@@ -76,7 +76,7 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus,
 
     return output;
 }
-#else /* !HAVE_NUMAD */
+#else /* !WITH_NUMAD */
 char *
 virNumaGetAutoPlacementAdvice(unsigned short vcpus G_GNUC_UNUSED,
                               unsigned long long balloon G_GNUC_UNUSED)
@@ -85,7 +85,7 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus G_GNUC_UNUSED,
                    _("numad is not available on this host"));
     return NULL;
 }
-#endif /* !HAVE_NUMAD */
+#endif /* !WITH_NUMAD */
 
 #if WITH_NUMACTL
 int
@@ -414,7 +414,7 @@ virNumaGetMaxCPUs(void)
 }
 
 
-#if WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET
+#if WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET
 /**
  * virNumaNodeIsAvailable:
  * @node: node to check
@@ -484,7 +484,7 @@ virNumaGetDistances(int node,
     return 0;
 }
 
-#else /* !(WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET) */
+#else /* !(WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET) */
 
 bool
 virNumaNodeIsAvailable(int node)
@@ -509,7 +509,7 @@ virNumaGetDistances(int node G_GNUC_UNUSED,
     VIR_DEBUG("NUMA distance information isn't available on this host");
     return 0;
 }
-#endif /* !(WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET) */
+#endif /* !(WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET) */
 
 
 /* currently all the huge page stuff below is linux only */
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 90d60c04fb..2e95509caf 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -21,7 +21,7 @@
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#if defined HAVE_SYS_SYSCALL_H
+#if defined WITH_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
 
@@ -67,7 +67,7 @@ struct _virPerf {
     struct virPerfEvent events[VIR_PERF_EVENT_LAST];
 };
 
-#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)
+#if defined(__linux__) && defined(WITH_SYS_SYSCALL_H)
 
 # include <linux/perf_event.h>
 
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 6f03627c42..ea9d3a35ef 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -28,18 +28,18 @@
 # include <sys/wait.h>
 #endif
 #include <unistd.h>
-#if HAVE_SYS_MOUNT_H
+#if WITH_SYS_MOUNT_H
 # include <sys/mount.h>
 #endif
-#if HAVE_SETRLIMIT
+#if WITH_SETRLIMIT
 # include <sys/time.h>
 # include <sys/resource.h>
 #endif
-#if HAVE_SCHED_SETSCHEDULER
+#if WITH_SCHED_SETSCHEDULER
 # include <sched.h>
 #endif
 
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || HAVE_BSD_CPU_AFFINITY
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || WITH_BSD_CPU_AFFINITY
 # include <sys/param.h>
 #endif
 
@@ -48,7 +48,7 @@
 # include <sys/user.h>
 #endif
 
-#if HAVE_BSD_CPU_AFFINITY
+#if WITH_BSD_CPU_AFFINITY
 # include <sys/cpuset.h>
 #endif
 
@@ -92,7 +92,7 @@ VIR_LOG_INIT("util.process");
 #  endif
 # endif
 
-# ifndef HAVE_SETNS
+# ifndef WITH_SETNS
 #  if defined(__NR_setns)
 #   include <sys/syscall.h>
 
@@ -439,7 +439,7 @@ int virProcessKillPainfully(pid_t pid, bool force)
     return virProcessKillPainfullyDelay(pid, force, 0);
 }
 
-#if HAVE_SCHED_GETAFFINITY
+#if WITH_SCHED_GETAFFINITY
 
 int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
 {
@@ -530,7 +530,7 @@ virProcessGetAffinity(pid_t pid)
     return ret;
 }
 
-#elif defined(HAVE_BSD_CPU_AFFINITY)
+#elif defined(WITH_BSD_CPU_AFFINITY)
 
 int virProcessSetAffinity(pid_t pid,
                           virBitmapPtr map)
@@ -579,7 +579,7 @@ virProcessGetAffinity(pid_t pid)
     return ret;
 }
 
-#else /* HAVE_SCHED_GETAFFINITY */
+#else /* WITH_SCHED_GETAFFINITY */
 
 int virProcessSetAffinity(pid_t pid G_GNUC_UNUSED,
                           virBitmapPtr map G_GNUC_UNUSED)
@@ -596,7 +596,7 @@ virProcessGetAffinity(pid_t pid G_GNUC_UNUSED)
                          _("Process CPU affinity is not supported on this platform"));
     return NULL;
 }
-#endif /* HAVE_SCHED_GETAFFINITY */
+#endif /* WITH_SCHED_GETAFFINITY */
 
 
 int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
@@ -708,7 +708,7 @@ int virProcessSetNamespaces(size_t nfdlist,
     return 0;
 }
 
-#if HAVE_PRLIMIT
+#if WITH_PRLIMIT
 static int
 virProcessPrLimit(pid_t pid,
                   int resource,
@@ -717,7 +717,7 @@ virProcessPrLimit(pid_t pid,
 {
     return prlimit(pid, resource, new_limit, old_limit);
 }
-#elif HAVE_SETRLIMIT
+#elif WITH_SETRLIMIT
 static int
 virProcessPrLimit(pid_t pid G_GNUC_UNUSED,
                   int resource G_GNUC_UNUSED,
@@ -729,7 +729,7 @@ virProcessPrLimit(pid_t pid G_GNUC_UNUSED,
 }
 #endif
 
-#if HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)
+#if WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)
 int
 virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
 {
@@ -769,7 +769,7 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
 
     return 0;
 }
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
 int
 virProcessSetMaxMemLock(pid_t pid G_GNUC_UNUSED, unsigned long long bytes)
 {
@@ -779,9 +779,9 @@ virProcessSetMaxMemLock(pid_t pid G_GNUC_UNUSED, unsigned long long bytes)
     virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
     return -1;
 }
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
 
-#if HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)
+#if WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)
 int
 virProcessGetMaxMemLock(pid_t pid,
                         unsigned long long *bytes)
@@ -820,7 +820,7 @@ virProcessGetMaxMemLock(pid_t pid,
 
     return 0;
 }
-#else /* ! (HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#else /* ! (WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
 int
 virProcessGetMaxMemLock(pid_t pid G_GNUC_UNUSED,
                         unsigned long long *bytes)
@@ -831,9 +831,9 @@ virProcessGetMaxMemLock(pid_t pid G_GNUC_UNUSED,
     virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
     return -1;
 }
-#endif /* ! (HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#endif /* ! (WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
 
-#if HAVE_SETRLIMIT && defined(RLIMIT_NPROC)
+#if WITH_SETRLIMIT && defined(RLIMIT_NPROC)
 int
 virProcessSetMaxProcesses(pid_t pid, unsigned int procs)
 {
@@ -861,7 +861,7 @@ virProcessSetMaxProcesses(pid_t pid, unsigned int procs)
     }
     return 0;
 }
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NPROC)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_NPROC)) */
 int
 virProcessSetMaxProcesses(pid_t pid G_GNUC_UNUSED, unsigned int procs)
 {
@@ -871,9 +871,9 @@ virProcessSetMaxProcesses(pid_t pid G_GNUC_UNUSED, unsigned int procs)
     virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
     return -1;
 }
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NPROC)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NPROC)) */
 
-#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)
+#if WITH_SETRLIMIT && defined(RLIMIT_NOFILE)
 int
 virProcessSetMaxFiles(pid_t pid, unsigned int files)
 {
@@ -909,7 +909,7 @@ virProcessSetMaxFiles(pid_t pid, unsigned int files)
     }
     return 0;
 }
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
 int
 virProcessSetMaxFiles(pid_t pid G_GNUC_UNUSED, unsigned int files)
 {
@@ -919,9 +919,9 @@ virProcessSetMaxFiles(pid_t pid G_GNUC_UNUSED, unsigned int files)
     virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
     return -1;
 }
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
 
-#if HAVE_SETRLIMIT && defined(RLIMIT_CORE)
+#if WITH_SETRLIMIT && defined(RLIMIT_CORE)
 int
 virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes)
 {
@@ -946,7 +946,7 @@ virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes)
     }
     return 0;
 }
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_CORE)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_CORE)) */
 int
 virProcessSetMaxCoreSize(pid_t pid G_GNUC_UNUSED,
                          unsigned long long bytes)
@@ -957,7 +957,7 @@ virProcessSetMaxCoreSize(pid_t pid G_GNUC_UNUSED,
     virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
     return -1;
 }
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_CORE)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_CORE)) */
 
 
 #ifdef __linux__
@@ -1419,7 +1419,7 @@ virProcessExitWithStatus(int status)
     exit(value);
 }
 
-#if HAVE_SCHED_SETSCHEDULER
+#if WITH_SCHED_SETSCHEDULER
 
 static int
 virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
@@ -1515,7 +1515,7 @@ virProcessSetScheduler(pid_t pid,
     return 0;
 }
 
-#else /* ! HAVE_SCHED_SETSCHEDULER */
+#else /* ! WITH_SCHED_SETSCHEDULER */
 
 int
 virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
@@ -1531,4 +1531,4 @@ virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
     return -1;
 }
 
-#endif /* !HAVE_SCHED_SETSCHEDULER */
+#endif /* !WITH_SCHED_SETSCHEDULER */
diff --git a/src/util/virstring.c b/src/util/virstring.c
index c31f2ede8f..de2ef964f4 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -20,7 +20,7 @@
 
 #include <glib/gprintf.h>
 #include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
 # include <xlocale.h>
 #endif
 
@@ -531,7 +531,7 @@ virStrToLong_ullp(char const *s, char **end_ptr, int base,
 }
 
 /* In case thread-safe locales are available */
-#if HAVE_NEWLOCALE
+#if WITH_NEWLOCALE
 
 typedef locale_t virLocale;
 static virLocale virLocaleRaw;
@@ -575,7 +575,7 @@ virLocaleFixupRadix(char **strp G_GNUC_UNUSED)
 {
 }
 
-#else /* !HAVE_NEWLOCALE */
+#else /* !WITH_NEWLOCALE */
 
 typedef int virLocale;
 
@@ -606,7 +606,7 @@ virLocaleFixupRadix(char **strp)
     }
 }
 
-#endif /* !HAVE_NEWLOCALE */
+#endif /* !WITH_NEWLOCALE */
 
 
 /**
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 64013b575c..7f23399835 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -29,7 +29,7 @@
 
 #include <unistd.h>
 #include <inttypes.h>
-#if HAVE_SYS_SYSCALL_H
+#if WITH_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
 
@@ -297,7 +297,7 @@ bool virThreadIsSelf(virThreadPtr thread)
  * the pthread_self() id on Linux.  */
 unsigned long long virThreadSelfID(void)
 {
-#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__)
+#if defined(WITH_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__)
     pid_t tid = syscall(SYS_gettid);
     return tid;
 #else
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 8639176fdc..df76821670 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -37,7 +37,7 @@
 
 #include <sys/types.h>
 
-#ifdef HAVE_GETPWUID_R
+#ifdef WITH_GETPWUID_R
 # include <pwd.h>
 # include <grp.h>
 #endif
@@ -592,7 +592,7 @@ char *virGetUserRuntimeDirectory(void)
 }
 
 
-#ifdef HAVE_GETPWUID_R
+#ifdef WITH_GETPWUID_R
 /* Look up fields from the user database for the given user.  On
  * error, set errno, report the error if not instructed otherwise via @quiet,
  * and return -1.  */
@@ -1027,7 +1027,7 @@ virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups G_GNUC_UNUSED,
         return -1;
     }
 
-# if HAVE_SETGROUPS
+# if WITH_SETGROUPS
     if (gid != (gid_t)-1 && setgroups(ngroups, groups) < 0) {
         virReportSystemError(errno, "%s",
                              _("cannot set supplemental groups"));
@@ -1045,7 +1045,7 @@ virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups G_GNUC_UNUSED,
     return 0;
 }
 
-#else /* ! HAVE_GETPWUID_R */
+#else /* ! WITH_GETPWUID_R */
 
 int
 virGetGroupList(uid_t uid G_GNUC_UNUSED, gid_t gid G_GNUC_UNUSED,
@@ -1087,7 +1087,7 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED)
     return NULL;
 }
 
-# else /* !HAVE_GETPWUID_R && !WIN32 */
+# else /* !WITH_GETPWUID_R && !WIN32 */
 char *
 virGetUserDirectoryByUID(uid_t uid G_GNUC_UNUSED)
 {
@@ -1105,7 +1105,7 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED)
 
     return NULL;
 }
-# endif /* ! HAVE_GETPWUID_R && ! WIN32 */
+# endif /* ! WITH_GETPWUID_R && ! WIN32 */
 
 char *
 virGetUserName(uid_t uid G_GNUC_UNUSED)
@@ -1154,7 +1154,7 @@ virGetGroupName(gid_t gid G_GNUC_UNUSED)
 
     return NULL;
 }
-#endif /* HAVE_GETPWUID_R */
+#endif /* WITH_GETPWUID_R */
 
 #if WITH_CAPNG
 /* Set the real and effective uid and gid to the given values, while
@@ -1911,19 +1911,19 @@ char *virGetPassword(void)
 static int
 virPipeImpl(int fds[2], bool nonblock, bool errreport)
 {
-#ifdef HAVE_PIPE2
+#ifdef WITH_PIPE2
     int rv;
     int flags = O_CLOEXEC;
     if (nonblock)
         flags |= O_NONBLOCK;
     rv = pipe2(fds, flags);
-#else /* !HAVE_PIPE2 */
+#else /* !WITH_PIPE2 */
 # ifdef WIN32
     int rv = _pipe(fds, 4096, _O_BINARY);
 # else /* !WIN32 */
     int rv = pipe(fds);
 # endif /* !WIN32 */
-#endif /* !HAVE_PIPE2 */
+#endif /* !WITH_PIPE2 */
 
     if (rv < 0) {
         if (errreport)
@@ -1932,7 +1932,7 @@ virPipeImpl(int fds[2], bool nonblock, bool errreport)
         return rv;
     }
 
-#ifndef HAVE_PIPE2
+#ifndef WITH_PIPE2
     if (nonblock) {
         if (virSetNonBlock(fds[0]) < 0 ||
             virSetNonBlock(fds[1]) < 0) {
@@ -1946,7 +1946,7 @@ virPipeImpl(int fds[2], bool nonblock, bool errreport)
             return -1;
         }
     }
-#endif /* !HAVE_PIPE2 */
+#endif /* !WITH_PIPE2 */
 
     return 0;
 }
diff --git a/src/util/virutil.h b/src/util/virutil.h
index f3a2e2b80d..8b0e38e335 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -59,22 +59,22 @@ int virDiskNameToIndex(const char* str);
 char *virIndexToDiskName(int idx, const char *prefix);
 
 /* No-op workarounds for functionality missing in mingw.  */
-#ifndef HAVE_GETUID
+#ifndef WITH_GETUID
 static inline int getuid(void)
 { return 0; }
 #endif
 
-#ifndef HAVE_GETEUID
+#ifndef WITH_GETEUID
 static inline int geteuid(void)
 { return 0; }
 #endif
 
-#ifndef HAVE_GETGID
+#ifndef WITH_GETGID
 static inline int getgid(void)
 { return 0; }
 #endif
 
-#ifndef HAVE_GETEGID
+#ifndef WITH_GETEGID
 static inline int getegid(void)
 { return 0; }
 #endif
diff --git a/src/util/virvsock.c b/src/util/virvsock.c
index 2638c5095a..4bbbf78167 100644
--- a/src/util/virvsock.c
+++ b/src/util/virvsock.c
@@ -17,11 +17,11 @@
 
 #include <config.h>
 
-#ifdef HAVE_SYS_IOCTL_H
+#ifdef WITH_SYS_IOCTL_H
 # include <sys/ioctl.h>
 #endif
 
-#if HAVE_DECL_VHOST_VSOCK_SET_GUEST_CID
+#if WITH_DECL_VHOST_VSOCK_SET_GUEST_CID
 # include <linux/vhost.h>
 #endif
 
@@ -35,7 +35,7 @@
 
 VIR_LOG_INIT("util.vsock");
 
-#if HAVE_DECL_VHOST_VSOCK_SET_GUEST_CID
+#if WITH_DECL_VHOST_VSOCK_SET_GUEST_CID
 static int
 virVsockSetGuestCidQuiet(int fd,
                          unsigned int guest_cid)
diff --git a/tests/eventtest.c b/tests/eventtest.c
index 4a23bd6e62..7a9c87b8cf 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -23,7 +23,7 @@
 #include <signal.h>
 #include <time.h>
 
-#if HAVE_MACH_CLOCK_ROUTINES
+#if WITH_MACH_CLOCK_ROUTINES
 # include <mach/clock.h>
 # include <mach/mach.h>
 #endif
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index a2ef9bed0b..c4d5db9a7b 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -180,7 +180,7 @@ mymain(void)
 
     DO_TEST("basic-pv");
     DO_TEST("basic-hvm");
-# ifdef HAVE_XEN_PVH
+# ifdef WITH_XEN_PVH
     DO_TEST("basic-pvh");
 # endif
     DO_TEST("cpu-shares-hvm");
diff --git a/tests/meson.build b/tests/meson.build
index b5f6e2267a..8e0c3a428a 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -470,7 +470,7 @@ if conf.has('WITH_REMOTE')
   ]
 
   nettls_sources = [ 'virnettlshelpers.c' ]
-  if conf.has('HAVE_LIBTASN1_H')
+  if conf.has('WITH_LIBTASN1_H')
     nettls_sources += 'pkix_asn1_tab.c'
   endif
 
diff --git a/tests/securityselinuxhelper.c b/tests/securityselinuxhelper.c
index 64d2b75740..14355d2166 100644
--- a/tests/securityselinuxhelper.c
+++ b/tests/securityselinuxhelper.c
@@ -23,7 +23,7 @@
  * detected. */
 
 #include "virmock.h"
-#if HAVE_LINUX_MAGIC_H
+#if WITH_LINUX_MAGIC_H
 # include <linux/magic.h>
 #endif
 #include <selinux/selinux.h>
diff --git a/tests/virfilemock.c b/tests/virfilemock.c
index 802ee9b5f9..7c9174bdd9 100644
--- a/tests/virfilemock.c
+++ b/tests/virfilemock.c
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <mntent.h>
 #include <sys/vfs.h>
-#if HAVE_LINUX_MAGIC_H
+#if WITH_LINUX_MAGIC_H
 # include <linux/magic.h>
 #endif
 #include <assert.h>
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index 1392536b74..3c1f2ce54e 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -31,7 +31,7 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
 static int testFileCheckMounts(const char *prefix,
                                char **gotmounts,
                                size_t gotnmounts,
@@ -91,7 +91,7 @@ static int testFileGetMountSubtree(const void *opaque)
     g_strfreev(gotmounts);
     return ret;
 }
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 
 struct testFileSanitizePathData
 {
@@ -122,7 +122,7 @@ testFileSanitizePath(const void *opaque)
 }
 
 
-#if HAVE_DECL_SEEK_HOLE && defined(__linux__)
+#if WITH_DECL_SEEK_HOLE && defined(__linux__)
 
 /* Create a sparse file. @offsets in KiB. */
 static int
@@ -234,7 +234,7 @@ holesSupported(void)
     return ret;
 }
 
-#else /* !HAVE_DECL_SEEK_HOLE || !defined(__linux__)*/
+#else /* !WITH_DECL_SEEK_HOLE || !defined(__linux__)*/
 
 static int
 makeSparseFile(const off_t offsets[] G_GNUC_UNUSED,
@@ -250,7 +250,7 @@ holesSupported(void)
     return false;
 }
 
-#endif /* !HAVE_DECL_SEEK_HOLE || !defined(__linux__)*/
+#endif /* !WITH_DECL_SEEK_HOLE || !defined(__linux__)*/
 
 struct testFileInData {
     bool startData;     /* whether the list of offsets starts with data section */
@@ -356,7 +356,7 @@ mymain(void)
     int ret = 0;
     struct testFileSanitizePathData data1;
 
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
 # define MTAB_PATH1 abs_srcdir "/virfiledata/mounts1.txt"
 # define MTAB_PATH2 abs_srcdir "/virfiledata/mounts2.txt"
 
@@ -386,7 +386,7 @@ mymain(void)
     DO_TEST_MOUNT_SUBTREE("/proc reverse", MTAB_PATH1, "/proc", wantmounts1rev, true);
     DO_TEST_MOUNT_SUBTREE("/etc/aliases", MTAB_PATH2, "/etc/aliases", wantmounts2a, false);
     DO_TEST_MOUNT_SUBTREE("/etc/aliases.db", MTAB_PATH2, "/etc/aliases.db", wantmounts2b, false);
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
 
 #define DO_TEST_SANITIZE_PATH(PATH, EXPECT) \
     do { \
diff --git a/tests/virmock.h b/tests/virmock.h
index 95feeb0d92..a812cfe08b 100644
--- a/tests/virmock.h
+++ b/tests/virmock.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 # include <dlfcn.h>
 #endif
 
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 2c3715ae0c..1a58025a0a 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -68,28 +68,28 @@
 
 
 
-#if defined(HAVE_STAT) && !defined(HAVE___XSTAT) && !defined(HAVE_STAT64)
+#if defined(WITH_STAT) && !defined(WITH___XSTAT) && !defined(WITH_STAT64)
 # define MOCK_STAT
 #endif
-#if defined(HAVE_STAT64) && !defined(HAVE___XSTAT64)
+#if defined(WITH_STAT64) && !defined(WITH___XSTAT64)
 # define MOCK_STAT64
 #endif
-#if defined(HAVE___XSTAT) && !defined(HAVE___XSTAT64)
+#if defined(WITH___XSTAT) && !defined(WITH___XSTAT64)
 # define MOCK___XSTAT
 #endif
-#if defined(HAVE___XSTAT64)
+#if defined(WITH___XSTAT64)
 # define MOCK___XSTAT64
 #endif
-#if defined(HAVE_LSTAT) && !defined(HAVE___LXSTAT) && !defined(HAVE_LSTAT64)
+#if defined(WITH_LSTAT) && !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64)
 # define MOCK_LSTAT
 #endif
-#if defined(HAVE_LSTAT64) && !defined(HAVE___LXSTAT64)
+#if defined(WITH_LSTAT64) && !defined(WITH___LXSTAT64)
 # define MOCK_LSTAT64
 #endif
-#if defined(HAVE___LXSTAT) && !defined(HAVE___LXSTAT64)
+#if defined(WITH___LXSTAT) && !defined(WITH___LXSTAT64)
 # define MOCK___LXSTAT
 #endif
-#if defined(HAVE___LXSTAT64)
+#if defined(WITH___LXSTAT64)
 # define MOCK___LXSTAT64
 #endif
 
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 7d2ad36aae..b8baca0c23 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -20,7 +20,7 @@
 
 #include <signal.h>
 #include <unistd.h>
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
 # include <ifaddrs.h>
 #endif
 
@@ -37,7 +37,7 @@
 
 VIR_LOG_INIT("tests.netsockettest");
 
-#if HAVE_IFADDRS_H
+#if WITH_IFADDRS_H
 # define BASE_PORT 5672
 
 static int
@@ -522,7 +522,7 @@ static int
 mymain(void)
 {
     int ret = 0;
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
     bool hasIPv4, hasIPv6;
     int freePort;
 #endif
@@ -533,7 +533,7 @@ mymain(void)
 
     virEventRegisterDefaultImpl();
 
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
     if (checkProtocols(&hasIPv4, &hasIPv6, &freePort) < 0) {
         fprintf(stderr, "Cannot identify IPv4/6 availability\n");
         return EXIT_FAILURE;
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 9860e0ec3e..26793545c1 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -30,7 +30,7 @@
 #include "vircommand.h"
 #include "virsocket.h"
 
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 
 # include "rpc/virnettlscontext.h"
 
diff --git a/tests/virnettlshelpers.c b/tests/virnettlshelpers.c
index 979afed307..e0a4771894 100644
--- a/tests/virnettlshelpers.c
+++ b/tests/virnettlshelpers.c
@@ -27,7 +27,7 @@
 #include "virsocketaddr.h"
 #include "virutil.h"
 
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 
 # define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/tests/virnettlshelpers.h b/tests/virnettlshelpers.h
index 4c6f5e8c31..cdc92a17f8 100644
--- a/tests/virnettlshelpers.h
+++ b/tests/virnettlshelpers.h
@@ -21,7 +21,7 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 
 # include <libtasn1.h>
 
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index ebb90ad5a2..ccb5cad198 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -30,7 +30,7 @@
 #include "vircommand.h"
 #include "virsocket.h"
 
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 
 # define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/tests/virportallocatormock.c b/tests/virportallocatormock.c
index 28fe89200e..964f475944 100644
--- a/tests/virportallocatormock.c
+++ b/tests/virportallocatormock.c
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 # include <dlfcn.h>
 #endif
 
diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c
index 0a938f6410..691d3f22f1 100644
--- a/tests/virportallocatortest.c
+++ b/tests/virportallocatortest.c
@@ -20,7 +20,7 @@
 #include "virfile.h"
 #include "testutils.h"
 
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
 # include <dlfcn.h>
 #endif
 
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 179ae5e5e7..e0f8b6d621 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -198,7 +198,7 @@ testPrepImages(void)
     if (virCommandRun(cmd, NULL) < 0)
         goto skip;
 
-#ifdef HAVE_SYMLINK
+#ifdef WITH_SYMLINK
     /* Create some symlinks in a sub-directory. */
     if (symlink("../qcow2", datadir "/sub/link1") < 0 ||
         symlink("../wrap", datadir "/sub/link2") < 0) {
@@ -859,7 +859,7 @@ mymain(void)
     TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, (&dir), EXP_PASS);
     TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, (&dir), EXP_PASS);
 
-#ifdef HAVE_SYMLINK
+#ifdef WITH_SYMLINK
     /* Rewrite qcow2 and wrap file to use backing names relative to a
      * symlink from a different directory */
     virCommandFree(cmd);
diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c
index 15369d8eb2..7e5ac01c6c 100644
--- a/tests/vshtabletest.c
+++ b/tests/vshtabletest.c
@@ -19,7 +19,7 @@
 #include <config.h>
 
 #include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
 # include <xlocale.h>
 #endif
 #include <wchar.h>
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index 6331c65131..b021efc3c9 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -356,7 +356,7 @@ NSS_NAME(gethostbyname3)(const char *name, int af, struct hostent *result,
     return ret;
 }
 
-#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
+#ifdef WITH_STRUCT_GAIH_ADDRTUPLE
 enum nss_status
 NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
                          char *buffer, size_t buflen, int *errnop,
@@ -449,7 +449,7 @@ NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
     free(addr);
     return ret;
 }
-#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+#endif /* WITH_STRUCT_GAIH_ADDRTUPLE */
 
 #if defined(WITH_BSD_NSS)
 NSS_METHOD_PROTOTYPE(_nss_compat_getaddrinfo);
diff --git a/tools/nss/libvirt_nss.h b/tools/nss/libvirt_nss.h
index 121b9e8722..2bb313f329 100644
--- a/tools/nss/libvirt_nss.h
+++ b/tools/nss/libvirt_nss.h
@@ -77,12 +77,12 @@ NSS_NAME(gethostbyname3)(const char *name, int af, struct hostent *result,
                          char *buffer, size_t buflen, int *errnop,
                          int *herrnop, int32_t *ttlp, char **canonp);
 
-#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
+#ifdef WITH_STRUCT_GAIH_ADDRTUPLE
 enum nss_status
 NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
                          char *buffer, size_t buflen, int *errnop,
                          int *herrnop, int32_t *ttlp);
-#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+#endif /* WITH_STRUCT_GAIH_ADDRTUPLE */
 
 #if defined(WITH_BSD_NSS)
 ns_mtab*
diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c
index e797e63475..c119d649ce 100644
--- a/tools/virt-host-validate.c
+++ b/tools/virt-host-validate.c
@@ -21,9 +21,9 @@
 
 #include <config.h>
 
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
 # include <libintl.h>
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
 #include <getopt.h>
 
 #include "internal.h"
-- 
2.26.2




More information about the libvir-list mailing list