summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-26 03:50:35 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-26 03:51:34 +0100
commit06fee274b0741bf2a09fde93fb375226d35cb658 (patch)
tree9998df09433fafe48696de526996672ff195f41b
parent90a007f6a34f3cff729ed5fbc8020085bd4f7a8b (diff)
add autoconf logic to find usb.ids/pci.ids
-rw-r--r--configure.ac33
-rw-r--r--usb-db/Makefile.am4
2 files changed, 35 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index ccc9421..e9693ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,36 @@ AC_SUBST(udev_prefix)
AC_DEFINE(LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE, 1, [I know the API is subject to change])
+AC_CHECK_FILES([/usr/share/usb.ids], [usbids=/usr/share/usb.ids])
+AC_CHECK_FILES([/usr/share/hwdata/usb.ids], [usbids=/usr/share/hwdata/usb.ids])
+AC_CHECK_FILES([/usr/share/misc/usb.ids], [usbids=/usr/share/misc/usb.ids])
+
+AC_ARG_WITH(usb-ids-path,
+ AS_HELP_STRING([--usb-ids-path=DIR], [Path to usb.ids file]),
+ [USB_DATABASE=${withval}],
+ [if test -n "$usbids" ; then
+ USB_DATABASE="$usbids"
+ else
+ AC_MSG_ERROR([usb.ids not found, try --with-usb-ids-path=])
+ fi])
+
+AC_SUBST(USB_DATABASE)
+
+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])
+
+AC_ARG_WITH(pci-ids-path,
+ AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]),
+ [PCI_DATABASE=${withval}],
+ [if test -n "$pciids" ; then
+ PCI_DATABASE="$pciids"
+ else
+ AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
+ fi])
+
+AC_SUBST(PCI_DATABASE)
+
AC_CONFIG_FILES([
Makefile
modem-probe/Makefile
@@ -95,6 +125,9 @@ echo "
datarootdir: ${datarootdir}
mandir: ${mandir}
+ usb.ids: ${USB_DATABASE}
+ pci.ids: ${PCI_DATABASE}
+
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
diff --git a/usb-db/Makefile.am b/usb-db/Makefile.am
index 82d8fe6..fb13d10 100644
--- a/usb-db/Makefile.am
+++ b/usb-db/Makefile.am
@@ -6,11 +6,11 @@ udevhome_PROGRAMS = usb-db pci-db
COMMON_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUDEV_CFLAGS)
usb_db_SOURCES = usb-db.c
-usb_db_CPPFLAGS = $(COMMON_CPPFLAGS) -DUSB_DATABASE=\"/usr/share/hwdata/usb.ids\" -DBUILD_FOR_USB
+usb_db_CPPFLAGS = $(COMMON_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
usb_db_LDADD = $(LIBUDEV_LIBS)
pci_db_SOURCES = $(usb_db_SOURCES)
-pci_db_CPPFLAGS = $(COMMON_CPPFLAGS) -DPCI_DATABASE=\"/usr/share/hwdata/pci.ids\" -DBUILD_FOR_PCI
+pci_db_CPPFLAGS = $(COMMON_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
pci_db_LDADD = $(usb_db_LDADD)
#udevrulesdir = $(udev_prefix)/lib/udev/rules.d