treewide: only define feature macros when the feature is available

Most feature checks already use #ifdef, and do not care about
the value of the macro. Convert all feature checks to do that,
and simplify the meson build scripts by replacing

  if cond
    cdata.set('X', 1)
  endif

with

  cdata.set('X', cond)
This commit is contained in:
Barnabás Pőcze 2022-02-03 18:52:54 +01:00
parent 140378efd6
commit 15e7a61aa7
15 changed files with 49 additions and 83 deletions

View file

@ -51,7 +51,7 @@ plugin_init (GstPlugin *plugin)
gst_element_register (plugin, "pipewiresink", GST_RANK_NONE,
GST_TYPE_PIPEWIRE_SINK);
#if HAVE_GSTREAMER_DEVICE_PROVIDER
#ifdef HAVE_GSTREAMER_DEVICE_PROVIDER
if (!gst_device_provider_register (plugin, "pipewiredeviceprovider",
GST_RANK_PRIMARY + 1, GST_TYPE_PIPEWIRE_DEVICE_PROVIDER))
return FALSE;

View file

@ -273,7 +273,7 @@ if avahi_dep.found()
'module-zeroconf-discover/avahi-poll.c',
]
pipewire_module_protocol_pulse_deps += avahi_dep
cdata.set('HAVE_AVAHI', 1)
cdata.set('HAVE_AVAHI', true)
endif
pipewire_module_protocol_pulse = shared_library('pipewire-module-protocol-pulse',

View file

@ -32,10 +32,10 @@
#include "config.h"
#if HAVE_SYS_VFS_H
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#if HAVE_SYS_MOUNT_H
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif

View file

@ -35,7 +35,7 @@
#include <fcntl.h>
#include <sys/file.h>
#include <ctype.h>
#if HAVE_PWD_H
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#if defined(__FreeBSD__)

View file

@ -35,7 +35,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/file.h>
#if HAVE_PWD_H
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif

View file

@ -5105,7 +5105,7 @@ static void impl_clear(struct impl *impl)
pw_map_for_each(&impl->modules, impl_unload_module, impl);
pw_map_clear(&impl->modules);
#if HAVE_DBUS
#ifdef HAVE_DBUS
if (impl->dbus_name) {
dbus_release_name(impl->dbus_name);
impl->dbus_name = NULL;
@ -5276,7 +5276,7 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
pw_context_add_listener(context, &impl->context_listener,
&context_events, impl);
#if HAVE_DBUS
#ifdef HAVE_DBUS
impl->dbus_name = dbus_request_name(context, "org.pulseaudio.Server");
#endif

View file

@ -34,7 +34,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include <dirent.h>
#if HAVE_PWD_H
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef __FreeBSD__

View file

@ -27,7 +27,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#if HAVE_SYS_RANDOM_H
#ifdef HAVE_SYS_RANDOM_H
#include <sys/random.h>
#endif
#include <string.h>