Skip to contentSkip to conversation

build: imply --enable-bindings-glib for --enable-dbus

PATCH Superseded Bartosz Golaszewski 2 participants 3 messages Sep 3, 2024 – Sep 4, 2024 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: imply --enable-bindings-glib for --enable-dbus

From: Bartosz Golaszewski <[email protected]>

GLib bindings are required to build the D-Bus daemon. Enable them automatically if --enable-dbus is passed to configure.

Fixes a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests")
---
 configure.ac | 48 +++++++++++++++++++++---------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)
configure.ac +21 -27
index 1ac1002..a4dd05f 100644
@@ -250,6 +250,27 @@ then
 	fi
 fi
 
+AC_ARG_ENABLE([dbus],
+	[AS_HELP_STRING([--enable-dbus], [build dbus daemon [default=no]])],
+	[if test "x$enableval" == xyes; then with_dbus=true; with_bindings_glib=true; fi],
+	[with_dbus=false])
+AM_CONDITIONAL([WITH_DBUS], [test "x$with_dbus" = xtrue])
+
+AC_DEFUN([FUNC_NOT_FOUND_DBUS],
+	[ERR_NOT_FOUND([$1()], [dbus daemon])])
+
+if test "x$with_dbus" = xtrue
+then
+	AC_CHECK_FUNC([daemon], [], [FUNC_NOT_FOUND_DBUS([daemon])])
+	AC_CHECK_FUNC([strverscmp], [], [FUNC_NOT_FOUND_DBUS([strverscmp])])
+	PKG_CHECK_MODULES([GUDEV], [gudev-1.0 >= 230])
+	AC_CHECK_PROG([has_gdbus_codegen], [gdbus-codegen], [true], [false])
+	if test "x$has_gdbus_codegen" = xfalse
+	then
+		AC_MSG_ERROR([gdbus-codegen not found - needed to build dbus daemon])
+	fi
+fi
+
 AC_ARG_ENABLE([bindings-glib],
 	[AS_HELP_STRING([--enable-bindings-glib],[enable GLib 2.0 bindings [default=no]])],
 	[if test "x$enableval" = xyes; then with_bindings_glib=true; fi],
@@ -280,33 +301,6 @@ m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
 	[GOBJECT_INTROSPECTION_CHECK([0.6.2])],
 	[AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")])
 
-# Depends on GLib bindings so must come after
-AC_ARG_ENABLE([dbus],
-	[AS_HELP_STRING([--enable-dbus], [build dbus daemon [default=no]])],
-	[if test "x$enableval" == xyes; then with_dbus=true; fi],
-	[with_dbus=false])
-AM_CONDITIONAL([WITH_DBUS], [test "x$with_dbus" = xtrue])
-
-AC_DEFUN([FUNC_NOT_FOUND_DBUS],
-	[ERR_NOT_FOUND([$1()], [dbus daemon])])
-
-if test "x$with_dbus" = xtrue && test "x$with_bindings_glib" != xtrue
-then
-	AC_MSG_ERROR([GLib bindings are required to build the dbus daemon - use --enable-bindings-glib])
-fi
-
-if test "x$with_dbus" = xtrue
-then
-	AC_CHECK_FUNC([daemon], [], [FUNC_NOT_FOUND_DBUS([daemon])])
-	AC_CHECK_FUNC([strverscmp], [], [FUNC_NOT_FOUND_DBUS([strverscmp])])
-	PKG_CHECK_MODULES([GUDEV], [gudev-1.0 >= 230])
-	AC_CHECK_PROG([has_gdbus_codegen], [gdbus-codegen], [true], [false])
-	if test "x$has_gdbus_codegen" = xfalse
-	then
-		AC_MSG_ERROR([gdbus-codegen not found - needed to build dbus daemon])
-	fi
-fi
-
 AC_ARG_ENABLE([systemd],
 	[AS_HELP_STRING([--enable-systemd], [enable systemd support [default=no]])],
 	[if test "x$enableval" == xyes; then with_systemd=true; fi],
Signature · 1 line
2.43.0
#1 lore raw
Quoted 80 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

GLib bindings are required to build the D-Bus daemon. Enable them automatically if --enable-dbus is passed to configure.

Fixes a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests")
---
 configure.ac | 48 +++++++++++++++++++++---------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)
configure.ac +21 -28
index 1ac1002..a4dd05f 100644
@@ -250,6 +250,27 @@ then
 	fi
 fi
 
+AC_ARG_ENABLE([dbus],
+	[AS_HELP_STRING([--enable-dbus], [build dbus daemon [default=no]])],
+	[if test "x$enableval" == xyes; then with_dbus=true; with_bindings_glib=true; fi],
+	[with_dbus=false])
+AM_CONDITIONAL([WITH_DBUS], [test "x$with_dbus" = xtrue])
+
+AC_DEFUN([FUNC_NOT_FOUND_DBUS],
+	[ERR_NOT_FOUND([$1()], [dbus daemon])])
+
+if test "x$with_dbus" = xtrue
+then
+	AC_CHECK_FUNC([daemon], [], [FUNC_NOT_FOUND_DBUS([daemon])])
+	AC_CHECK_FUNC([strverscmp], [], [FUNC_NOT_FOUND_DBUS([strverscmp])])
+	PKG_CHECK_MODULES([GUDEV], [gudev-1.0 >= 230])
+	AC_CHECK_PROG([has_gdbus_codegen], [gdbus-codegen], [true], [false])
+	if test "x$has_gdbus_codegen" = xfalse
+	then
+		AC_MSG_ERROR([gdbus-codegen not found - needed to build dbus daemon])
+	fi
+fi
+
 AC_ARG_ENABLE([bindings-glib],
 	[AS_HELP_STRING([--enable-bindings-glib],[enable GLib 2.0 bindings [default=no]])],
 	[if test "x$enableval" = xyes; then with_bindings_glib=true; fi],
@@ -280,33 +301,6 @@ m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
 	[GOBJECT_INTROSPECTION_CHECK([0.6.2])],
 	[AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")])
 
-# Depends on GLib bindings so must come after
-AC_ARG_ENABLE([dbus],
-	[AS_HELP_STRING([--enable-dbus], [build dbus daemon [default=no]])],
-	[if test "x$enableval" == xyes; then with_dbus=true; fi],
-	[with_dbus=false])
-AM_CONDITIONAL([WITH_DBUS], [test "x$with_dbus" = xtrue])
-
-AC_DEFUN([FUNC_NOT_FOUND_DBUS],
-	[ERR_NOT_FOUND([$1()], [dbus daemon])])
-
-if test "x$with_dbus" = xtrue && test "x$with_bindings_glib" != xtrue
-then
-	AC_MSG_ERROR([GLib bindings are required to build the dbus daemon - use --enable-bindings-glib])
-fi
-
-if test "x$with_dbus" = xtrue
-then
-	AC_CHECK_FUNC([daemon], [], [FUNC_NOT_FOUND_DBUS([daemon])])
-	AC_CHECK_FUNC([strverscmp], [], [FUNC_NOT_FOUND_DBUS([strverscmp])])
-	PKG_CHECK_MODULES([GUDEV], [gudev-1.0 >= 230])
-	AC_CHECK_PROG([has_gdbus_codegen], [gdbus-codegen], [true], [false])
-	if test "x$has_gdbus_codegen" = xfalse
-	then
-		AC_MSG_ERROR([gdbus-codegen not found - needed to build dbus daemon])
-	fi
-fi
-
 AC_ARG_ENABLE([systemd],
 	[AS_HELP_STRING([--enable-systemd], [enable systemd support [default=no]])],
 	[if test "x$enableval" == xyes; then with_systemd=true; fi],
--
Quoted 2 lines

2.43.0

This does not work for me.
Using both --enable-dbus and --enable-bindings-glib works, but only specifying --enable-dbus results in:

make[3]: Entering directory '/home/dev/libgpiod/dbus/lib'
GEN generated-gpiodbus.c
make all-am
make[4]: Entering directory '/home/dev/libgpiod/dbus/lib'
CC libgpiodbus_la-generated-gpiodbus.lo
In file included from generated-gpiodbus.c:13:
generated-gpiodbus.h:12:10: fatal error: gio/gio.h: No such file or directory
12 | #include <gio/gio.h>

      |          ^~~~~~~~~~~

compilation terminated.

It isn't propagating the glib dependency that populates the GLIB_CFLAGS and so the include paths.

That is on Debian testing, btw.

Cheers,
Kent.

#2 lore raw
Quoted 24 lines · Kent Gibson
Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

GLib bindings are required to build the D-Bus daemon. Enable them automatically if --enable-dbus is passed to configure.

Fixes a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests")

This does not work for me.
Using both --enable-dbus and --enable-bindings-glib works, but only specifying --enable-dbus results in:

make[3]: Entering directory '/home/dev/libgpiod/dbus/lib'
GEN generated-gpiodbus.c
make all-am
make[4]: Entering directory '/home/dev/libgpiod/dbus/lib'
CC libgpiodbus_la-generated-gpiodbus.lo
In file included from generated-gpiodbus.c:13:
generated-gpiodbus.h:12:10: fatal error: gio/gio.h: No such file or directory
12 | #include <gio/gio.h>

Quoted 8 lines
      |          ^~~~~~~~~~~

compilation terminated.

It isn't propagating the glib dependency that populates the GLIB_CFLAGS and so the include paths.

That is on Debian testing, btw.

Hmm, weird, I remember testing this as the first thing but it doesn't work indeed. Maybe I had a dirty build dir. I'll look into it.

Bart