[PATCH] split --disable-extras into multiple options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This patch patch makes it possible to enable all extras with external
dependencies individually. It replaces:
	--disable-extras
with
	--disable-gudev
	--disable-bluetooth
	--disable-keymap
	--disable-acl
	--disable-usbdb
	--disable-pcidb
	--disable-modem-modeswitch
as configure options.
I need a patch like this for the embedded system I'm working on. I need
gudev for other stuff, but I don't have libacl and some of the other
dependencies.

Any opinions?

Regards,
Michael

---
 Makefile.am  |   25 +++++++++++++++++++++----
 configure.ac |   59 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 69 insertions(+), 15 deletions(-)

Index: b/Makefile.am
===================================================================
--- a/Makefile.am
+++ b/Makefile.am
@@ -288,7 +288,8 @@ extras_v4l_id_v4l_id_LDADD = libudev/lib
 libexec_PROGRAMS += extras/v4l_id/v4l_id
 dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules
 
-if ENABLE_EXTRAS
+if ENABLE_USBDB
+if ENABLE_PCIDB
 # ------------------------------------------------------------------------------
 # conditional extras (need glib, libusb, libacl, ...)
 # ------------------------------------------------------------------------------
@@ -296,7 +297,12 @@ dist_udevrules_DATA += \
 	rules/rules.d/75-net-description.rules \
 	rules/rules.d/75-tty-description.rules \
 	rules/rules.d/78-sound-card.rules
+endif # ENABLE_PCIDB
+endif # ENABLE_USBDB
 
+BUILT_SOURCES =
+
+if ENABLE_GUDEV
 # ------------------------------------------------------------------------------
 # GUdev - libudev gobject interface
 # ------------------------------------------------------------------------------
@@ -334,7 +340,7 @@ dist_extras_gudev_libgudev_1_0_la_SOURCE
 	extras/gudev/gudevmarshal.c \
 	extras/gudev/gudevenumtypes.h \
 	extras/gudev/gudevenumtypes.c
-BUILT_SOURCES = $(dist_extras_gudev_libgudev_1_0_la_SOURCES)
+BUILT_SOURCES += $(dist_extras_gudev_libgudev_1_0_la_SOURCES)
 
 extras_gudev_libgudev_1_0_la_CPPFLAGS = \
 	$(AM_CPPFLAGS) \
@@ -410,7 +416,9 @@ typelibs_DATA = extras/gudev/GUdev-1.0.t
 
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 endif # ENABLE_INTROSPECTION
+endif # ENABLE_GUDEV
 
+if ENABLE_BLUETOOTH
 # ------------------------------------------------------------------------------
 # Bluetooth HID devices with special magic to switch the device
 # ------------------------------------------------------------------------------
@@ -419,7 +427,9 @@ extras_hid2hci_hid2hci_CPPFLAGS = $(AM_C
 extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS)
 dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules
 libexec_PROGRAMS += extras/hid2hci/hid2hci
+endif # ENABLE_BLUETOOTH
 
+if ENABLE_ACL
 # ------------------------------------------------------------------------------
 # udev_acl - apply ACLs for users with local forground sessions
 # ------------------------------------------------------------------------------
@@ -434,7 +444,9 @@ udevacl-install-hook:
 	ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck
 
 INSTALL_EXEC_HOOKS += udevacl-install-hook
+endif # ENABLE_ACL
 
+if ENABLE_USBDB
 # ------------------------------------------------------------------------------
 # usb-db - read USB vendor/device string database
 # ------------------------------------------------------------------------------
@@ -442,7 +454,9 @@ extras_usb_db_usb_db_SOURCES = extras/us
 extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
 extras_usb_db_usb_db_LDADD = libudev/libudev-private.la
 libexec_PROGRAMS += extras/usb-db/usb-db
+endif # ENABLE_USBDB
 
+if ENABLE_PCIDB
 # ------------------------------------------------------------------------------
 # pci-db - read PCI vendor/device string database
 # ------------------------------------------------------------------------------
@@ -450,7 +464,9 @@ extras_usb_db_pci_db_SOURCES = extras/us
 extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
 extras_usb_db_pci_db_LDADD = libudev/libudev-private.la
 libexec_PROGRAMS += extras/usb-db/pci-db
+endif # ENABLE_PCIDB
 
+if ENABLE_MODEM_MODESWITCH
 # ------------------------------------------------------------------------------
 # modem-modeswitch - magic config switch for 3G modems
 # ------------------------------------------------------------------------------
@@ -470,7 +486,9 @@ dist_udevrules_DATA += \
 	extras/modem-modeswitch/61-mobile-action.rules
 
 libexec_PROGRAMS += extras/modem-modeswitch/modem-modeswitch
+endif # ENABLE_MODEM_MODESWITCH
 
+if ENABLE_KEYMAP
 # ------------------------------------------------------------------------------
 # keymap - map custom hardware's multimedia keys
 # ------------------------------------------------------------------------------
@@ -562,8 +580,7 @@ extras/keymap/keys-to-name.h: extras/key
 keymaps-distcheck-hook: extras/keymap/keys.txt
 	$(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^
 DISTCHECK_HOOKS = keymaps-distcheck-hook
-
-endif # ENABLE_EXTRAS
+endif # ENABLE_KEYMAP
 
 # ------------------------------------------------------------------------------
 # install, uninstall, clean hooks
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -46,32 +46,70 @@ if test "x$enable_logging" = "xyes"; the
 	AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
 fi
 
-AC_ARG_ENABLE([extras],
-	AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]),
-	[], [enable_extras=yes])
-if test "x$enable_extras" = xyes; then
+AC_ARG_ENABLE([gudev],
+	AS_HELP_STRING([--disable-gudev], [disable libgudev - libudev gobject interface]),
+	[], [enable_gudev=yes])
+AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes])
+AC_ARG_ENABLE([bluetooth],
+	AS_HELP_STRING([--disable-bluetooth], [disable Bluetooth HID devices with special magic to switch the device]),
+	[], [enable_bluetooth=yes])
+AM_CONDITIONAL([ENABLE_BLUETOOTH], [test "x$enable_bluetooth" = xyes])
+AC_ARG_ENABLE([keymap],
+	AS_HELP_STRING([--disable-keymap], [disable keymap - map custom hardware's multimedia keys]),
+	[], [enable_keymap=yes])
+AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes])
+AC_ARG_ENABLE([acl],
+	AS_HELP_STRING([--disable-acl], [disable udev_acl - apply ACLs for users with local forground sessions]),
+	[], [enable_acl=yes])
+AM_CONDITIONAL([ENABLE_ACL], [test "x$enable_acl" = xyes])
+AC_ARG_ENABLE([usbdb],
+	AS_HELP_STRING([--disable-usbdb], [disable usb-db - read USB vendor/device string database]),
+	[], [enable_usbdb=yes])
+AM_CONDITIONAL([ENABLE_USBDB], [test "x$enable_usbdb" = xyes])
+AC_ARG_ENABLE([pcidb],
+	AS_HELP_STRING([--disable-pcidb], [disable pci-db - read PCI vendor/device string database]),
+	[], [enable_pcidb=yes])
+AM_CONDITIONAL([ENABLE_PCIDB], [test "x$enable_pcidb" = xyes])
+AC_ARG_ENABLE([modem-modeswitch],
+	AS_HELP_STRING([--disable-modem-modeswitch], [disable modem-modeswitch - magic config switch for 3G modems]),
+	[], [enable_modem_modeswitch=yes])
+AM_CONDITIONAL([ENABLE_MODEM_MODESWITCH], [test "x$enable_modem_modeswitch" = xyes])
+
+if test "x$enable_keymap" = xyes; then
 	AC_PATH_PROG([GPERF], [gperf])
 	if test -z "$GPERF"; then
 		AC_MSG_ERROR([gperf is needed])
 	fi
+fi
 
+if test "x$enable_gudev" = xyes -o "x$enable_acl" = xyes; then
 	PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0])
 	AC_SUBST([GLIB_CFLAGS])
 	AC_SUBST([GLIB_LIBS])
+fi
 
-	AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
-	AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
-
+if test "x$enable_bluetooth" = xyes -o "x$enable_modem_modeswitch" = xyes; then
 	PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12)
 	AC_SUBST(LIBUSB_CFLAGS)
 	AC_SUBST(LIBUSB_LIBS)
+fi
 
+if test "x$enable_acl" = xyes; then
+	AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
+	AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
+fi
+
+if test "x$enable_usbdb" = xyes; then
 	PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
 	AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
+fi
 
-	AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
-	AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
-	AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
+if test "x$enable_pcidb" = xyes; then
+	if test "x$cross_compiling" != xyes; then
+		AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
+		AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
+		AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
+	fi
 	AC_ARG_WITH(pci-ids-path,
 		AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]),
 		[PCI_DATABASE=${withval}],
@@ -82,7 +120,6 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 fi
-AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes])
 
 AC_ARG_ENABLE([introspection],
 	AS_HELP_STRING([--disable-introspection], [disable GObject introspection]),

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux