From 0715b08d6aa794b215d1bc91dbf401192f3510b7 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 13 Feb 2008 17:58:20 +0100 Subject: [PATCH] Use LDLIBS for all libraries on which libpci depends. This way, libpci.pc gets all dependencies, including -lpci on NetBSD. Clearing LDLIBS at the top of config.mk is necessary, because this file can get read twice. --- Makefile | 4 ++-- lib/Makefile | 2 +- lib/configure | 9 +++++++-- lib/libpci.pc.in | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f37bf80..0ba5524 100644 --- a/Makefile +++ b/Makefile @@ -42,8 +42,8 @@ force: lib/config.h lib/config.mk: cd lib && ./configure "$(IDSDIR)" "$(VERSION)" "$(HOST)" "$(RELEASE)" "$(ZLIB)" -lspci: lspci.o common.o $(PCILIB) /usr/lib/libresolv.a -setpci: setpci.o common.o $(PCILIB) /usr/lib/libresolv.a +lspci: lspci.o common.o $(PCILIB) +setpci: setpci.o common.o $(PCILIB) lspci.o: lspci.c pciutils.h $(PCIINC) setpci.o: setpci.c pciutils.h $(PCIINC) diff --git a/lib/Makefile b/lib/Makefile index 49eb6fb..18fff3a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -59,7 +59,7 @@ $(PCILIBPC): $(PCILIBPC).in -e 's,@LIBDIR@,$(LIBDIR),' \ -e 's,@IDSDIR@,$(IDSDIR),' \ -e 's,@VERSION@,$(VERSION),' \ - -e 's,@LIBZ@,$(LIBZ),' + -e 's,@LDLIBS@,$(LDLIBS),' init.o: init.c $(INCL) access.o: access.c $(INCL) diff --git a/lib/configure b/lib/configure index 0e1fab1..b41628c 100755 --- a/lib/configure +++ b/lib/configure @@ -39,7 +39,7 @@ c=config.h m=config.mk echo >$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`" echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`" -rm -f $m +echo >$m 'LDLIBS=' echo_n "Looking for access methods..." @@ -58,6 +58,7 @@ case $sys in esac echo >>$c '#define PCI_HAVE_64BIT_ADDRESS' echo >>$c '#define PCI_USE_DNS' + echo >>$m 'LDLIBS+=-lresolv' ;; sunos) case $cpu in @@ -71,18 +72,21 @@ case $sys in esac echo >>$c '#define PCI_HAVE_STDINT_H' echo >>$c '#define PCI_USE_DNS' + echo >>$m 'LDLIBS+=-lresolv' ;; freebsd) echo_n " fbsd-device" echo >>$c '#define PCI_HAVE_PM_FBSD_DEVICE' echo >>$c '#define PCI_PATH_FBSD_DEVICE "/dev/pci"' echo >>$c '#define PCI_USE_DNS' + echo >>$m 'LDLIBS+=-lresolv' ;; openbsd) echo_n " obsd-device" echo >>$c '#define PCI_HAVE_PM_OBSD_DEVICE' echo >>$c '#define PCI_PATH_OBSD_DEVICE "/dev/pci"' echo >>$c '#define PCI_USE_DNS' + echo >>$m 'LDLIBS+=-lresolv' ;; aix) echo_n " aix-device" @@ -97,12 +101,13 @@ case $sys in echo >>$c '#define PCI_HAVE_PM_NBSD_LIBPCI' echo >>$c '#define PCI_PATH_NBSD_DEVICE "/dev/pci0"' echo >>$m 'PCILIB=lib/libpciutils.a' - echo >>$m 'LDLIBS+=-lpci' + echo >>$m 'LDLIBS+=-lpci -lresolv' ;; gnu) echo_n " i386-ports" echo >>$c '#define PCI_HAVE_PM_INTEL_CONF' echo >>$c '#define PCI_USE_DNS' + echo >>$m 'LDLIBS+=-lresolv' ;; *) echo " Unfortunately, your OS is not supported by the PCI Library" diff --git a/lib/libpci.pc.in b/lib/libpci.pc.in index 3e47698..f43f498 100644 --- a/lib/libpci.pc.in +++ b/lib/libpci.pc.in @@ -6,5 +6,5 @@ idsdir=@IDSDIR@ Name: libpci Description: libpci Version: @VERSION@ -Libs: -L${libdir} -lpci @LIBZ@ +Libs: -L${libdir} -lpci @LDLIBS@ Cflags: -I${includedir} -- 2.39.5