meson: Add optional GLib support
authorArnaud Rebillout <arnaud.rebillout@collabora.com>
Sat, 20 Oct 2018 08:29:03 +0000 (15:29 +0700)
committerArun Raghavan <arun@arunraghavan.net>
Thu, 27 Dec 2018 11:55:56 +0000 (17:25 +0530)
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
meson.build
meson_options.txt
src/meson.build
src/pulse/meson.build

index 3cc31d0..769c2b0 100644 (file)
@@ -226,6 +226,11 @@ if dbus_dep.found()
   cdata.set('HAVE_DBUS', 1)
 endif
 
+glib_dep = dependency('glib-2.0', version : '>= 2.4.0', required: get_option('glib'))
+if glib_dep.found()
+  cdata.set('HAVE_GLIB', 1)
+endif
+
 x11_dep = dependency('x11-xcb', required : get_option('x11'))
 if x11_dep.found()
   xcb_dep  = dependency('xcb',  required : true, version : '>= 1.6')
index 4372abd..85529c4 100644 (file)
@@ -38,6 +38,9 @@ option('dbus',
 option('fftw',
        type : 'feature', value : 'auto',
        description : 'Optional FFTW support')
+option('glib',
+       type : 'feature', value : 'auto',
+       description : 'Optional GLib 2 support')
 option('hal-compat',
        type : 'boolean',
        description : 'Optional HAL->udev transition compatibility support (needs udev)')
index e53ea1b..1ca0282 100644 (file)
@@ -182,7 +182,7 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
   include_directories : [configinc, topinc],
   c_args : [pa_c_args],
   install : true,
-  dependencies : [libm_dep, thread_dep, shm_dep, sndfile_dep, dbus_dep, x11_dep, systemd_dep],
+  dependencies : [libm_dep, thread_dep, shm_dep, sndfile_dep, dbus_dep, x11_dep, systemd_dep, glib_dep],
   implicit_include_directories : false)
 
 libpulsecommon_dep = declare_dependency(link_with: libpulsecommon)
index 91b0ca6..30c8f75 100644 (file)
@@ -61,6 +61,10 @@ libpulse_headers = [
   'xmalloc.h',
 ]
 
+if glib_dep.found()
+  libpulse_headers += 'glib-mainloop.h'
+endif
+
 libpulse = shared_library('pulse',
   libpulse_sources,
   libpulse_headers,